Skip to content

Repository files navigation

Flightplan

A modern full-stack starter template for kicking off new projects with authentication, organizations, and a clean dashboard UI.

Tech Stack

  • 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

Features

  • 🔐 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

Project Structure

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

Key Decisions

Authentication Pattern

We use server functions (createServerFn) for session checks instead of middleware. The /_authed layout route handles:

  1. Redirecting unauthenticated users to /login
  2. Redirecting users without organizations to /onboarding
  3. Auto-selecting an organization if none is active

Organization Gating

All authenticated routes require an active organization. New users are guided through onboarding to create their first org.

Database

Prisma 7 with the PostgreSQL adapter for better performance. The schema includes all Better Auth tables (users, sessions, accounts, organizations, members, invitations, api_keys).

Getting Started

# 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

Environment Variables

# 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=""

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages