A full-stack Todo app with:
- Frontend: React + Vite + Tailwind CSS (hosted on Vercel)
- Backend: Django + Django REST Framework (deploy-ready for Railway)
- Database: PostgreSQL on Railway
cd backend
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python manage.py migrate
python manage.py runservernpm install
npm run dev- Push this repo to GitHub.
- In Railway, create a new project.
- Add two services:
PostgreSQLGitHub Reposervice for this project
- Set backend service root directory to
backend. - Railway will use
Procfile(web: ./start.sh) to start the app. - Add environment variables from
backend/.env.example. - Ensure these values are set:
DJANGO_DEBUG=falseDJANGO_SECRET_KEY=<strong-secret>DJANGO_ALLOWED_HOSTS=.railway.app,<your-backend-domain>DJANGO_CORS_ALLOWED_ORIGINS=https://react-todo.utsavbhattarai.info.npDJANGO_CSRF_TRUSTED_ORIGINS=https://react-todo.utsavbhattarai.info.np
- Railway PostgreSQL provides
DATABASE_URL; keep it attached to the Django service.
start.sh automatically runs:
python manage.py migrate --noinputpython manage.py collectstatic --noinputgunicorn config.wsgi:application --bind 0.0.0.0:$PORT
In your Vercel project, set:
VITE_API_BASE_URL=https://<your-backend-domain>/apiThen redeploy the frontend.
GET /api/todos/POST /api/todos/GET /api/todos/<id>/PATCH /api/todos/<id>/DELETE /api/todos/<id>/
cd backend && .venv/bin/python manage.py test
backend/.venv/bin/python backend/manage.py check
npm run build