Project Overview

Overview of the project structure and key components.

TODO: update with latest repo state [doc outdated 20240904]

Directory Structure

app/
├── (auth)/                       # All authentication flows
│   ├── layout.tsx                # Provides auth-specific layout (no org shell)
│   └── page.tsx                  # Login / Sign-up entrypoint
├── (main)/                       # Public marketing/CMS-driven site
│   ├── layout.tsx                # Marketing layout (header, footer, meta)
│   └── [slug]/                   # Dynamic pages from CMS
│       ├── layout.tsx            # Optional per-page layout overrides
│       └── page.tsx              # CMS content renderer
├── (protected)/                  # After sign‑in, before org context
│   ├── layout.tsx                # Checks session & org membership; redirects to /setup or /s/[subdomain]
│   ├── setup/                    # First‑time org creation
│   │   └── page.tsx              # Renders OrganizationForm for initial setup
│   └── s/                        # Organization‑scoped routes
│       └── [subdomain]/          # Wildcard subdomain
│           ├── layout.tsx        # Org shell: loads org, membership check, provides nav/context
│           ├── page.tsx          # Redirects to /dashboard within this org
│           ├── dashboard/        # Main dashboard area
│           │   ├── layout.tsx    # Dashboard layout (tabs, subnav)
│           │   └── page.tsx      # Org-specific dashboard UI
│           ├── settings/         # Organization settings
│           │   └── page.tsx      # Manage org details, billing, etc.
│           └── ...               # Other org-scoped features (e.g. docs, support)
├── support/                      # Public or protected support center
│   └── page.tsx                  # Support articles or ticket submission
├── docs/                         # Role‑based or shared documentation
│   └── page.tsx                  # App documentation hub
├── studio/                       # Content editor playground (Sanity, etc.)
│   └── page.tsx                  # CMS editor interface
├── layout.tsx                    # Global root layout (providers, theme, global nav)
└── page.tsx                      # Optional default root page (could redirect into (main))

Architecture Overview

graph LR
  %% Hosting Environment Groups
  subgraph Vercel
    Biamazed["Biamazed App<br/>(Next.js)"]
  end
  subgraph VM
    Backend["Backend Engine<br/>(Python modules)"]
    Celery["Celery Workers"]
    Redis[(Redis broker)]
  end
  SupabaseDB[(Supabase Database)]

  %% Data flows
  Biamazed -->|“CRUD / RPC”| SupabaseDB
  Backend     -->|“Read/Write”| SupabaseDB

  %% Task processing
  Backend -->|“Enqueue tasks”| Redis
  Celery  -->|“Fetch & process”| Redis
  Celery  -->|“Store results”| SupabaseDB