The Ocipe backend is a Django 5.2.1 application using Django REST Framework, SimpleJWT for token authentication, and PostgreSQL as its database. It also integrates Google Gemini for AI-powered recipe autofill. This guide walks through local setup and production deployment on Render.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/viet2811/ocipe/llms.txt
Use this file to discover all available pages before exploring further.
Requirements
- Python 3.11 or later
- PostgreSQL (local instance or managed cloud database)
pipwithvirtualenv, or Docker
requirements.txt):
| Package | Version | Purpose |
|---|---|---|
Django | 5.2.1 | Core web framework |
djangorestframework | 3.16.0 | REST API toolkit |
djangorestframework_simplejwt | 5.5.0 | JWT authentication |
django-cors-headers | 4.7.0 | Cross-origin request handling |
django-filter | 25.1 | Query filtering for API views |
psycopg2-binary | 2.9.10 | PostgreSQL adapter |
gunicorn | 23.0.0 | Production WSGI server |
google-genai | 1.16.1 | Google Gemini AI integration |
python-dotenv | 1.1.0 | .env file loading |
Local setup
Configure environment variables
Create a
.env file in ocipe/backend/ with the required values. See Environment Variables for the full reference.Django apps
The project is split into five focused Django applications, each mounted under a dedicated API prefix:| App | URL prefix | Responsibility |
|---|---|---|
recipes | /api/recipes/ | Recipe CRUD operations, ingredient management, and Google Gemini AI autofill for recipe details |
users | /api/user/ | User registration, JWT token issuance (CookieTokenObtainPairView), token refresh (CookieTokenRefreshView), and logout |
fridge | /api/fridge/ | Per-user fridge inventory — tracking what ingredients each user currently has on hand |
grocery | /api/grocery/ | Grocery list generation and history tracking for planned shopping |
monitoring | /api/monitoring/ | Health-check and monitoring endpoints used by the hosting platform |
Security settings
The productionsettings.py enforces HTTPS and secure cross-origin cookie handling:
CookieTokenObtainPairView in the users app:
SameSite=None is required because the frontend (Vercel) and backend (Render) are on different origins. Both Secure=True and SameSite=None must be set together for cross-site cookies to work in modern browsers.
Production deployment on Render
Render is the recommended hosting platform for the Ocipe backend. Follow these steps to create a new Web Service:- Push your code to a GitHub repository and sign in to Render.
- Click New → Web Service and connect your repository. Set the Root Directory to
backend. - Set the Build Command:
- Set the Start Command:
- Add your environment variables in the Render dashboard under Environment. See Environment Variables for the complete list.
- Create a PostgreSQL database from Render’s dashboard and copy the connection details into your environment variables (
POSTGRES_DB,POSTGRES_USER,POSTGRES_PASSWORD,POSTGRES_HOST). - Update
ALLOWED_HOSTSinsettings.pyto include your Render service hostname, and updateCORS_ALLOWED_ORIGINSif your frontend is deployed to a different domain thanocipe.vercel.app.