A full-stack AI video generation platform built with Next.js, React, Supabase, and Tailwind CSS. This is a recreation of babiceva.ai for the 8x FullStack Internship assignment.
- β Homepage with hero section, navigation, and example gallery
- β User authentication (email/password signup and login)
- β Video Generation tool mock page
- β
Subscription management:
- Free and Pro tiers
- Fake checkout flow that writes to database
- Feature gating based on subscription tier
- β Profile page with account management
- β Protected routes (redirects to login if not authenticated)
- β Sign out functionality
- Frontend: Next.js 16, React 19, TypeScript
- Backend: Supabase (local instance via Docker)
- Styling: Inline styles (for consistency across the project)
- Auth: Supabase Auth
- Database: PostgreSQL via Supabase
- Node.js 18+
- pnpm
- Docker (for local Supabase)
- WSL2 (if on Windows)
- Clone and install dependencies
git clone <your-repo-url>
cd 8x-hiring-template
pnpm install- Start Supabase local instance
supabase startThis will output connection details. Copy the Publishable key.
- Configure environment variables
Create .env.local:
NEXT_PUBLIC_SUPABASE_URL="http://WSL_IP:54521"
NEXT_PUBLIC_SUPABASE_ANON_KEY="<publishable-key-from-supabase>"
SUPABASE_SERVICE_ROLE_KEY="<secret-key-from-supabase>"Important for WSL2 users: Replace YOUR_WSL_IP with your actual WSL IP address (find it with hostname -I | awk '{print $1}'). Using localhost or 127.0.0.1 won't work due to WSL2 networking.
- Initialize database
supabase db reset- Start development server
pnpm devVisit http://localhost:3000
Problem: Browser couldn't connect to Supabase running on 127.0.0.1:54521 - got ERR_CONNECTION_REFUSED.
Root Cause: WSL2 networking isolation - Windows browser can't reach services on 127.0.0.1 inside WSL2.
Solution: Used WSL2 IP address instead of localhost in .env.local. Found IP with hostname -I.
Problem: Multiple errors about missing Supabase URL/keys.
Root Cause: Inconsistent environment variable names - client was looking for NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY but Supabase docs use NEXT_PUBLIC_SUPABASE_ANON_KEY.
Solution:
- Updated
lib/supabase/client.tsto useNEXT_PUBLIC_SUPABASE_ANON_KEY - Updated
lib/supabase/server.tsto match - Ensured
.env.localuses correct variable names
Problem: React hydration mismatch warnings due to browser extensions adding attributes to <body>.
Solution: Added suppressHydrationWarning to both <html> and <body> tags in app/layout.tsx.
Problem: "Cannot update a component while rendering a different component" error in checkout page.
Root Cause: Calling router.push() directly during render phase for auth checks.
Solution: Wrapped auth redirect logic in useEffect hook.
Problem: Mixed Tailwind classes and inline styles causing inconsistent rendering.
Decision: Standardized on inline styles throughout the app for consistency and to avoid Tailwind configuration issues in the template.
- Separation of Concerns: Server components for data fetching (profile page), client components for interactivity
- Context Providers: Used existing
AuthContextandSubscriptionContextfor global state - Inline Styles: Chose inline styles over Tailwind for consistency and reliability
- Auth state managed via Supabase Auth + React Context
- Subscription tier stored in database, fetched via Context
- Local component state for UI interactions (loading, errors, form inputs)
- Simulated 3-second processing delay with
setTimeout - Returns placeholder images from Unsplash
- Shows proper loading states and error handling
Used existing subscriptions table with:
user_id(foreign key to auth.users)tier(text: 'free' or 'pro')updated_at(timestamp)
- Sign Up β Create account with email/password
- Login β Authenticate and access protected routes
- Video Generation (Free):
- Access tool at
/tools/video-generation - See "Remove Watermark" feature locked with π icon
- Generate mock video with watermark
- Access tool at
- Upgrade Flow:
- Click "Upgrade to Pro" link
- View pricing at
/upgrade - Click "Upgrade to Pro" button
- Fill fake checkout form at
/checkout - Subscription tier updated to 'pro' in database
- Video Generation (Pro):
- Return to video tool
- "Remove Watermark" now unlocked β
- Generate video without watermark
- Profile:
- View subscription status
- Sign out or delete account
- Connect to actual AI APIs (OpenAI, Google Veo)
- Implement proper video generation queue
- Add video storage and retrieval
- Build Image Generator tool
- Build AI Dress Changer, Car Changer, Person Replacer tools
- File upload functionality with drag & drop
- Add success notifications (toast messages)
- Implement generation history page
- Add video download functionality
- Progressive loading for large results
- More granular error messages
- Retry logic for failed API calls
- Better offline handling
- Unit tests for components
- Integration tests for auth flow
- E2E tests for checkout process
- Image optimization with Next.js Image component
- Lazy loading for gallery
- Debounced search/filters
- ARIA labels for interactive elements
- Keyboard navigation support
- Screen reader optimization
- Currently desktop-first
- Add responsive breakpoints
- Mobile-optimized navigation
- Video editing capabilities
- Batch generation
- Custom model fine-tuning
- Team collaboration features
- Environment-specific configurations
- Proper logging and monitoring
- Rate limiting
- CORS configuration
- SSL/TLS setup
app/
βββ page.tsx # Homepage
βββ layout.tsx # Root layout with providers
βββ globals.css # Global styles
βββ auth/
β βββ login/page.tsx # Login page
β βββ signup/page.tsx # Signup page
βββ tools/
β βββ video-generation/page.tsx # Video generation tool
βββ upgrade/page.tsx # Pricing page
βββ checkout/page.tsx # Checkout flow
βββ profile/
β βββ page.tsx # Profile (server component)
β βββ profile-client.tsx # Profile UI (client component)
βββ api/
βββ auth/signout/route.ts # Sign out API
βββ account/delete/route.ts # Delete account API
components/
βββ navigation.tsx # Main navigation component
contexts/
βββ auth-context.tsx # Auth state management
βββ subscription-context.tsx # Subscription state
lib/
βββ supabase/
βββ client.ts # Browser Supabase client
βββ server.ts # Server Supabase client
[Loom video link will be added here]
- Authentication: Fully functional with Supabase Auth
- Database: All writes to
subscriptionstable working - Payments: Fake checkout flow (no real Stripe integration)
- AI Generation: Mocked with placeholder images
- WSL2 Setup: Documented workaround for networking issue
Built by [Your Name] for 8x FullStack Internship Assessment
Time Spent: ~8 hours
- Setup & debugging: 2 hours
- UI implementation: 3 hours
- Auth & database: 2 hours
- Documentation: 1 hour