Sign inSign up

prayags007/deterministic-insights-backend

By prayags007

Updated 2 months ago

Deterministic Insights API - FastAPI for customers, interactions, AI insights & dashboard.

Image
Integration & delivery
API management
Machine learning & AI
0

95

prayags007/deterministic-insights-backend repository overview

Deterministic Insights — Backend API

Customer Success Insights · FastAPI image for Deterministic Insights.

Provides JWT auth, customer/interaction APIs, AI insight generation (Redis lock), and dashboard aggregates. Requires PostgreSQL and Redis.

Use this image for: the FastAPI API process (:8000). Pair it with Postgres, Redis, and the frontend UI image (or Vercel).
Frontend image: https://hub.docker.com/r/prayags007/deterministic-insights-frontend
Endpoints: Swagger /api/v1/docs · Health /health


Quick start (docker run)

Postgres and Redis must be reachable (Compose, cloud, or local). Replace the placeholders below with your own values.

docker pull prayags007/deterministic-insights-backend:latest

docker run -d --name csip-backend -p 8000:8000 \
  -e APP_ENV=production \
  -e DATABASE_URL=postgresql+asyncpg://USER:PASSWORD@HOST:5432/DB_NAME \
  -e REDIS_URL=redis://HOST:6379/0 \
  -e JWT_SECRET_KEY=YOUR_LONG_RANDOM_SECRET \
  -e CORS_ORIGINS=https://your-frontend.example \
  -e AI_MOCK_MODE=true \
  -e [email protected] \
  -e ADMIN_PASSWORD=YOUR_ADMIN_PASSWORD \
  -e ADMIN_NAME="System Admin" \
  prayags007/deterministic-insights-backend:latest

Then migrate and seed (one-off):

docker exec -it csip-backend python -m alembic upgrade head
docker exec -it csip-backend python -m app.db.seed

Open: http://localhost:8000/api/v1/docs


Important environment variables

VariableRequiredNotes
DATABASE_URLYespostgresql+asyncpg://…
REDIS_URLYese.g. redis://host:6379/0
JWT_SECRET_KEYYesStrong random secret in production
CORS_ORIGINSYesComma-separated frontend origins
ADMIN_EMAIL / ADMIN_PASSWORD / ADMIN_NAMEFor seedBootstrap admin (seed does not update password if user exists)
AI_MOCK_MODENotrue = mock insights (default for demos); false needs GROQ_API_KEY
GROQ_API_KEYIf live AIRequired when AI_MOCK_MODE=false

Minimal configuration example

APP_ENV=production
DATABASE_URL=postgresql+asyncpg://USER:PASSWORD@db-host:5432/deterministic_insights
REDIS_URL=redis://redis-host:6379/0
JWT_SECRET_KEY=replace-with-long-random-secret
CORS_ORIGINS=https://deterministic-insights-frontend.vercel.app,http://localhost:3000
AI_MOCK_MODE=true
[email protected]
ADMIN_PASSWORD=replace-me
ADMIN_NAME=System Admin

Prefer Docker Compose for local stacks (Postgres + Redis + this image). Example env templates live in the GitHub repo (.env.example).


Full documentation

Setup, architecture, RBAC, Redis locks, testing, and troubleshooting:

https://github.com/Prayag-Sheth/deterministic_insights_backend/blob/main/README.md

Companion UI (GitHub): https://github.com/Prayag-Sheth/deterministic_insights_frontend
Frontend image: https://hub.docker.com/r/prayags007/deterministic-insights-frontend
Live API docs: https://deterministicinsightsbackend-production.up.railway.app/api/v1/docs

Tag summary

Content type

Image

Digest

sha256:8248f4d3e

Size

102.2 MB

Last updated

2 months ago

docker pull prayags007/deterministic-insights-backend