Overview
Vitaes is built as a modern TypeScript monorepo using Turborepo for efficient builds and development. The architecture follows a clear separation between frontend, backend, and shared packages.Technology Stack
Frontend
- React 19 - UI library
- TanStack Router - Type-safe file-based routing
- TailwindCSS 4 - Utility-first styling
- shadcn/ui - Reusable component library
- TanStack Query - Server state management
- Vite - Build tool and dev server
Backend
- Hono - Fast, lightweight web framework
- oRPC - End-to-end type-safe RPC with OpenAPI
- Better Auth - Authentication library
- Node.js - Runtime environment
Database & ORM
- PostgreSQL 17 - Primary database
- Drizzle ORM - TypeScript-first ORM
- Drizzle Kit - Schema management and migrations
Build System
- Turborepo - Monorepo build orchestration
- pnpm - Fast, disk-efficient package manager
- TypeScript - Type safety across the stack
- tsdown - TypeScript bundler for packages
Monorepo Structure
Applications
Web Application (apps/web)
The frontend application built with React and TanStack Router.
Key Dependencies:
- Runs on port 3001 by default
- Hot module replacement enabled
- Connects to backend API at port 3000
Server Application (apps/server)
The backend API server built with Hono and oRPC.
Key Dependencies:
- Runs on port 3000 by default
- Uses
tsx watchfor hot reloading - Serves oRPC API endpoints
Shared Packages
API Package (packages/api)
Contains the oRPC router definitions and business logic.
Structure:
- Type-safe RPC procedures
- Authentication middleware
- OpenAPI integration
- S3/MinIO file storage utilities
Auth Package (packages/auth)
Centralized authentication configuration using Better Auth.
- Email/password authentication
- Google OAuth
- GitHub OAuth
- Session management
- CSRF protection
Database Package (packages/db)
Database schema, client configuration, and migrations.
Types Package (packages/types)
Shared TypeScript type definitions used across the application.
Build Configuration
Turborepo Configuration
Theturbo.json file defines the build pipeline:
- Dependency-based builds:
^buildensures dependencies build first - Smart caching: Turbo caches build outputs for faster rebuilds
- Parallel execution: Runs independent tasks in parallel
- Environment awareness: Tracks
.envfiles for cache invalidation
Workspace Dependencies
Packages reference each other using workspace protocol:- Always uses the local version
- Proper type inference across packages
- Fast local development with hot reloading
Development Workflow
Running the Stack
Type Safety
The monorepo enforces strict TypeScript across all packages:Adding New Packages
Next Steps
- Explore the Database Schema
- Learn about Deployment options
- Review Setup Instructions for local development