New:New releases:CLIcreate-clubedge-app v0.49.1·Clubedge Starter v0.32.0

Clubedge Starter Docs

Project structure

Where the app, the shared packages, and the configuration live.

A generated project contains only the packages for the modules you chose.

.env.local
… one package per module you chose
.env.example
Dockerfile
docker-compose.yml
SETUP.md
package.json
  • apps/web: the web app. Routes and UI, with the composition root in src/server/, site config in src/config/, and app-only components in src/components/. Background jobs live in src/jobs/ with any --jobs provider.
  • packages/: framework-agnostic packages, one per interface and one per provider (below).
  • apps/api and packages/contract: only in projects with a frontend and its API. apps/api is the API (Hono or FastAPI, package @clubedge/api), with its own .env.local and Dockerfile; apps/web is then the React + Vite frontend, which has no src/server/ or src/jobs/. The Hono API has the module routes in src/routes/, the composition root in src/server/, site config and plans in src/config/, and background jobs in src/jobs/ with any --jobs provider. The FastAPI API has its code in the package src/clubedge_api/ (below), site config in src/config/, and its tests in tests/.
  • 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 under src/app, its site config in src/config/site.json, and its own .env.local (EXPO_PUBLIC_API_URL). Expo generates its android/ and ios/ projects when it builds, so they aren't committed.
  • No apps/web in a project without a website (--framework none, Starter v0.28.0 or newer): it is the API and its contract, with neither packages/ui, the root Dockerfile and .env.example, nor the browser tests in e2e/.
  • apps/shell and packages/mobile: only in projects with a mobile app (--shell capacitor, Starter v0.27.0 or newer). apps/shell packages the React + Vite frontend for Android and iOS with Capacitor, with its own .env.local (WEB_URL), and holds the native projects, android/ and ios/, once created. packages/mobile has 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.yml with --infra neon (Preview environments), issue forms, and a pull request template. With Docker, pnpm clubedge deploy adds release-images.yml.
  • Dockerfile and docker-compose.yml: the production image and a Compose file that builds it (with a separate API, both images). With Docker, pnpm clubedge deploy adds compose.yaml and a Caddyfile, 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), and fly.toml, render.yaml, or .railway/railway.ts (--deploy).
  • SETUP.md: setup guide for this project's modules.

Packages

PackageContentsModule
packages/coreErrors, Result type, HTTP helpers, and the error reporting and tracing hooks (no dependencies)always
packages/dbDrizzle schema, client factory, migrations, and seed scriptalways
packages/uiShared shadcn/ui components, utilities, and global theme stylesframework not none
packages/cacheCache and RateLimiter interfaces with in-memory implementationsalways
packages/contractopenapi.yaml (the API contract), the TypeScript client generated from it, and the conformance suiteapi not none
packages/mobileThe mobile app's native helpers (device storage and the app's version), its update notice, and its demoshell not none
packages/local-dbPGlite served over the PostgreSQL protocol, for development without Dockerinfra=local
packages/cache-redisRedis rate limiter and cachecache=redis
packages/authAuthProvider and CookieStore interfacesauth not none
packages/auth-supabaseSupabase Auth adapterauth=supabase
packages/auth-better-authBetter Auth adapter, with its own tables and migrationsauth=better-auth
packages/auth-firebaseFirebase Authentication adapter, with session cookiesauth=firebase
packages/auth-appwriteAppwrite adapter, with session cookiesauth=appwrite
packages/storageStorageProvider interfacestorage not none
packages/storage-s3S3-compatible storage adapterstorage=s3
packages/storage-supabaseSupabase Storage adapterstorage=supabase
packages/emailEmailProvider interface with console and in-memory providersemail not none
packages/email-smtpSMTP email provideremail=smtp
packages/email-resendResend email provideremail=resend
packages/paymentsPaymentProvider interface, billing logic, and the subscription tablespayments not none
packages/payments-stripeStripe payment providerpayments=stripe
packages/jobsJobQueue interface, job definitions, an in-memory queue, and the conformance suitejobs not none
packages/jobs-pg-bosspg-boss job queuejobs=pg-boss
packages/jobs-bullmqBullMQ job queue in Redisjobs=bullmq
packages/jobs-inngestInngest jobs, and the handler for /api/inngestjobs=inngest
packages/observabilityObservabilityProvider interface and an in-memory provider for testsobservability not none
packages/observability-otelOpenTelemetry provider (OTLP/HTTP traces and error logs)observability=otel
packages/observability-sentrySentry providerobservability=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:

ModuleFiles in apps/api/src/clubedge_api/
authauth.py (the provider's check), users.py, and the settings in account.py and routes/account.py
storagestorage.py (get_storage), storage_provider.py (the protocol), and storage_s3.py with storage_local.py, or storage_supabase.py
cachecache.py (Redis, or process memory with --cache memory), rate_limit.py, and memory_cache.py
emailemail.py (email), email_provider.py (the protocol), and email_smtp.py or email_resend.py
paymentspayments.py (the protocol, billing, and tables), payments_stripe.py, plans.py, and routes/billing.py
jobsjobs.py (your jobs), background_jobs.py (get_jobs), job_queue.py (the protocol), jobs_bullmq.py or jobs_inngest.py, and routes/jobs.py
observabilityobservability.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?