Goal Coach
Contract-first implementation of docs/api-contract.openapi.yaml with a production-oriented backend path.
Current stack
- Web: Next.js (
apps/web) - API: Fastify + TypeScript + Postgres (
apps/api) - Worker: BullMQ + Redis + Postgres (
apps/worker) - Shared types:
packages/shared - SQL schema:
db/schema.sql
What is now real
- Postgres-backed API persistence (no in-memory state).
- JWT access tokens + refresh sessions persisted in
auth_sessions. - Password hashing with
bcryptjs. - LLM-backed
/v1/chatpipeline:- Builds context from DB
- Pulls recent thread messages
- Calls model (OpenAI if configured)
- Executes structured actions (habit log/blocker/commitment)
- Updates rolling summary
- Worker call orchestration:
- Claims due
checkin_events - Dispatches calls through provider adapter (
mock,elevenlabs,twilio) - Applies retry policy from schedules
- Claims due
- Webhook ingestion:
- ElevenLabs webhook signature check (HMAC if secret configured)
- Twilio signature verification (if
TWILIO_AUTH_TOKENconfigured)
Prerequisites
- Node.js 20+
- Postgres 15+
- Redis 7+
Setup
- Copy env template:
cp .env.example .env
- Optional infra boot (Postgres + Redis):
docker compose up -d
- Set required env values in
.env:DATABASE_URLJWT_ACCESS_SECRETWORKER_API_KEYOPENAI_API_KEY(for real LLM responses)
- Install deps:
npm install
- Start services:
- API:
npm run dev:api - Web:
npm run dev:web - Worker:
npm run dev:worker
- API:
ElevenLabs + Twilio wiring
- Set
CALL_PROVIDER=elevenlabsin.env. - Set:
ELEVENLABS_API_KEYELEVENLABS_AGENT_IDELEVENLABS_OUTBOUND_URL
- Point ElevenLabs post-call webhook to:
POST /v1/webhooks/elevenlabs
- If using Twilio callbacks directly, set:
TWILIO_AUTH_TOKENTWILIO_WEBHOOK_URL- callback target
POST /v1/webhooks/twilio
- Import ElevenLabs tool definitions from:
docs/elevenlabs-tools.json
Local smoke checks
- API health:
GET /health - Login demo user:
- email:
demo@goalcoach.app - password:
demo-password
- email:
- Open workbench:
http://localhost:3000/workbench
Important note
- Public API contract file remains unchanged. If we need contract changes, ask first.
Built With
- elevenlabs-agents
- elevenlabs-webhooks-(call-events
- fastify
- javascript
- javascript-**frontend:**-next.js
- next.js
- node.js
- openai-api
- postgresql
- python
- railway
- react
- react-**backend:**-node.js-(fastify)-**database:**-postgres-(supabase)-**auth-&-user-management:**-supabase-auth-**background-jobs-/-scheduling:**-worker-service
- redis
- redis-**hosting-/-deployment:**-railway-**voice-calls-/-telephony:**-twilio-**voice-agent-+-tts:**-elevenlabs-agents-**llm-/-ai:**-openai-api-**webhooks:**-twilio-webhooks
- rest-apis
- supabase
- supabase-auth
- transformer
- twilio
- typescript
Log in or sign up for Devpost to join the conversation.