Overview
What Clubedge Starter contains, and the architecture that keeps each part replaceable.
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
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. - 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. - 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. - Or no website at all: the API alone, which the native app calls directly. See Without a website.
- pnpm workspaces and Turborepo, with the web app in
apps/weband framework-agnostic packages underpackages/. - 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: 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 over SMTP or through Resend; development prints emails to the server log until a provider is configured.
- File storage on S3-compatible services (AWS S3, Cloudflare R2, MinIO) or Supabase Storage.
- A fixed-window rate limiter and cache on Redis, or in process memory.
- Subscriptions with Stripe Checkout and the customer portal, kept in sync by verified webhooks.
- Background jobs 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.
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, 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_HEADERorTRUSTED_PROXY_HOPS.
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
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:
With a frontend and its API, 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 loads the frontend's pages from the device and calls the API through the deployed frontend, like the browser. A native app 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, 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 publicVITE_*settings. - Keep the baseline focused. Additional providers and tooling should be added when a real use case calls for them.
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.
In this section
Project structure
Commands
Environment
Local services
Database
UI
Authentication
File storage
Cache and rate limits
Payments
Background jobs
Observability
Push notifications
Over-the-air updates
Docker
The mobile app
The native app
Before deploying
Troubleshooting
How is this guide?