Architecture
Architecture Overview
High-level system architecture of the Questionnaire platform.
Architecture Overview
The Questionnaire platform is a multi-tenant, theme-gated content monetization system built on Next.js 16 App Router.
System diagram
Core concepts
| Concept | Description |
|---|---|
| Tenant | A domain/client with its own branding, ads, and pixels |
| Category | A content page with sections, cards, and a theme overlay |
| Theme | Interactive overlay (questionnaire, WhatsApp, guide) that gates content |
| Article | Full editorial page with display ads and apply links |
| KV waterfall | Tiered ad pricing via Google Ad Manager key-values |
Request flow summary
- User visits a URL on a tenant domain
proxy.jsresolves tenant from hostname → setsx-tenant-idheader- Server page fetches tenant + content from MongoDB via services
- Client component renders theme overlay + ad components
- User completes theme → rewarded ad → content unlocks
- Conversion pixels fire at each milestone
Sections
- Multi-Tenant System — how domains map to tenants
- Request Lifecycle — full request path
- Data Models — MongoDB schemas
- Theme System — themeConfig.js reference