Prerequisites
Before you begin, make sure you have:- Bun v1.2.14 or later - Download here
- Docker - Download here
- WorkOS account - Sign up here (free tier available)
- Git for cloning the repository
Hazel requires Bun v1.2.14+ for workspace catalogs, a feature that centralizes Effect-TS dependencies across the monorepo.
Setup in 4 steps
Clone and install
Clone the repository and install dependencies:This installs all dependencies across the monorepo using Bun’s workspace feature.
Run the setup wizard
The interactive setup wizard handles all configuration:The wizard will:
- Start Docker services (PostgreSQL, Redis, Electric SQL, MinIO)
- Validate your environment
- Configure WorkOS authentication
- Generate secure secrets
- Create
.envfiles for all apps - Initialize the database schema
You’ll need your WorkOS credentials during setup. Have your Client ID, API Key, and Redirect URI ready from the WorkOS dashboard.
Configure WorkOS
While the setup wizard creates your
.env files, you need to configure a few things in WorkOS:Enable AuthKit
- Go to Authentication → AuthKit in your WorkOS dashboard
- Click “Get started” or “Enable AuthKit”
- Configure your app name and branding
- Enable at least one sign-in method (Email + Password, Google, GitHub, etc.)
Set redirect URI
Add this redirect URI in Redirects → Edit redirect URIs:Create roles
Go to Roles and create these three roles:| Role Slug | Name | Description |
|---|---|---|
owner | Owner | Full access, can delete organization |
admin | Admin | Can manage members and settings |
member | Member | Standard access (default) |
Start the development server
Launch all services with Turborepo:This starts:
- Web app on http://localhost:3000
- Backend API on http://localhost:3003
- Cluster service on http://localhost:3020
Your first message
Now that everything is running, let’s send your first message:Create an account
- Open http://localhost:3000 in your browser
- Click “Sign up” or “Get started”
- Complete the WorkOS authentication flow
- You’ll be redirected to create your first organization
Create an organization
- Enter your organization name (e.g., “Acme Corp”)
- Choose a unique slug (e.g., “acme”)
- Click “Create organization”
Send a message
- Click in the message input at the bottom
- Type your message: “Hello, Hazel!”
- Press Enter or click the send button
Explore features
Try these features:
- Create a channel: Click the + next to “Channels” in the sidebar
- React to messages: Hover over a message and click the emoji button
- Pin a message: Hover over a message, click the ··· menu, and select “Pin”
- Upload a file: Click the paperclip icon in the message input
- Invite team members: Go to Settings → Members → Invite
What just happened?
When you sent that message, here’s what happened behind the scenes:- Client-side: The message was optimistically added to your local TanStack DB store
- RPC call: An Effect RPC request was sent to the backend’s
message.createhandler - Backend: The message was validated, rate-limited, and inserted into PostgreSQL
- Real-time sync: Electric SQL detected the database change and synced it to all connected clients
- Workflow: Effect Cluster triggered a
MessageNotificationWorkflowto notify channel members
Development workflow
Now that you’re set up, here’s the typical development workflow:File structure
The monorepo is organized by concern:Common tasks
Making changes
Adding a new RPC endpoint:- Define the contract in
packages/domain/src/rpc/ - Implement the handler in
apps/backend/src/rpc/handlers/ - Call it from the frontend using the generated RPC client
- Add the schema in
packages/db/src/schema/ - Generate a migration:
bun run db:generate - Push to the database:
bun run db:push - Update the Electric proxy allowlist in
apps/electric-proxy/src/tables/user-tables.ts
- Define it in
packages/domain/src/cluster/workflows/ - Implement it in
apps/cluster/src/workflows/ - Trigger it from the backend using
WorkflowClient
Next steps
Architecture
Understand the system design and patterns
API Reference
Explore all RPC and HTTP endpoints
Effect-TS Guide
Learn Effect-TS patterns used throughout the codebase
Deployment
Deploy to production
Troubleshooting
Setup wizard fails to start Docker services
Setup wizard fails to start Docker services
Make sure Docker Desktop is running and you have sufficient permissions:If Docker isn’t running, start Docker Desktop and try again.
Bun version error
Bun version error
Hazel requires Bun v1.2.14 or later for workspace catalogs:Update Bun:
curl -fsSL https://bun.sh/install | bashPort already in use
Port already in use
If you see “Port 3000 is already in use”, another application is using that port.Find and kill the process:
WorkOS authentication fails
WorkOS authentication fails
Double-check your WorkOS configuration:
- Verify the redirect URI is exactly
http://localhost:3003/auth/callback - Confirm AuthKit is enabled with at least one sign-in method
- Check that your
.envfiles have the correct WorkOS credentials - Ensure the three roles (owner, admin, member) are created
Electric sync not working
Electric sync not working
Electric SQL requires PostgreSQL with logical replication:If you get a connection error, restart the Docker services:
Get help
If you’re stuck:- Check the Architecture guide for detailed explanations
- Review the API Reference for endpoint documentation
- Read the CLAUDE.md in the repository for development guidelines
- Open an issue on GitHub