Monorepo template for creating a modern web application.
apps/api - Supabase Local Development
PostgreSQL database, authentication, and API servicesweb [Demo] - SvelteKit Frontend
Modern web application with page-based component organization, class-based design patterns, and comprehensive Supabase integrationpages [Demo] - Static Site Publishing
High-quality static websites with URL validation, accessibility checks, and SEO optimizationpackages/shared - Shared components, styles, types, constants, and utilitiesapp.css - Base Tailwind CSS styleseslint-config - Centralized ESLint 9 configuration with Flat Configroot, web (Svelte), pages (Vanilla JS)graph TB
subgraph "Monorepo Structure"
subgraph "apps/"
web["web<br/>SvelteKit App"]
pages["pages<br/>Static Site"]
api["api<br/>Supabase"]
end
subgraph "packages/"
shared["shared<br/>Components & Utils"]
eslint["eslint-config<br/>Linting Rules"]
end
web --> shared
web --> api
web --> eslint
pages --> eslint
shared --> eslint
end
subgraph "External Services"
supabase["Supabase Cloud<br/>Production DB"]
end
api -.-> supabase
# Install dependencies (.env file is created automatically)
bun install
# For static site development
bun --filter pages dev
# For web app development
bun --filter api start # Start Supabase API
bun --filter api generate # Generate TypeScript types (only when schema changes)
bun --filter web dev # Start web development server
Note: TypeScript types are committed to the repository, so you only need to run
generatewhen the database schema changes.
After running bun install, a .env file is automatically created from .env.example. Fill in the required values:
For local development:
PUBLIC_SUPABASE_URL - http://127.0.0.1:54321PUBLIC_SUPABASE_ANON_KEY - Copy the anon key displayed when running bun --filter api startFor production deployment:
PUBLIC_SUPABASE_URL - https://[project-id].supabase.coPUBLIC_SUPABASE_ANON_KEY - Get from Supabase Dashboard > Project Settings > API KeysOptional (for advanced operations):
DATABASE_URL - Enables bun --filter api push/pull to target production databaseSUPABASE_SERVICE_ROLE_KEY - Server-side admin access for Edge Functions, Webhooks (never use in browser!)# Project Setup
bun install # Install dependencies (.env file is created automatically)
# Development Workflow
# Start development servers
bun --filter api start # Start Supabase API (port 54321)
bun dev # Start all development servers
# Or specific apps:
bun --filter web dev # Start web app only (port 5173)
bun --filter pages dev # Start static site only (port 3000)
# Build and generate
bun --filter api generate # Generate TypeScript types from Supabase
bun --filter web build # Build web application
bun --filter pages build # Build static site
# Quality assurance
bun lint # Run linting across all apps
bun --filter web test # Test web app
bun --filter pages test # Test static site
# Code formatting
bun format # Format code across all apps
cd apps/api
bun start # Start Supabase locally
bun stop # Stop Supabase
bun status # Show Supabase service status
bun reset # Reset database and regenerate types
bun generate # Generate TypeScript types
bun test # Run Supabase tests
cd apps/web
bun dev # Start development server (port 5173)
bun build # Build for production
bun preview # Preview production build
bun test # Run tests
bun lint # Run linting
cd apps/pages
bun dev # Start development server (port 3000)
bun build # Build static site with Tailwind CSS
bun test # Validate links, images, and accessibility (Note: Delete tests/external-links.txt before bun test to update URL tracking)
bun lint # Run HTML validation with markuplint
bun run deploy # Deploy to server (rsync)
# Optimization Utilities
bun add-size-to-img # Add width/height to <img> tags for better performance
bun clean-image # Remove unused images from project
| Service | Port | Description |
|---|---|---|
| Supabase API | 54321 | REST API, GraphQL, Storage |
| Supabase DB | 54322 | PostgreSQL database |
| Supabase Studio | 54323 | Admin dashboard |
| Supabase Inbucket | 54324 | Email testing |
| Web App | 5173 | SvelteKit development server |
| Pages | 3000 | Static site with BrowserSync |
TypeScript types are automatically generated from your Supabase database schema:
apps/api/$generated/types.tsapi package (e.g., import type { Database } from 'api/types')bun generate to update typesCommon components and types are available through the @repo/shared package:
// Import UI components
import { Button } from '@repo/shared/components/ui/button';
import * as Card from '@repo/shared/components/ui/card';
// Import shared types
import type { UserProfile } from '@repo/shared/types/user';
// Import constants
import { DEFAULT_EASE } from '@repo/shared/constants/easing';
You can easily switch between development and production environments:
bun start).env with production Supabase credentialsThe project supports deploying both apps as separate Vercel projects. Each app includes its own vercel.json configuration file.
Configuration:
apps/webapps/web/vercel.jsonapps/web/vercel.jsonEnvironment Variables: Set the following environment variables in your Vercel project settings:
PUBLIC_SUPABASE_URL=https://your-project.supabase.co
PUBLIC_SUPABASE_ANON_KEY=your-anon-key
PUBLIC_GA4_MEASUREMENT_ID=G-XXXXXXXXXX # Optional
apps/pagesapps/pages/vercel.jsonapps/pages/vercel.jsonpublicbun run deploy command in apps/pagesapps/webapps/pagesvercel.json configurationpnpm commands must be replaced with bun equivalentspnpm-lock.yaml with bun.lockbuild task to turbo.json@repo/shared package for common components, types, and utilitiesapps/web/src/lib/components/ui/ to packages/shared/@repo/shared package instead of local paths@source directiveupdated_at columns to profiles and comments tablesapps/backend directory completely.env file generationapps/api consistentlyapps/mockup to apps/pages for better clarity and purpose alignmentcommands/use-mockup.js script and related referencesvercel.json to apps/web/vercel.jsonapps/pages/vercel.json for static site deployment.env.example with comprehensive Supabase environment variablesapps/backend to apps/api for better semantic clarity.node-version file)apps/api/$generated/ instead of apps/web/src/lib/$generated/concurrently with npm-run-all2 for better performancetailwind.config.js)nextjs-template repository to webapp-template