Project structure
Where the app, the shared packages, and the configuration live.
A generated project contains only the packages for the modules you chose.
apps/web: the web app. Routes and UI, with the composition root insrc/server/, site config insrc/config/, and app-only components insrc/components/. Background jobs live insrc/jobs/with any--jobsprovider.packages/: framework-agnostic packages, one per interface and one per provider (below).apps/apiandpackages/contract: only in projects with a frontend and its API.apps/apiis the API (Hono or FastAPI, package@clubedge/api), with its own.env.localandDockerfile;apps/webis then the React + Vite frontend, which has nosrc/server/orsrc/jobs/. The Hono API has the module routes insrc/routes/, the composition root insrc/server/, site config and plans insrc/config/, and background jobs insrc/jobs/with any--jobsprovider. The FastAPI API has its code in the packagesrc/clubedge_api/(below), site config insrc/config/, and its tests intests/.apps/mobile: only in projects with the native app (--mobile expo, Starter v0.28.0 or newer), package@clubedge/mobile-app. It is an Expo and React Native app, with its screens undersrc/app, its site config insrc/config/site.json, and its own.env.local(EXPO_PUBLIC_API_URL). Expo generates itsandroid/andios/projects when it builds, so they aren't committed.- No
apps/webin a project without a website (--framework none, Starter v0.28.0 or newer): it is the API and its contract, with neitherpackages/ui, the rootDockerfileand.env.example, nor the browser tests ine2e/. apps/shellandpackages/mobile: only in projects with a mobile app (--shell capacitor, Starter v0.27.0 or newer).apps/shellpackages the React + Vite frontend for Android and iOS with Capacitor, with its own.env.local(WEB_URL), and holds the native projects,android/andios/, once created.packages/mobilehas the app's own code, which the frontend loads only in its build for the app.e2e/: Playwright browser checks..github/: the CI workflow, the deploy workflow of every platform but Docker (from Starter v0.27.0),clubedge-upgrade.yml(a weekly pull request when a newer Starter release is out),preview.ymlwith--infra neon(Preview environments), issue forms, and a pull request template. With Docker,pnpm clubedge deployaddsrelease-images.yml.Dockerfileanddocker-compose.yml: the production image and a Compose file that builds it (with a separate API, both images). With Docker,pnpm clubedge deployaddscompose.yamland aCaddyfile, for a server of your own. See Docker.- Files for your modules, only when you choose them:
docker-compose.dev.yml(--infra docker),supabase/(--infra supabase),firebase.json(--auth firebase), andfly.toml,render.yaml, or.railway/railway.ts(--deploy). SETUP.md: setup guide for this project's modules.
Packages
| Package | Contents | Module |
|---|---|---|
packages/core | Errors, Result type, HTTP helpers, and the error reporting and tracing hooks (no dependencies) | always |
packages/db | Drizzle schema, client factory, migrations, and seed script | always |
packages/ui | Shared shadcn/ui components, utilities, and global theme styles | framework not none |
packages/cache | Cache and RateLimiter interfaces with in-memory implementations | always |
packages/contract | openapi.yaml (the API contract), the TypeScript client generated from it, and the conformance suite | api not none |
packages/mobile | The mobile app's native helpers (device storage and the app's version), its update notice, and its demo | shell not none |
packages/local-db | PGlite served over the PostgreSQL protocol, for development without Docker | infra=local |
packages/cache-redis | Redis rate limiter and cache | cache=redis |
packages/auth | AuthProvider and CookieStore interfaces | auth not none |
packages/auth-supabase | Supabase Auth adapter | auth=supabase |
packages/auth-better-auth | Better Auth adapter, with its own tables and migrations | auth=better-auth |
packages/auth-firebase | Firebase Authentication adapter, with session cookies | auth=firebase |
packages/auth-appwrite | Appwrite adapter, with session cookies | auth=appwrite |
packages/storage | StorageProvider interface | storage not none |
packages/storage-s3 | S3-compatible storage adapter | storage=s3 |
packages/storage-supabase | Supabase Storage adapter | storage=supabase |
packages/email | EmailProvider interface with console and in-memory providers | email not none |
packages/email-smtp | SMTP email provider | email=smtp |
packages/email-resend | Resend email provider | email=resend |
packages/payments | PaymentProvider interface, billing logic, and the subscription tables | payments not none |
packages/payments-stripe | Stripe payment provider | payments=stripe |
packages/jobs | JobQueue interface, job definitions, an in-memory queue, and the conformance suite | jobs not none |
packages/jobs-pg-boss | pg-boss job queue | jobs=pg-boss |
packages/jobs-bullmq | BullMQ job queue in Redis | jobs=bullmq |
packages/jobs-inngest | Inngest jobs, and the handler for /api/inngest | jobs=inngest |
packages/observability | ObservabilityProvider interface and an in-memory provider for tests | observability not none |
packages/observability-otel | OpenTelemetry provider (OTLP/HTTP traces and error logs) | observability=otel |
packages/observability-sentry | Sentry provider | observability=sentry |
The composition root
apps/web/src/server/ is the only place that reads environment variables and chooses providers. Routes and components import from it, such as email from @/server/email, rather than a provider SDK. To replace a provider, implement the package's interface in a new package and return it from the matching file in apps/web/src/server/.
In a project with a frontend and a separate API, or without a website, the API owns the composition root, in apps/api/src/server/ for Hono (such as email.ts, storage.ts, payments.ts, and jobs.ts) and apps/api/src/clubedge_api/server.py for FastAPI. The frontend calls the API only through the client in packages/contract. In production, the frontend runs server.mjs, which serves the build and forwards the API routes of the modules you chose; with Better Auth, it also answers /api/auth from auth.server.mjs.
The FastAPI API
The FastAPI API doesn't use the TypeScript packages, so its package, apps/api/src/clubedge_api/, has each module's code in Python, with the same interfaces and tables. server.py is the composition root, app.py has the contract's routes, and each module you chose adds a few files:
| Module | Files in apps/api/src/clubedge_api/ |
|---|---|
auth | auth.py (the provider's check), users.py, and the settings in account.py and routes/account.py |
storage | storage.py (get_storage), storage_provider.py (the protocol), and storage_s3.py with storage_local.py, or storage_supabase.py |
cache | cache.py (Redis, or process memory with --cache memory), rate_limit.py, and memory_cache.py |
email | email.py (email), email_provider.py (the protocol), and email_smtp.py or email_resend.py |
payments | payments.py (the protocol, billing, and tables), payments_stripe.py, plans.py, and routes/billing.py |
jobs | jobs.py (your jobs), background_jobs.py (get_jobs), job_queue.py (the protocol), jobs_bullmq.py or jobs_inngest.py, and routes/jobs.py |
observability | observability.py (starts the tool), telemetry.py (the protocol), tracing.py, telemetry_otel.py or telemetry_sentry.py, and routes/client_errors.py |
Its tests are in apps/api/tests/, such as test_storage_s3.py and test_billing.py.
Site config
The project name, description, service identifier, and documentation links live in apps/web/src/config/site.json. Edit that file to rename the app; create-clubedge-app writes it for generated projects. A separate API has its own copy, apps/api/src/config/site.json, which the CLI writes too: the API's /api/health reports its service identifier. Without a website, the API's copy is the project's.
The native app has a copy as well, apps/mobile/src/config/site.json, from which app.config.ts takes its name and address scheme. With Better Auth, the server trusts the scheme it makes from its own copy, so keep the serviceId the same in both.
How is this guide?