Prerequisites
Before you begin, ensure you have the following installed:Required
- Node.js >= 18
- pnpm 9.0.0 (package manager)
- Bun (runtime for server applications)
- Git
Optional Services
- Redis (for streams)
- ClickHouse (for time-series data)
- PostgreSQL (for application data)
docker/ directory for running these services locally.
Clone and Install
1. Clone the Repository
2. Install Dependencies
The project uses pnpm as the package manager:3. Environment Configuration
Create.env files in the appropriate locations. The project uses these environment variables:
PORT- Server portJWT_SECRET- JWT authentication secretDATABASE_URL- PostgreSQL connection string
.env.example files in individual apps for complete configuration.
Development Workflow
Start Development Servers
Run all applications in development mode:- Client (Next.js) on port 3000
- Server (Bun + tRPC) on configured port
- Worker (background job processor)
- Publisher (event publishing service)
Start Individual Apps
You can also run specific applications:Build for Production
Build all apps and packages:Code Quality
Linting
Run ESLint across the monorepo:Type Checking
Run TypeScript type checking:Formatting
Format code with Prettier:Git Hooks
The project uses Husky for Git hooks:- Format changed files
- Run linting
- Check types
Package Scripts Reference
| Script | Description |
|---|---|
pnpm dev | Start all apps in development mode |
pnpm build | Build all apps and packages |
pnpm lint | Run linting across monorepo |
pnpm format | Format code with Prettier |
pnpm check-types | Run TypeScript type checking |
pnpm test | Run all tests |
pnpm test:watch | Run tests in watch mode |
pnpm test:coverage | Run tests with coverage report |
Development Tips
Turborepo Caching
Turborepo caches task outputs to speed up builds. To clear the cache:Bun Runtime
The server applications use Bun for faster startup and hot reload:Workspace Protocol
The project uses pnpm workspace protocol for internal packages:Troubleshooting
Port Conflicts
If you encounter port conflicts, update thePORT environment variable in your .env file.