Getting Started
Project Structure
Directory map of the main Questionnaire application.
Project Structure
The main app lives at the repository root. The docs app is isolated in documentation/.
questionnaire/
├── app/ # Next.js App Router (production)
│ ├── [slug]/ # Category pages
│ ├── article/[slug]/ # Article pages
│ ├── home/[slug]/ # Home article pages (no ads)
│ ├── api/ # API route handlers
│ └── layout.js # Root layout (pixels, header, footer)
├── components/
│ ├── ads/ # DisplayAd, RewardedAdManager, etc.
│ ├── hooks/ # Shared React hooks
│ ├── pages/ # Page-level client components
│ ├── questionnaire/ # Questionnaire theme
│ ├── whatsapp/ # WhatsApp theme
│ ├── guide/ # Guide theme
│ └── ui/ # Primitive UI components
├── lib/
│ ├── services/ # MongoDB data fetching
│ ├── utils/ # adConfig, pixelTracking, kvEncoding
│ └── constants/ # adDefaults.js
├── models/ # Mongoose schemas
├── docs/ # Legacy markdown (archive)
├── documentation/ # Fumadocs site (local only)
└── proxy.js # Multi-tenant middlewareKey entry points
| Route | File | Purpose |
|---|---|---|
/ | app/page.js | Homepage article grid |
/[slug] | app/[slug]/page.js | Category page |
/article/[slug] | app/article/[slug]/page.js | Full article with ads |
/home/[slug] | app/home/[slug]/page.js | Editorial content, no ads |
Component organization rules
components/ui/— no business logiccomponents/hooks/— shared hooks (useuseAdThemeTiming, not inline)components/ads/— all ad-related components- Root
components/*.js— barrel re-exports (do not delete)
File size limit
Hard limit: 200 lines per file. Split by responsibility if approaching the limit.