How tristanrenard/anagodev-web works
Main System Components
A. Frontend Layer
• Client-Side Components (src/components)
• Pages and Routing (src/pages)
• UI Components (src/components/ui)
• Form Components (src/components/form)
B. API Layer
• Authentication Routes (src/pages/api/user)
• Controllers (src/controllers)
C. Database Layer
• Models (src/db/models)
• Migrations (src/db/migrations)
D. External Services
• Stripe Integration (src/lib/stripe.js)
• Email Service (src/utils/mail)
Component Relationships
A. Frontend to API:
• REST API calls from pages to API routes
• Authentication flow (register, login, verify)
B. API to Services:
• Controllers to Database Models
• Authentication flow to Email Service
• Payment processing to Stripe
C. Database Relationships:
• User → Address (one-to-many)
• User → PaymentMethod (one-to-many)
• Order → Products (many-to-many through OrderProducts)
• Product → Category (many-to-one)
Specific Implementation Details
A. Authentication Flow:
Register → Phone Verification → Email Verification → User Creation
Login → Token Generation → Protected Routes
B. Data Flow:
Client Request → API Route → Controller → Model → Database
Key Technical Aspects to Highlight
• Next.js Pages Router architecture
• RESTful API structure
• Knex.js database migrations
• Authentication middleware
• Form handling and validation
• External service integrations
┌─────────────────────────────────────────────┐
• Client Layer │
• (Pages, Components, Forms, UI Elements) │
• ┤
• API Layer │
• (API Routes, Controllers, Authentication) │
• ┤
• Service Layer │
• (Email, Stripe, Phone Verification) │
• ┤
• Database Layer │
• (Models, Migrations, Relationships) │
• ┘