Tech Stack
The project uses modern web technologies:- Frontend: Next.js 16, React 19, TypeScript
- Styling: Tailwind CSS 4
- State Management: Zustand 5
- Backend: Supabase (Auth, Database, Edge Functions)
- Payments: MercadoPago (primary), Wompi (future)
- Hosting: Cloudflare Pages (static export)
- Worker: Cloudflare Workers (webhook handling)
- Testing: Vitest with React Testing Library
Root Directory Structure
Source Directory (src/)
The src/ directory is organized into several key areas:
App Directory (src/app/)
Next.js 16 App Router structure with file-based routing:
Features Directory (src/features/)
Feature-based modules that encapsulate related functionality:
Shared Directory (src/shared/)
Reusable components and utilities:
Library Directory (src/lib/)
Core library integrations:
Test Directory (src/test/)
Testing utilities and setup:
Remotion Directory (src/remotion/)
Video generation for marketing materials:
Feature Module Pattern
Each feature follows a consistent structure:Key Principles
- Colocation: Keep related code together
- Explicit exports: Use
index.tsto define public API - Type safety: TypeScript types in dedicated files
- Testability: Tests alongside feature code
- Separation of concerns: Components, logic, and data are separated
Database Tables
Key Supabase tables (see/supabase/migrations/):
profiles- User profiles with subscription statussubscriptions- Active subscriptionswizard_data- Wizard form datauser_plans- Generated fitness planswebhook_logs- MercadoPago webhook logssubscription_audit_log- Subscription changes audit
External Services
Cloudflare Worker
Handles MercadoPago webhooks:- URL: https://mercadopago-jcv.fagal142010.workers.dev
- Location:
/cloudflare-worker/ - Deploy:
cd cloudflare-worker && wrangler deploy
Key Documents
/docs/PRD-subscription-system.md- Subscription system PRD/openspec/- Feature specifications/CLAUDE.md- Development rules and guidelines/supabase/migrations/- Database schema
Environment Configuration
Required environment variables:Navigation Flow
- Landing (
/) → Introduce product - Pricing (
/pricing) → Show plans - Auth → Login/register
- Wizard (
/wizard) → Generate personalized plan - Payment → MercadoPago checkout
- Dashboard (
/dashboard) → Access plans - Plan Views (
/plan/*) → View workout/meal plans