questionnaire docs
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 middleware

Key entry points

RouteFilePurpose
/app/page.jsHomepage article grid
/[slug]app/[slug]/page.jsCategory page
/article/[slug]app/article/[slug]/page.jsFull article with ads
/home/[slug]app/home/[slug]/page.jsEditorial content, no ads

Component organization rules

  • components/ui/ — no business logic
  • components/hooks/ — shared hooks (use useAdThemeTiming, 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.

On this page