Chains Invent Insanity
April 27, 2026 · View on GitHub

A Markov Chain-based Cards Against Humanity card generator.
Prerequisites
API Prerequisites
- Pipenv: pipenv
- Python 3.14+
- CORS /
APP_ENV: SetAPP_ENV=productionorAPP_ENV=prodon the API for the default production browser origins, orAPP_ENV=development/APP_ENV=devfor localhost defaults (seeapi/env.example). Optionally setCORS_ORIGINSto override the allowlist entirely.
Frontend Prerequisites
Setup
API Setup
Copy api/env.example to api/.env and configure variables. Use APP_ENV=prod (or production) when deploying the API so CORS allows the public site by default, or set CORS_ORIGINS to a comma-separated list of exact origins if you need a custom allowlist.
Install Pipenv Environment and all dependencies
pipenv install
Start the API server
pipenv run start
Frontend Setup
Set APP_ENV=prod (or production) when building the UI for deployment so the client uses the production API and OpenAPI URL by default (ui/.env.example). Local development can omit this or use APP_ENV=dev / development.
Install Dependencies
npm install
Start the frontend server
npm run start
Usage
API Usage
The API is accessible at http://localhost:8000/api/v1/. The OpenAPI spec is served at http://localhost:8000/openapi.yaml. With docker-compose.yml, Swagger UI runs at http://localhost:8080 and loads that spec.
To modify any API configuration, edit the gunicorn.conf.py file.
Frontend Usage
Once the Frontend service is up and running, it can be accessed at http://localhost:3000/.
Docker Compose vs production
docker-compose.yml and dev-docker-compose.yml include an optional nginx service so you can hit everything on port 80 locally. In production, traffic goes through Traefik (or your own proxy) directly to the api and ui containers; nginx from this repo is not part of that layout.
Both services expose GET /health (JSON {"status":"ok"}) for Docker’s healthcheck and for upstream checks (for example Traefik’s HTTP health check pointed at /health on each backend).