Backend API for Cadris. This repo owns project persistence, recording metadata, shot-event storage, media storage, and export-preview preparation.
- Express + TypeScript API
- Local MongoDB-backed project persistence
- Modular storage adapter for local disk or S3-compatible object storage
- Project, recording, directed-preview, and shot-event service layer
- Export-preview endpoint derived from saved timeline metadata
- Beta-oriented health, request logging, and write-rate limiting
- Copy
.env.exampleto.env. - Start local MongoDB or point
MONGODB_URIat a reachable instance. - Optionally set
MONGODB_DB_NAME. - Install dependencies with
npm install. - Choose
STORAGE_PROVIDER=localfor dev orSTORAGE_PROVIDER=s3for hosted beta. - If using
s3, setS3_BUCKET,S3_ENDPOINT,S3_ACCESS_KEY_ID, andS3_SECRET_ACCESS_KEY. - Optionally set
S3_PUBLIC_BASE_URLif your bucket is publicly served. - Optionally set
LOCAL_LLM_BASE_URLandLOCAL_LLM_MODELfor local AI review. - Set
ENABLE_LOCAL_LLM=falsefor public beta if you do not want the deployment depending on Ollama. - Start the API with
npm run dev.
Default local URL:
- Backend API:
http://localhost:4000 - MongoDB:
mongodb://127.0.0.1:27017
The backend is configured for an Ollama-compatible runtime at http://127.0.0.1:11434 and a default model of llama3.2:1b.
Typical local flow:
- Start the server with
/home/core/.local/bin/ollama serve - Pull the configured model with
/home/core/.local/bin/ollama pull llama3.2:1b - Verify backend connectivity with
GET /api/ai/health
The health route should report reachable: true and list llama3.2:1b in availableModels.
GET /api/healthnow reports environment, version, storage mode, CORS allowlist, and write-rate limits.- Every request receives an
X-Request-Idresponse header and is logged in a structured JSON line format. - Write endpoints are protected with a lightweight in-memory rate limit for beta traffic shaping.
- Hosted beta should use explicit
CORS_ORIGINvalues rather than*. - Object storage can stay private and be proxied through
GET /api/storage/*, or you can provideS3_PUBLIC_BASE_URLfor direct asset URLs. - Local Ollama is optional for beta and can be disabled entirely with
ENABLE_LOCAL_LLM=false. - The S3-compatible storage path is intended for a modern hosted runtime. For beta deploys, run the backend on Node 20+ even though local development can stay on the lighter local-storage path.
GET /api/healthGET /api/ai/healthGET /api/projectsPOST /api/projectsGET /api/projects/:projectIdPATCH /api/projects/:projectIdPOST /api/projects/:projectId/recordingsPOST /api/projects/:projectId/exportPOST /api/projects/:projectId/insightsGET /api/storage/*
- Storage is local-first for development and can switch to S3-compatible storage for hosted beta.
- MongoDB stores project documents with embedded recordings and shot events for a lightweight local prototype path.
- Recording persistence now keeps the untouched source clip and can also store a lightweight directed preview clip captured during recording.
- Export generation stays lightweight in v1 and surfaces the latest directed preview plus timeline-derived segments.
- Authentication is not enforced yet.
- Local AI review is wired for an Ollama-compatible runtime so you can generate session notes without cloud tokens.