Skip to content

Rakshit-gen/vantageedge-fe

Repository files navigation

VantageEdge Frontend v2 - Modern API Gateway Dashboard

A production-ready, fully-featured dashboard for VantageEdge API Gateway with synchronized authentication, real-time data, and modern UI/UX.

βœ… Project Status: COMPLETE & PRODUCTION READY

All features implemented, tested, and deployed to production (Vercel).

🎨 Design Features

Unique Design Elements

  • Space Grotesk Font - Modern, geometric sans-serif typography
  • Purple/Pink Gradient Theme - Distinctive color palette with dark mode
  • Glassmorphism Effects - Modern frosted glass UI components
  • Framer Motion Animations - Smooth, delightful page transitions
  • Grid & Dot Patterns - Subtle background textures
  • Gradient Text - Eye-catching headings with gradient effects
  • Custom Animations - Shimmer loading, fade, scale effects

Authentication & Security

  • Auto-sync with Backend - User and tenant automatically synced on login
  • Clerk Integration - Beautiful, secure authentication UI
  • Organization Support - Multi-tenant with Clerk organizations
  • Token Management - Automatic JWT token handling in all API calls
  • API Key Authentication - Support for service-to-service auth

Architecture

  • Type-Safe API Client - Full TypeScript support with proper types
  • Auth Sync Service - Dedicated service for backend synchronization
  • Dual API Clients - Separate clients for auth and tenant operations
  • Theme Support - Dark mode with system preference detection
  • State Management - React Query for server state, Zustand for client state
  • Error Handling - Comprehensive error interceptors and user feedback

πŸš€ Quick Start

  1. Install dependencies
npm install
  1. Configure environment
cp .env.example .env.local
# Add your Clerk keys and API URL
  1. Run development server
npm run dev
  1. Open browser http://localhost:3000

πŸ“¦ Complete Feature Set

Pages (All Implemented βœ…)

  • βœ… Landing Page - Modern hero section with gradient effects
  • βœ… Auth Pages - Glassmorphic sign-in/sign-up with Clerk
  • βœ… Dashboard Overview - Real-time stats, top routes, quick actions
  • βœ… Services Management - Full CRUD for backend origins
  • βœ… Routes Configuration - Create, edit, delete routes with auth modes
  • βœ… API Keys - Generate, view, and manage API keys securely
  • βœ… Analytics Dashboard - Real-time metrics and request analytics
  • βœ… Cache Explorer - View and manage cached entries
  • βœ… Settings - Tenant settings with tenant ID display

Components (All Built βœ…)

  • βœ… Button - Multiple variants (default, outline, ghost, destructive)
  • βœ… Card - Glassmorphic cards with hover effects
  • βœ… Badge - Status indicators and labels
  • βœ… Input - Form inputs with proper styling
  • βœ… Label - Form labels
  • βœ… Dialog - Modal dialogs for forms
  • βœ… Dashboard Shell - Sidebar navigation with active states
  • βœ… Add Origin Dialog - Create/edit backend services
  • βœ… Add Route Dialog - Configure routing rules

Core Features (All Working βœ…)

  • βœ… Automatic User/Tenant Sync - Seamless backend synchronization
  • βœ… JWT Token Handling - Automatic token injection in API calls
  • βœ… API Key Authentication - Support for X-API-Key header
  • βœ… Real-time Data Fetching - All data from live API endpoints
  • βœ… CRUD Operations - Create, read, update, delete for all resources
  • βœ… Search & Filtering - Search functionality across resources
  • βœ… Responsive Design - Mobile-first, works on all devices
  • βœ… Loading States - Shimmer effects and skeleton loaders
  • βœ… Error Handling - User-friendly error messages with retry
  • βœ… Toast Notifications - Success/error feedback with Sonner
  • βœ… Copy to Clipboard - Easy tenant ID and API key copying

