# Overview (/docs/starter)

Clubedge Starter is a production-ready starter that ships only the modules you choose: Next.js or TanStack Start, or a Hono or FastAPI API with a React + Vite frontend, a native app, or both, on PostgreSQL, with optional auth, storage, email, payments, background jobs, observability, and deployment, each behind an interface you can replace.

Most starters give you one stack and leave you to rip out what you don't need. Clubedge Starter is built the other way around. Every service is an optional module, and a module you leave out is removed completely. Each provider sits behind an interface in its own package, so you can swap Supabase Auth for Better Auth, or OpenTelemetry for Sentry, without touching your pages.

## Features [#features]

**Application**

- Next.js App Router or TanStack Start, with React, TypeScript, Tailwind CSS 4, and shadcn/ui using Base UI primitives.
- Or a React + Vite frontend with a separate API in `apps/api`, in TypeScript (Hono) or Python (FastAPI), joined by an OpenAPI contract. See [A frontend and its API](../cli/frontend-and-api.mdx).
- With that frontend, an optional Android and iOS app in `apps/shell`, made with Capacitor: it calls the API through the website, keeps its session on the device, and asks for an update when the API serves newer versions. A demo build has sample data and needs no server. See [The mobile app](./mobile-app.mdx).
- With either API, an optional native Android and iOS app in `apps/mobile`, built with Expo and React Native: its own screens for sign-in, a dashboard, and settings call the API with the same contract client, and it asks for an update when the API serves newer versions. See [The native app](./native-app.mdx).
- Or no website at all: the API alone, which the native app calls directly. See [Without a website](../cli/without-a-website.mdx).
- pnpm workspaces and Turborepo, with the web app in `apps/web` and framework-agnostic packages under `packages/`.
- Drizzle ORM and PostgreSQL schema, migrations, and seed commands.
- Zod environment validation, security headers, structured errors, and `/api/health`.
- A landing page and a working dashboard built from the shared UI package.

**Modules**

- Authentication with [Supabase Auth, Better Auth, Firebase Authentication, or Appwrite](./modules/auth.mdx): sign-up, sign-in, password reset, a protected dashboard, and an account settings page. With Next.js and TanStack Start, also server-verified sessions in secure cookies and rate-limited sign-in.
- [Email](./modules/email.mdx) over SMTP or through Resend; development prints emails to the server log until a provider is configured.
- [File storage](./modules/storage.mdx) on S3-compatible services (AWS S3, Cloudflare R2, MinIO) or Supabase Storage.
- A fixed-window [rate limiter and cache](./modules/cache.mdx) on Redis, or in process memory.
- [Subscriptions with Stripe](./modules/payments.mdx) Checkout and the customer portal, kept in sync by verified webhooks.
- [Background jobs](./modules/jobs.mdx) with retries and schedules, run by pg-boss (in PostgreSQL), BullMQ (in Redis), or Inngest.
- Server error reporting and request tracing with [OpenTelemetry or Sentry](./modules/observability.mdx).

**Production**

- A production image that includes its own migrator (`node /app/migrate.mjs`), for running migrations before each release. With a separate API, the API's image has it.
- A manual deploy workflow for the [chosen platform](./deploy/index.mdx), or with Docker, a Compose setup behind Caddy and a workflow that publishes the images with each release. A readiness endpoint (`/api/ready`) checks the database.
- Rate limits that count each client by the address your host reports, with [`CLIENT_IP_HEADER` or `TRUSTED_PROXY_HOPS`](./before-deploying.mdx#client-addresses).

**Quality**

- GitHub Actions CI with Vitest, Playwright, ESLint, and Prettier.
- `pnpm check:services`, which proves the app can reach every configured service with a real round trip.

## Architecture [#architecture]

The browser talks to the web app. The app reaches PostgreSQL through Drizzle, and every other service through an interface in its own package. Optional modules appear only when you choose them:

<Mermaid
  chart={`flowchart LR
  Browser --> App[Next.js or TanStack Start app]
  App -->|Drizzle ORM| DB[(PostgreSQL)]
  App -->|auth interface and server sessions| Auth[Supabase Auth, Better Auth, Firebase, or Appwrite]
  App -->|cache and rate limits| Redis[(Redis, or memory)]
  App -->|email interface| Email[SMTP or Resend, or the log]
  App -->|storage interface| Storage[S3-compatible storage or Supabase Storage]
  App -->|payments interface| Stripe[Stripe Checkout and portal]
  Stripe -->|verified webhooks| App
  App -->|jobs interface: pg-boss, BullMQ, or Inngest| Jobs[Background jobs]
  App -->|traces and errors| Obs[OTLP collector or Sentry]`}
/>

With a [frontend and its API](../cli/frontend-and-api.mdx), the browser loads the React + Vite frontend and calls the API through the contract in `packages/contract`. The API reaches PostgreSQL and checks the auth provider's token or session on each request. The API, Hono or FastAPI, takes the app's place in the diagram above: it holds every module, and the frontend forwards Stripe's webhooks and Inngest's calls to it. FastAPI runs jobs on BullMQ or Inngest, since pg-boss has no Python version. Both deploy with Docker or Railway. A [mobile app](./mobile-app.mdx) loads the frontend's pages from the device and calls the API through the deployed frontend, like the browser. A [native app](./native-app.mdx) has screens of its own and calls the API with the same contract client: through the deployed frontend, or directly in a project [without a website](../cli/without-a-website.mdx), where the API is the only server.

Six principles keep it that way:

- **PostgreSQL is the source of truth for application data.** Drizzle centralizes application schema, queries, and migrations.
- **Authentication stays separate from application data.** The auth provider owns credentials and sessions; application tables are managed by Drizzle.
- **Providers sit behind interfaces.** Each interface lives in its own package under `packages/`, and each provider in another, so replacing a provider does not touch application code.
- **Shared packages are framework-agnostic.** Packages under `packages/` receive configuration and request cookies as arguments and never import a web framework. ESLint enforces these boundaries.
- **One composition root.** `apps/web/src/server/` is the only place that reads environment variables and chooses providers. Routes and components call it rather than a provider SDK. With a frontend and its API, the API's composition root plays that part, and the frontend reads only its public `VITE_*` settings.
- **Keep the baseline focused.** Additional providers and tooling should be added when a real use case calls for them.

<Callout type="warn">
  This is a foundation and a reference implementation. Review its security and deployment choices for your application before you go to production; see [Before deploying](./before-deploying.mdx).
</Callout>

## In this section [#in-this-section]

<DocsCategory />
