Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/arrozet/caret/llms.txt

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

Caret’s local development environment runs as a set of containerised services orchestrated by Docker Compose. A single command brings up the React/Vite frontend, the Express API Gateway, three specialised Node backend services, and the FastAPI AI service — all wired together and connected to a Supabase Cloud database. You can also run any individual service outside of Docker for tighter iteration cycles, using Bun for Node/frontend work and uv for the Python AI service.

Prerequisites

Before you begin, make sure the following tools are installed on your machine.

Docker + Docker Compose

Required to run the full stack. Docker Desktop includes Compose on macOS and Windows. On Linux, install the Docker Engine and the Compose plugin separately.

Git

Required to clone the repository and manage branches during development.

Bun

Optional — only needed if you want to run the frontend or Node backend services directly outside of Docker. Install from bun.sh.

uv

Optional — only needed if you want to run the Python AI service directly outside of Docker. Install from docs.astral.sh/uv.
Caret has no local PostgreSQL — all services connect to Supabase Cloud via DATABASE_URL. You must have a Supabase project set up and your .env file populated before any service can start successfully.

Quick Start

1

Clone the repository

git clone https://github.com/arrozet/caret.git
cd caret
2

Create your .env file

Copy the minimal template below into a file named .env at the repository root and fill in your Supabase and OpenAI credentials:
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your-anon-key
DATABASE_URL=postgresql://postgres.[ref]:[password]@aws-0-[region].pooler.supabase.com:6543/postgres
OPENAI_API_KEY=sk-...
See the Environment Variables reference for the full list of available variables.
3

Build and start all services

docker compose up --build
Docker Compose will build images for each service and start them in dependency order. The first build takes a few minutes; subsequent starts are much faster.
4

Open the app

Once all health checks pass, open http://localhost:5173 in your browser. The API Gateway is available at http://localhost:3000.
The root Makefile provides convenient wrappers for common operations. Use make up as an alias for docker compose up --build, make down to stop all services, make logs to tail logs across all containers, and make ps to inspect container status.

Service Ports

Each service exposes a fixed port locally. Internal-only services are still reachable on the host for debugging, but the frontend only communicates with the API Gateway and the Collab service directly.
ServicePortNotes
Frontend5173React/Vite with hot-reload
API Gateway3000Proxies all /api/v1/... traffic
Auth Service3001Reached only by the Gateway
Document Service3002Reached only by the Gateway
Collab Service3003Direct WebSocket — frontend connects here
AI Service8000FastAPI — reached via Gateway at /api/v1/ai

Running Services Individually (Without Docker)

For tight feedback loops — such as when iterating on a single service — you can run it directly on your host while keeping everything else in Docker. Stop the relevant container first (docker compose stop <service>), then start the service manually.

Frontend

cd app/frontend
bun install
bun run dev
The Vite dev server starts on http://localhost:5173 with full hot module replacement.

Node Backend Services

Each Node service follows the same pattern:
# API Gateway
cd app/backend/api-gateway
bun install
bun run dev

# Auth Service
cd app/backend/auth-service
bun install
bun run dev

# Document Service
cd app/backend/document-service
bun install
bun run dev

# Collab Service
cd app/backend/collab-service
bun install
bun run dev

AI Service (Python/FastAPI)

cd app/backend/ai-service
uv sync
uv run uvicorn src.main:app --reload --port 8000

Package Manager Rules

Caret enforces strict package manager usage. Deviating from these rules will cause CI failures and may break Docker builds.
EcosystemRequiredNever use
Frontend (React/Vite)Bunnpm, yarn, pnpm
Node backend servicesBunnpm, yarn, pnpm
Python AI serviceuvpip, poetry, pipenv

Common Development Commands

The following commands are available in each service directory. Use them for focused work on a single service, or use the Makefile targets listed below to run them from the repo root.

Frontend and Node Services

CommandPurpose
bun run devStart the development server with hot-reload
bun run buildCompile TypeScript and build production assets
bun run test:unitRun unit tests with Vitest
bun run test:integrationRun integration tests
bun run lintLint source files with ESLint
bun run format:checkCheck formatting with Prettier
bun run openapi:generateRegenerate swagger.json from tsoa controllers (Gateway, Auth, Document services)

AI Service (Python)

CommandPurpose
uv run uvicorn src.main:app --reload --port 8000Start with auto-reload
uv run pytestRun all tests
uv run ruff check .Lint with Ruff
uv run pyrightRun static type checks

Makefile Shortcuts (From Repo Root)

make up                           # docker compose up --build
make down                         # docker compose down
make logs                         # Follow logs for all services
make ps                           # Show container status

make frontend-test-unit           # Run frontend unit tests
make frontend-test-integration    # Run frontend integration tests
make frontend-lint                # Lint frontend
make auth-service-test-unit       # Run auth service unit tests
make document-service-test-unit   # Run document service unit tests
make collab-service-test-unit     # Run collab service unit tests
make ai-service-test-unit         # Run AI service unit tests

Collaboration Debug Harness

A development-only route is available for manually testing real-time collaboration behaviour without needing two full browser sessions:
http://localhost:5173/debug/collab-harness
This page lets you connect multiple simulated clients to the collab service, observe Y.js sync messages, and inspect awareness state — all from a single browser tab. It is not available in production builds.

Build docs developers (and LLMs) love