A backend for building AI-powered applications using Encore.ts and Claude.
This app has two services:
- chat — Manages conversation sessions and message history (Postgres DB). Exposes the public API.
- ai — Internal service that calls the Anthropic Claude API to generate responses.
- Set the Anthropic API key as a secret:
encore secret set --type dev,local,pr,prod AnthropicAPIKey- Run the app:
encore runThe Postgres database is provisioned automatically on startup. Encore runs the migrations and manages the database for you — no manual setup required.
Open http://localhost:4000 for usage instructions, or http://localhost:9400 for the Local Dashboard. When deployed to Encore Cloud, use the Service Catalog to call endpoints and view traces to see how requests flow between services.
curl -X POST http://localhost:4000/chat \
-H "Content-Type: application/json" \
-d '{"message": "What is Encore?"}'Returns a session_id you can use for follow-up messages:
curl -X POST http://localhost:4000/chat \
-H "Content-Type: application/json" \
-d '{"message": "Tell me more", "session_id": "<session_id>"}'curl http://localhost:4000/chat/<session_id>curl http://localhost:4000/chat