πŸ”„ Authentication Flow

  1. User signs in with Clerk
  2. Frontend automatically syncs with backend:
    • POST /api/v1/auth/sync-user (creates user record)
    • POST /api/v1/auth/sync-tenant (creates tenant if needed)
  3. Tenant ID resolved from Clerk user/org ID
  4. All API calls include JWT token in Authorization header
  5. Backend validates token and maps to internal user/tenant
  6. User can access all dashboard features

🎯 Tech Stack

  • Framework: Next.js 14.2.5 (App Router)
  • Language: TypeScript 5.4.5
  • Styling: Tailwind CSS 3.4.4 + Custom animations
  • UI Library: Radix UI primitives (shadcn/ui)
  • Auth: Clerk 5.1.0 (with org support)
  • Animations: Framer Motion 11.2.10
  • Data Fetching: TanStack Query 5.40.0
  • API Client: Axios 1.7.2 with interceptors
  • Theme: next-themes 0.3.0
  • Toast: Sonner 1.4.41
  • Forms: React Hook Form 7.51.5 + Zod 3.23.8
  • Icons: Lucide React 0.395.0

πŸ“ Project Structure

app/
β”œβ”€β”€ auth/
β”‚   β”œβ”€β”€ sign-in/[[...sign-in]]/    # Clerk sign in page
β”‚   └── sign-up/[[...sign-up]]/    # Clerk sign up page
β”œβ”€β”€ dashboard/
β”‚   β”œβ”€β”€ layout.tsx                  # Dashboard shell with sidebar
β”‚   β”œβ”€β”€ page.tsx                    # Overview with real-time stats
β”‚   β”œβ”€β”€ services/                   # Origin/Service management
β”‚   β”œβ”€β”€ routes/                     # Route configuration
β”‚   β”œβ”€β”€ api-keys/                   # API key management
β”‚   β”œβ”€β”€ analytics/                  # Real-time analytics
β”‚   β”œβ”€β”€ cache/                      # Cache explorer
β”‚   └── settings/                   # Tenant settings
β”œβ”€β”€ layout.tsx                      # Root layout with providers
β”œβ”€β”€ page.tsx                        # Landing page
└── globals.css                     # Custom styles & animations

components/
β”œβ”€β”€ dashboard/
β”‚   β”œβ”€β”€ shell.tsx                   # Sidebar + header navigation
β”‚   β”œβ”€β”€ add-origin-dialog.tsx       # Create/edit origins
β”‚   └── add-route-dialog.tsx        # Create/edit routes
β”œβ”€β”€ ui/
β”‚   β”œβ”€β”€ button.tsx                  # Button component
β”‚   β”œβ”€β”€ card.tsx                    # Card component
β”‚   β”œβ”€β”€ badge.tsx                   # Badge component
β”‚   β”œβ”€β”€ input.tsx                   # Input component
β”‚   β”œβ”€β”€ label.tsx                   # Label component
β”‚   └── dialog.tsx                  # Dialog component
└── providers.tsx                   # Query + Theme + Auth providers

lib/
β”œβ”€β”€ api/
β”‚   β”œβ”€β”€ client.ts                   # Server-side API client
β”‚   β”œβ”€β”€ client-api.ts               # Browser API client (tenant-based)
β”‚   └── auth-sync.ts               # Auth synchronization service
β”œβ”€β”€ auth/
β”‚   └── sync.ts                     # User/tenant sync utilities
β”œβ”€β”€ contexts/
β”‚   └── tenant-context.tsx          # Tenant context provider
β”œβ”€β”€ types/
β”‚   └── index.ts                    # TypeScript type definitions
└── utils.ts                        # Utility functions

πŸ”‘ Environment Variables

# Clerk (REQUIRED)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_xxx
CLERK_SECRET_KEY=sk_test_xxx

# Clerk URLs
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/auth/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/auth/sign-up
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/dashboard
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/dashboard

# API
NEXT_PUBLIC_API_URL=https://vantageedge.onrender.com
NEXT_PUBLIC_GATEWAY_URL=http://localhost:8000

🎨 Design System

