Prerequisites
Required software
Bun v1.2.14+
JavaScript runtime with built-in package manager, test runner, and bundler.Download Bun
Docker
Container platform for running PostgreSQL, Redis, Electric SQL, and MinIO.Download Docker
Git
Version control for cloning the repository.Download Git
WorkOS Account
Authentication provider for user management and SSO.Sign up for WorkOS
System requirements
- OS: macOS, Linux, or Windows (with WSL2)
- RAM: 4GB minimum, 8GB recommended
- Disk: 2GB free space for dependencies and Docker images
- Node.js: Not required (Bun is a replacement)
Hazel uses Bun instead of Node.js. If you have Node.js installed, it won’t interfere, but Bun is required for running the application.
Installation steps
1. Install Bun
Bun v1.2.14 or later is required for workspace catalogs:2. Install Docker
Docker is required for running local services:- macOS: Docker Desktop for Mac
- Windows: Docker Desktop for Windows
- Linux: Docker Engine
3. Clone the repository
4. Install dependencies
Install all workspace dependencies:- All app dependencies (
apps/web,apps/backend,apps/cluster) - All package dependencies (
packages/db,packages/domain, etc.) - Development tools (Turborepo, Vitest, OXC)
The first install may take 2-3 minutes depending on your internet connection. Subsequent installs are faster thanks to Bun’s caching.
Configuration
Setup wizard
The easiest way to configure Hazel is with the interactive setup wizard:- Start Docker services - PostgreSQL, Redis, Electric SQL, MinIO, Sequin, Caddy
- Validate environment - Check Bun version, Docker status, and network connectivity
- Configure WorkOS - Prompt for Client ID, API Key, and Redirect URI
- Generate secrets - Create secure random secrets for encryption
- Create .env files - Generate
.envfiles for all apps with proper values - Initialize database - Run migrations and seed initial data
Docker services
Hazel uses Docker Compose to manage local services. Here’s what gets started:| Service | Port | Description |
|---|---|---|
| PostgreSQL | 5432 | Main database with logical replication enabled |
| Electric SQL | 3333 | Real-time sync service for PostgreSQL |
| Redis (Sequin) | 7378 | Cache for Sequin CDC platform |
| Redis (Cache) | 6380 | Cache for Electric proxy |
| MinIO | 9000, 9001 | S3-compatible object storage for file uploads |
| Sequin | 7376 | Change Data Capture platform |
| Caddy | 5133, 3004 | Reverse proxy for SSE and WebSocket connections |
WorkOS configuration
WorkOS provides authentication and organization management. You’ll need to configure:1. Enable AuthKit
- Log in to WorkOS Dashboard
- Navigate to Authentication → AuthKit
- Click “Enable AuthKit”
- Configure:
- App name: Your application name (e.g., “Hazel Chat”)
- Logo: Optional branding
- Sign-in methods: Enable at least one:
- Email + Password (recommended for testing)
- Google OAuth
- GitHub OAuth
- Microsoft OAuth
2. Set redirect URI
- Go to Redirects → Edit redirect URIs
-
Add the callback URL for local development:
-
For production, add your production URL:
3. Create roles
Hazel uses custom roles for organization members:- Navigate to Roles
- Create three roles with these exact slugs:
| Role Slug | Display Name | Description |
|---|---|---|
owner | Owner | Full control, can delete organization |
admin | Admin | Can manage members and settings |
member | Member | Standard access (default for new members) |
4. Get your credentials
You’ll need these values from WorkOS:- Client ID: Found in API Keys section
- API Key: Click “Create Key” if you don’t have one
- Webhook Secret: Found in Webhooks section (create an endpoint if needed)
Environment variables
If you prefer manual configuration instead of the setup wizard, create these.env files:
apps/backend/.env
apps/backend/.env
apps/web/.env
apps/web/.env
apps/cluster/.env
apps/cluster/.env
Database initialization
Initialize the database schema:packages/db/src/schema/.
Starting the application
Development mode
Start all services in development mode:- Web (port 3000): React app with Vite HMR
- Backend (port 3003): Effect-TS API server with hot reload
- Cluster (port 3020): Workflow service with hot reload
The first build takes 30-60 seconds. Subsequent hot reloads are near-instant.
Production mode
Individual apps
Run a specific app:Verification
Verify your installation:1. Check services
2. Test authentication
- Open http://localhost:3000
- Click “Sign up” or “Get started”
- Complete the WorkOS authentication flow
- You should be redirected back to create an organization
3. Send a test message
- Create an organization
- Send a message in the #general channel
- The message should appear instantly
If the message appears with a delay or error, check the Electric SQL and backend logs for connection issues.
Troubleshooting
Docker issues
Services won’t start:Bun issues
Wrong version:WorkOS issues
Authentication fails:- Verify redirect URI is exactly
http://localhost:3003/auth/callback - Check that AuthKit is enabled
- Confirm at least one sign-in method is active
- Verify
.envhas correct Client ID and API Key
- Ensure all three roles exist:
owner,admin,member - Check that role slugs match exactly (case-sensitive)
Database issues
Migrations fail:Next steps
Quickstart
Follow the quickstart guide to send your first message
Architecture
Learn about the system design and patterns
Deployment Guide
Best practices and deployment workflows
Deployment
Deploy to production with Docker or Railway