Chorus Technical Documentation

Official technical specification and developer reference for Chorus — an anonymous discussion platform built on Clean Architecture and native Git persistence.

Getting Started #

Chorus is an open-source discussion system written in Go and React. Persistence is implemented directly on top of the Git object model in local disk storage without a relational database layer.

System Requirements

  • Go: 1.22+ installed on PATH
  • Node.js: 18.x or 20.x+ (npm 10.x+)
  • Git: Installed on system PATH (git --version)

Local Development Setup

Execute the Go HTTP backend server and Vite React client in development mode:

Terminal
# 1. Clone repository
git clone https://github.com/barissalihbabacan/Chorus.git
cd Chorus

# 2. Launch Go Backend (Port 8085)
go run ./cmd/server

# 3. Launch React Client (Port 3000)
cd web
npm install
npm run dev -- --host

Docker Execution

Docker Dockerfile
docker build -t chorus:latest .
docker run -d -p 8085:8085 -v chorus-data:/app/data chorus:latest

System Architecture #

The backend applies Clean Architecture boundaries to isolate HTTP transport handlers, domain services, and Git repository drivers.

Complete 8-Layer Component Flow
Browser Client React SPA (Vite Client) HTTP Router (http.NewServeMux) Handlers (internal/http/handler) Services (thread, identity, reporting) GitStore (internal/gitstore) Git CLI Execution (os/exec) Native Git Repository (./data/repository)