Colors

  • Primary: Purple (hsl(262 83% 58%))
  • Secondary: Slate
  • Success: Green (#22C55E)
  • Warning: Orange (#F97316)
  • Destructive: Red (#EF4444)
  • Muted: Subtle grays for backgrounds

Typography

  • Font: Space Grotesk (geometric sans-serif)
  • Headings: Bold with tight tracking
  • Gradient Text: Purple to pink gradient for emphasis
  • Monospace: For code, IDs, and technical data

Effects

  • Glassmorphism: bg-background/80 backdrop-blur-xl
  • Shadows: Subtle, layered shadows for depth
  • Animations: Smooth transitions (300ms)
  • Patterns: Grid and dot backgrounds
  • Hover Effects: Scale and shadow on interactive elements

πŸ”§ Development

# Install dependencies
npm install

# Run dev server
npm run dev

# Type check
npm run type-check

# Build for production
npm run build

# Start production server
npm start

🚒 Deployment

Vercel (Production)

  1. Push to GitHub
  2. Import in Vercel
  3. Add environment variables:
    • NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
    • CLERK_SECRET_KEY
    • NEXT_PUBLIC_API_URL
  4. Deploy automatically on push

Current Production URL: https://vantageedge.vercel.app

Docker

docker build -t vantageedge-frontend .
docker run -p 3000:3000 vantageedge-frontend

πŸ” Backend Integration

Fully integrated with VantageEdge Go backend:

βœ… Auth Endpoints

  • POST /api/v1/auth/sync-user
  • POST /api/v1/auth/sync-tenant
  • GET /api/v1/auth/me
  • GET /api/v1/auth/tenant

βœ… Resource Endpoints

  • Tenants: CRUD operations
  • Origins: Full CRUD with health checks
  • Routes: Create, update, delete with auth modes
  • API Keys: Generate, list, delete with secure hashing
  • Analytics: Real-time metrics and statistics
  • Cache: View and manage cached entries

βœ… Authentication

  • JWT tokens validated by backend
  • API key authentication supported
  • Clerk user/org IDs mapped to internal tenant IDs

✨ Key Features

Real-Time Data

  • All dashboard data fetched from live API
  • No hardcoded data - everything is dynamic
  • Auto-refresh for analytics (30s interval)
  • Loading states with shimmer effects

User Experience

  • Smooth page transitions with Framer Motion
  • Responsive sidebar navigation
  • Search functionality across all resources
  • Copy-to-clipboard for IDs and keys
  • Toast notifications for all actions
  • Error handling with retry options

Multi-Tenant Support

  • Automatic tenant creation on signup
  • Tenant ID visible in settings
  • All resources scoped to tenant
  • Clerk organization support

πŸ“Š Production Metrics

  • Build Status: βœ… Compiles successfully
  • Type Safety: βœ… 100% TypeScript coverage
  • Linting: βœ… No errors
  • Deployment: βœ… Live on Vercel
  • Backend: βœ… Deployed on Render
  • Database: βœ… PostgreSQL with 6 migrations
  • Cache: βœ… Redis integration

πŸ“ Implementation Notes

  • βœ… Auth sync happens automatically on every sign-in
  • βœ… All API calls include JWT token automatically
  • βœ… Theme persists across sessions (dark mode)
  • βœ… Responsive design works on all devices
  • βœ… All CRUD operations fully functional
  • βœ… Real-time analytics with auto-refresh
  • βœ… Cache management with search
  • βœ… Tenant ID display and copying
  • βœ… API key generation with secure prefixes

🎯 What's Working

  • βœ… Complete user authentication flow
  • βœ… Automatic backend synchronization
  • βœ… Full CRUD for all resources
  • βœ… Real-time analytics dashboard
  • βœ… Cache exploration and management
  • βœ… API key generation and management
  • βœ… Route configuration with multiple auth modes
  • βœ… Service/origin management with health checks
  • βœ… Settings page with tenant information
  • βœ… Production deployment on Vercel

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published