Understanding the ignitionstack.pro architecture and folder organization.
/src/app - Next.js App RouterThe main application code using Next.js 15 App Router with React 19.
src/app/
├── [locale]/ # Internationalized routes (pt, en, es)
│ ├── (pages)/ # Public pages (grouped route)
│ │ ├── blog/ # Blog with MDX support
│ │ ├── chat/ # AI Chatbot interface
│ │ ├── contact/ # Contact form
│ │ ├── dashboard/ # User dashboard
│ │ ├── login/ # Authentication
│ │ ├── projects/ # Projects management
│ │ ├── settings/ # User settings
│ │ └── store/ # E-commerce store
│ └── admin/ # Admin panel
│ └── (protected)/ # Auth-protected admin routes
├── api/ # API routes (webhooks, etc.)
├── auth/ # Auth callbacks
├── components/ # React components
├── hooks/ # Custom React hooks
├── lib/ # Utilities and helpers
├── server/ # Server queries/actions
└── test/ # Unit & integration testsThe [locale] segment enables i18n routing with next-intl. All pages inside are automatically translated.
/src/app/components - UI ComponentsOrganized by feature and reusability:
components/
├── admin/ # Admin dashboard components
├── ai/ # AI chatbot components
├── auth/ # Authentication UI
├── blog/ # Blog-related components
├── commons/ # Shared components (Header, Footer, etc.)
├── contact/ # Contact form components
├── insights/ # Analytics visualizations
├── landing-page/ # Hero, Features, Pricing, etc.
├── projects/ # Project management UI
├── store/ # E-commerce components
└── ui/ # Base UI components (Button, Input, Card, etc.)/src/app/lib - Utilities & Business LogicCore utilities and integrations:
lib/
├── ai/ # AI provider integrations
├── auth/ # Authentication utilities
├── blog/ # Blog helpers
├── mappers/ # Entity mappers (DB ↔ Domain)
├── repositories/ # Data access layer
├── services/ # Business services
├── supabase/ # Supabase client factories
├── utils/ # General utilities
├── validations/ # Zod schemas & validators
├── action-result.ts # Standardized action returns
├── admin-action-wrapper.ts # Admin auth decorator
├── analytics.ts # Analytics tracking
├── cache.ts # React cache utilities
├── logger.ts # Pino structured logging
└── stripe.ts # Stripe integration/src/app/server - Server FunctionsServer-side data fetching and mutations:
server/
├── insights/ # Analytics queries
├── queries/ # Data queries (read operations)
└── actions/ # Mutations (create, update, delete)Always use Server Actions for mutations. They provide better security with automatic CSRF protection.
/src/app/hooks - Custom React HooksReusable hooks for common patterns:
hooks/
├── index.ts # Central exports
├── use-async-action.ts # Async state management
├── use-optimistic-action.ts # Optimistic UI updates
└── use-form-field.ts # Form field validation/src/i18n - Internationalizationi18n/
├── locales/
│ ├── en.json # English translations
│ ├── pt.json # Portuguese translations
│ └── es.json # Spanish translations
└── config.ts # i18n configuration/src/store - State Managementstore/
└── use-store.ts # Zustand global store/src/types - TypeScript Typestypes/
├── supabase.ts # Generated Supabase types
└── index.ts # Shared type definitions/supabase - Databasesupabase/
├── migrations/ # SQL migrations
├── seed.sql # Seed data
└── config.toml # Supabase config| File | Purpose |
|---|---|
src/middleware.ts | i18n routing, auth checks, rate limiting |
next.config.ts | Next.js configuration |
tailwind.config.ts | Tailwind CSS customization |
tsconfig.json | TypeScript configuration |
.env.example | Environment variables template |
Data access is abstracted through repositories:
// lib/repositories/user-repository.ts
export const userRepository = {
async findById(id: string) { ... },
async create(data: CreateUserInput) { ... },
async update(id: string, data: UpdateUserInput) { ... },
}Transform database rows to domain objects:
// lib/mappers/product.ts
export function mapProductFromDB(row: ProductRow): Product {
return {
id: row.id,
name: row.name,
price: row.price_cents / 100,
// ...
}
}Standardized server action returns:
// lib/action-result.ts
type ActionResult<T> =
| { success: true; data: T }
| { success: false; error: string }Decorator for admin-only operations:
// Automatically validates admin auth
export const deleteUser = withAdminAuth(async (userId: string) => {
// ...
})Use @/ for clean imports:
// Instead of:
import { Button } from '../../../components/ui/button'
// Use:
import { Button } from '@/components/ui/button'