Overview
BudgetBee is organized as a monorepo using Turborepo for build orchestration and pnpm workspaces for dependency management. This structure enables code sharing across multiple applications while maintaining clear boundaries between packages.Workspace Configuration
The monorepo is defined inpnpm-workspace.yaml:
Directory Structure
Applications (apps/)
Main Application (web)
The primary BudgetBee application built with Next.js.
Local URL: http://localhost:3001
Key Features:
- User authentication and authorization
- Budget management and tracking
- Transaction recording
- Organization management
- Subscription billing
Landing Page (site)
Marketing website built with Next.js.
Local URL: http://localhost:3000
Features:
- Product information
- Pricing plans
- Authentication endpoints (
/api/auth/*) - JWKS endpoint for JWT verification
Documentation (docs)
This documentation site built with Mintlify.
Local URL: http://localhost:3002
Currency API (currency-api)
Microservice for currency conversion rates.
Packages (packages/)
Core (@budgetbee/core)
@budgetbee/core
Authentication, database access, and core business logic
- Better Auth for authentication
- Polar Better Auth plugin for billing
- PostgREST client for database access
- PostgreSQL for data storage
- Redis for caching
UI (@budgetbee/ui)
@budgetbee/ui
Shared React components built with shadcn/ui
- 30+ shadcn/ui components
- Radix UI primitives
- Tailwind CSS styling
- Custom theme support
- Chart components (Recharts)
Billing (@budgetbee/billing)
@budgetbee/billing
Polar integration for subscription management
- Polar SDK integration
- Subscription tier helpers
- Webhook handling
- Usage tracking
Email (@budgetbee/email)
Email templates and Resend integration for transactional emails.
Datetime (@budgetbee/fz-datetime)
Date and time utilities for timezone handling and formatting.
TypeScript Config (@budgetbee/tsconfig)
Shared TypeScript configuration presets:
base.json- Base configurationnextjs.json- Next.js specific configreact-library.json- React library config
Turborepo Configuration
BudgetBee uses Turborepo for efficient builds and caching:- Parallel task execution
- Intelligent caching
- Dependency graph awareness
- Task orchestration
Package Manager
BudgetBee uses pnpm for fast, disk-efficient dependency management:- Faster installs than npm/yarn
- Efficient disk usage with content-addressable storage
- Strict dependency resolution
- Better monorepo support
Running Commands
Run in all workspaces
Run in specific workspace
Run with Turborepo
Infrastructure
Docker Compose
Theinfra/ directory contains Docker configuration for:
- PostgreSQL - Primary database
- PostgREST - REST API for PostgreSQL
Database Migrations
Migrations are stored inpackages/core/migrations/ and run in order:
better-auth-migrations.sql- Auth tablesinit.sql- Initial schemamigration_YYYY_MM_DD_*.sql- Dated migrations
Adding New Packages
To add a new shared package:Best Practices
Keep packages focused - Each package should have a single, well-defined responsibility.
Use workspace protocol - Always use
workspace:* for internal dependencies.Shared configs - Use
@budgetbee/tsconfig for TypeScript configuration.Next Steps
Core Package
Deep dive into authentication and database access
UI Package
Explore the component library

