Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mocha-docs.embrly.ca/llms.txt

Use this file to discover all available pages before exploring further.

Prerequisites

1. Clone the repository

git clone https://github.com/EmberlyOSS/Mocha.git
cd Mocha

2. Install dependencies

Mocha is a Bun monorepo. Install all workspace dependencies from the root:
bun install

3. Configure environment variables

API (apps/api/.env)

DB_USERNAME="postgres"
DB_PASSWORD="yourpassword"
DB_HOST="localhost:5432"
DATABASE_URL="postgresql://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}/mocha_dev"
SECRET="a-long-random-secret-string"

Client (apps/client/.env)

NEXT_PUBLIC_CLIENT_VERSION="0.1.0"
NEXT_PUBLIC_API_URL="http://localhost:5003"
If you access the dev server from a VM or a different host (e.g. WSL2 or a remote machine), add ALLOWED_DEV_ORIGINS="your-ip" to apps/client/.env to allow the HMR websocket through.

4. Set up the database

Push the Prisma schema to your database and generate the client:
cd apps/api
bun run db:push
Optionally seed with starter data:
bun run db:seed

5. Start the development servers

From the repo root, run all apps in parallel:
bun run dev
AppURL
Client (Next.js)http://localhost:3000
API (Fastify)http://localhost:5003
To run a single app in isolation:
# API only
cd apps/api && bun run dev

# Client only
cd apps/client && bun run dev

6. Docs (optional)

Preview the documentation site locally:
bun run dev:docs

Useful commands

CommandDescription
bun run buildBuild all apps for production
bun run lintLint all packages
bun run formatFormat all files with Prettier
cd apps/api && bun run db:migrateRun a Prisma migration
cd apps/api && bun run generateRegenerate the Prisma client