NISIRA Assistant is a monorepo containing both a Django backend and a React frontend. The recommended cloud deployment splits the two: the backend runs as a containerized service on DigitalOcean App Platform backed by a managed PostgreSQL database, while the frontend is deployed to Heroku using a subdirectory buildpack. Both services automatically redeploy whenever you push to theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/HugoX2003/nisira-assistant/llms.txt
Use this file to discover all available pages before exploring further.
main branch on GitHub.
Architecture Overview
- DigitalOcean App Platform builds the backend using
backend/Dockerfile, injects environment variables at runtime, and exposes the service over HTTPS at a*.ondigitalocean.appsubdomain. - Heroku builds the React app from the
frontend/subdirectory and serves the static build via theheroku/nodejsbuildpack. - CORS is configured on the backend to accept requests only from the frontend’s Heroku domain.
Backend — DigitalOcean App Platform
Create a new App Platform app
- Log in to cloud.digitalocean.com.
- Click Create App.
- Select GitHub as the source, authorize the DigitalOcean GitHub App, and choose the
HugoX2003/nisira-assistantrepository, branchmain. - Enable Autodeploy so every push to
maintriggers a new build.
Configure the source directory and Dockerfile
In the resource settings for the web service:
- Source Directory:
/backend - Dockerfile Path:
backend/Dockerfile
Set environment variables
Add the following environment variables in Settings → App-Level Environment Variables:
| Variable | Value / Notes |
|---|---|
DJANGO_SETTINGS_MODULE | core.production_settings |
SECRET_KEY | A long, random string — never reuse dev values |
DEBUG | False |
DATABASE_URL | ${db.DATABASE_URL} — auto-populated after adding the DB |
ALLOWED_HOSTS | .ondigitalocean.app (or your custom domain) |
OPENROUTER_API_KEY | Your OpenRouter API key |
GOOGLE_API_KEY | Your Google API key (for embeddings) |
PORT | 8000 |
GUNICORN_WORKERS | 2 (increase for larger plans) |
GUNICORN_TIMEOUT | 300 |
CORS_ALLOWED_ORIGINS | Your Heroku frontend URL, e.g. https://your-app.herokuapp.com |
DATABASE_URL uses the App Platform binding syntax ${db.DATABASE_URL}. DigitalOcean automatically resolves this to the managed database’s connection string once you attach a database resource in the next step.Add a managed PostgreSQL database
- In the App editor, click Add Resource → Database.
- Select PostgreSQL (choose the smallest plan to start — you can scale later).
- Name the component
dbso the${db.DATABASE_URL}binding resolves correctly. - Click Save.
Configure the health check
Under the web service’s Health Check settings:
- Path:
/api/health/ - Port:
8000
200 OK once Django and the database are ready.Frontend — Heroku
Create a Heroku app and connect GitHub
- Go to dashboard.heroku.com and create a new app (e.g.
nisira-assistant-frontend). - In the Deploy tab, choose GitHub as the deployment method.
- Search for
nisira-assistant, click Connect, then click Enable Automatic Deploys (branch:main).
Add buildpacks for the monorepo subdirectory
Because the React app lives in The
frontend/ rather than the repository root, you need two buildpacks applied in order:timanovsky/subdir-heroku-buildpack rewrites the build context to the specified subdirectory before the heroku/nodejs buildpack runs.Buildpack order matters. The subdirectory buildpack must be listed first so Heroku changes into
frontend/ before Node.js attempts npm install.Set Config Vars
Add these in Settings → Config Vars (or via the Heroku CLI):
| Variable | Value |
|---|---|
PROJECT_PATH | frontend |
REACT_APP_API_URL | https://<your-app>.ondigitalocean.app (backend base URL) |
GENERATE_SOURCEMAP | false |
NODE_ENV | production |
Alternative: Self-Hosted Droplet Deployment
If you prefer to run everything on a single server rather than using managed platforms, DigitalOcean Droplets with Docker Compose are a cost-effective option.Server setup
Create a Droplet
Provision an Ubuntu 22.04 LTS Droplet with at least 4 GB RAM / 2 vCPUs (the
$24/month Basic plan). Add your SSH public key during creation.Run the setup script
The repository includes The script opens ports
setup-server.sh, which installs Docker, Docker Compose, certbot, configures UFW, and sets the timezone:22, 80, and 443 in UFW and confirms the installed versions on exit.Updating the Deployment
Both DigitalOcean App Platform and Heroku watch themain branch and redeploy automatically on every push. No manual steps are required after the initial configuration.
For the self-hosted Droplet:
Troubleshooting
| Symptom | Likely Cause | Fix |
|---|---|---|
Backend returns 500 on first deploy | Migrations haven’t run | Check entrypoint logs; the backend Dockerfile runs migrate automatically on startup |
CORS errors in the browser | CORS_ALLOWED_ORIGINS missing or incorrect | Set CORS_ALLOWED_ORIGINS to the exact Heroku frontend URL (no trailing slash) |
| Heroku build fails with “no package.json” | PROJECT_PATH not set or buildpack order wrong | Ensure timanovsky/subdir-heroku-buildpack is first and PROJECT_PATH=frontend is set |
DATABASE_URL unresolved on DigitalOcean | Database component named differently | Rename the DB component to db or update the binding to match the component name |
| Health check fails on DigitalOcean | App still starting up | Increase the health check grace period; the backend/Dockerfile sets start_period=40s |
ALLOWED_HOSTS error | Custom domain not in ALLOWED_HOSTS | Add your domain, e.g. your-domain.com,www.your-domain.com |
| SSL not working on Droplet | Certbot not run or Nginx not reloaded | Run certbot --nginx -d your-domain.com and nginx -t && systemctl reload nginx |