Layer Responsibilities Specification

  • Browser Client: Renders user interface, captures user input, and manages client-side routing.
  • React SPA: Communicates via same-origin REST API requests to /api/v0.1/*.
  • HTTP Router: Hostname subdomain dispatcher and endpoint routing in internal/http/router.go.
  • Handlers: Parses JSON request payloads, validates input constraints, and returns HTTP status codes.
  • Services: Implements domain rules (thread initialization, conversation name assignment, moderation queue).
  • GitStore: Serializes domain models into filesystem paths and manages repository locking.
  • Git CLI: Invokes native Git commands via Go's os/exec package.
  • Git Repository: Stores immutable commit DAG objects in ./data/repository.

Expanded 9-Stage Request Lifecycle

Detailed 9-Stage Write Lifecycle
1. Browser Request 2. HTTP Router (mux) 3. Input Validation 4. Conversation Name Resolver 5. Domain Service 6. Git Persistence Driver 7. JSON Serialization 8. Git Commit 9. HTTP Response (201 Created)

REST API Reference #

GET /healthz Stable

Purpose: Health check probe verifying server liveness.

Path Parameters: None

Query Parameters: None

Possible Status Codes: 200 OK

Example Curl Request

Terminal
curl -X GET https://chat.joinchorus.app/healthz

Example JSON Response (200 OK)

JSON
{
  "status": "ok",
  "environment": "development"
}
POST /api/v0.1/identities Stable

Purpose: Registers a session identity and resolves initial conversation name.

Path Parameters: None

Query Parameters: None

Possible Status Codes: 201 Created, 400 Bad Request

Request Body

JSON
{
  "conversation_name": "Ash",
  "show_country": true
}

Example Curl Request

Terminal
curl -X POST https://chat.joinchorus.app/api/v0.1/identities \
  -H "Content-Type: application/json" \
  -d '{"conversation_name":"Ash","show_country":true}'

Example JSON Response (201 Created)

JSON
{
  "id": "usr_7f8a91b2c3d4e5f6",
  "conversation_name": "Ash",
  "country": "TR",
  "created_at": "2026-07-23T14:45:00Z"
}
GET /api/v0.1/threads Stable

Purpose: Returns a list of discussion threads.

Path Parameters: None

Query Parameters:

  • limit (int, optional): Maximum threads to return (default: 50).
  • offset (int, optional): Pagination offset.

Possible Status Codes: 200 OK

Example Curl Request

Terminal
curl -X GET 'https://chat.joinchorus.app/api/v0.1/threads?limit=50&offset=0'

Example JSON Response (200 OK)

JSON
[
  {
    "id": "thd_9de587d7f3f435e2",
    "title": "Welcome to Chorus",
    "conversation_name": "Ash",
    "country": "TR",
    "created_at": "2026-07-23T10:15:34Z",
    "updated_at": "2026-07-23T10:15:34Z"
  }
]
POST /api/v0.1/threads Stable

Purpose: Creates a new thread and assigns a thread-scoped conversation name.

Path Parameters: None

Query Parameters: None

Possible Status Codes: 201 Created, 400 Bad Request

Request Body

JSON
{
  "title": "Architecture Specification",
  "body": "Discussing Clean Architecture and Git persistence.",
  "show_country": true
}

Example Curl Request

Terminal
curl -X POST https://chat.joinchorus.app/api/v0.1/threads \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Architecture Specification",
    "body": "Discussing Clean Architecture and Git persistence.",
    "show_country": true
  }'

Example JSON Response (201 Created)

JSON
{
  "id": "thd_9de587d7f3f435e2",
  "title": "Architecture Specification",
  "conversation_name": "River",
  "country": "TR",
  "created_at": "2026-07-23T14:46:00Z",
  "updated_at": "2026-07-23T14:46:00Z"
}
POST /api/v0.1/threads/{id}/messages Stable

Purpose: Appends a message reply to a thread under an assigned conversation name.

Path Parameters:

  • id (string, required): Thread ID (e.g. thd_9de587d7f3f435e2).

Possible Status Codes: 201 Created, 400 Bad Request, 404 Not Found

Request Body

JSON
{
  "body": "Implementation details match Clean Architecture conventions.",
  "show_country": true
}

Example Curl Request

Terminal
curl -X POST https://chat.joinchorus.app/api/v0.1/threads/thd_9de587d7f3f435e2/messages \
  -H "Content-Type: application/json" \
  -d '{
    "body": "Implementation details match Clean Architecture conventions.",
    "show_country": true
  }'

Example JSON Response (201 Created)

JSON
{
  "id": "msg_2222222222222222",
  "thread_id": "thd_9de587d7f3f435e2",
  "conversation_name": "Echo",
  "country": "DE",
  "content": "Implementation details match Clean Architecture conventions.",
  "created_at": "2026-07-23T14:47:00Z"
}
POST /api/v0.1/threads/{id}/messages/{msg_id}/translate Experimental

Purpose: Requests on-demand translation for a message (target language defaults to English).

Path Parameters:

  • id (string, required): Thread ID.
  • msg_id (string, required): Message ID.

Possible Status Codes: 200 OK, 500 Internal Error

Request Body

JSON
{
  "target_lang": "en"
}

Example Curl Request

Terminal
curl -X POST https://chat.joinchorus.app/api/v0.1/threads/thd_9de587d7f3f435e2/messages/msg_2222222222222222/translate \
  -H "Content-Type: application/json" \
  -d '{"target_lang":"en"}'

Example JSON Response (200 OK)

JSON
{
  "message_id": "msg_2222222222222222",
  "original": "Implementation details match Clean Architecture conventions.",
  "translated": "Implementation details match Clean Architecture conventions.",
  "target_language": "en",
  "cached": true
}
POST /api/v0.1/moderation/reports/{id}/action Experimental

Purpose: Submits a moderation action for a report (valid status values: pending, reviewed, dismissed, removed).

Path Parameters:

  • id (string, required): Report ID.

Possible Status Codes: 200 OK, 400 Bad Request

Request Body

JSON
{
  "status": "dismissed",
  "note": "Report reviewed."
}

Example Curl Request

Terminal
curl -X POST https://chat.joinchorus.app/api/v0.1/moderation/reports/rpt_3333333333333333/action \
  -H "Content-Type: application/json" \
  -d '{"status":"dismissed","note":"Report reviewed."}'

Example JSON Response (200 OK)

JSON
{
  "id": "act_4444444444444444",
  "report_id": "rpt_3333333333333333",
  "thread_id": "thd_9de587d7f3f435e2",
  "message_id": "msg_2222222222222222",
  "status": "dismissed",
  "note": "Report reviewed.",
  "created_at": "2026-07-23T14:49:00Z"
}

Git Persistence Engine RFC Specification #

[!] NOTE: Architectural Decision Record (ADR-001)

Chorus persists threads and messages directly on top of the Git object model in local disk storage without a relational database layer.

Current Implementation

The driver in internal/gitstore executes Git commit operations on local disk storage (default path: ./data/repository):

  • Repository Layout: Directory trees contain thread metadata (threads/{thread_id}/metadata.json) and message streams (threads/{thread_id}/messages.jsonl).
  • Commit Serialization: Thread creation and message replies execute Git commit operations via Go's os/exec package.
[!] WARNING: Known Implementation Limitations

Concurrent write operations on a single node rely on OS file locking during commit creation. Periodic git gc maintenance is required to pack loose objects over time.

Planned Microbenchmarks

Microbenchmarks covering commit latency, memory allocation, and concurrency will be published prior to the Beta release using Go's test framework (go test -bench ./...).

Engineering Product Timeline #

Development phase milestones and release roadmap:

v0.1 Alpha (Completed)
Git Persistence Engine Core
Clean Architecture backend in Go, thread-scoped conversation name assignment, and local Git persistence driver.
v0.2 (Active Stage)
Realtime Updates & Translation
Server-Sent Events (SSE) for realtime message streaming and backend disk-cached translation service.
v0.3 (Planned)
Moderation UI & Action Queue
Moderation dashboard for queue management and message review actions.
v0.4 (Planned)
Event Sourcing & Asynchronous Commit Queue
In-memory write buffer queue for batching high-frequency commit creation.
v0.5 (Research)
Distributed P2P Git Sync
Experimental peer-to-peer repository synchronization protocol over libp2p.
v1.0 (Target)
Stable Production Release
Production stable API baseline, multi-region replication, and frozen contract specification.

Deployment Configuration #

Chorus can be deployed as a single binary, Docker container, or systemd Linux service.

Environment Variables

  • PORT: HTTP listening port (default: 8085).
  • DATA_DIR: Directory path for Git storage (default: ./data/repository).
  • ENV: Mode (development or production).
  • TRANSLATION_API_KEY: Optional API key for translation provider.

Contributing Guide #

Guidelines for contributing code and documentation updates.

Workflow

  1. Clean Architecture: Maintain strict boundaries between Handler, Service, and Repository.
  2. Tests: Ensure go test -v ./... and npm run build pass clean.
  3. Commits: Follow conventional commit prefixes (e.g. feat(gitstore): ...).