A modern full-stack starter template for kicking off new projects with authentication, organizations, and a clean dashboard UI.
- Framework: TanStack Start - Full-stack React framework with file-based routing
- Database: Prisma 7 with PostgreSQL adapter (
@prisma/adapter-pg) - Authentication: Better Auth - Email/password + OAuth (GitHub, Google)
- UI Components: shadcn/ui (New York style) with Tailwind CSS v4
- Monorepo: Turborepo with pnpm workspaces
- 🔐 Authentication - Email/password signup, social OAuth (GitHub, Google)
- 🏢 Multi-org support - Users can create and switch between organizations
- 👥 Team management - Organization members and roles
- 🔑 API keys - Per-organization API key management
- 📱 Responsive sidebar - Collapsible navigation with org switcher
- ⚡ Server functions - Type-safe server functions instead of middleware for auth checks
apps/
gateway/ # TanStack Start app (port 4444)
src/
components/ # React components (sidebar, org-switcher)
lib/ # Auth config, session helpers
routes/ # File-based routes
_authed/ # Protected routes (requires login + org)
api/ # API routes
packages/
db/ # Prisma schema and database client
src/
prisma/ # Schema and migrations
generated/ # Generated Prisma client
We use server functions (createServerFn) for session checks instead of middleware. The /_authed layout route handles:
- Redirecting unauthenticated users to
/login - Redirecting users without organizations to
/onboarding - Auto-selecting an organization if none is active
All authenticated routes require an active organization. New users are guided through onboarding to create their first org.
Prisma 7 with the PostgreSQL adapter for better performance. The schema includes all Better Auth tables (users, sessions, accounts, organizations, members, invitations, api_keys).
# Install dependencies
pnpm install
# Set up environment variables
cp apps/gateway/.env.example apps/gateway/.env
# Create and migrate database
cd packages/db
pnpm prisma migrate dev
# Start development server
pnpm dev# Database
DATABASE_URL="postgresql://user@localhost:5432/flightplan"
# Better Auth
BETTER_AUTH_SECRET="your-secret-key"
BETTER_AUTH_URL="http://localhost:4444"
# OAuth (optional)
GITHUB_CLIENT_ID=""
GITHUB_CLIENT_SECRET=""
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""