Spaces:
Sleeping
Deploying BREATHE β Completely Free
This guide deploys the app using:
| Layer | Service | Cost |
|---|---|---|
| Frontend (React/Vite) | Vercel | Free forever |
| Backend (Flask API) | Render | Free tier |
| Database | Supabase | Free tier (500MB) |
Note on ML models: PyTorch and the transformer models require ~1β2 GB RAM. Render's free tier provides only 512 MB. The app will run without the ML features on the free tier β assessments and auth still work. To enable ML inference for free, see Option B: Hugging Face Spaces below.
Prerequisites
- A GitHub account (push your project there first)
- Accounts on Vercel, Render, Supabase β all free to sign up
Step 1 β Push to GitHub
cd breathe-app
git init
git add .
git commit -m "Initial commit"
# Create a repo on github.com, then:
git remote add origin https://github.com/YOUR_USERNAME/breathe-app.git
git push -u origin main
Make sure .env is in .gitignore (never commit secrets).
Step 2 β Set up the Database on Supabase (free)
- Go to supabase.com β New Project
- Give it a name (e.g.
breathe) and set a database password - Once created, go to Project Settings β Database
- Copy the Connection string (URI) β it looks like:
postgresql://postgres:[PASSWORD]@db.xxxx.supabase.co:5432/postgres - Save this β you'll need it in Steps 3 and 4.
Step 3 β Deploy the Backend on Render (free)
Go to render.com β New β Web Service
Connect your GitHub repo
Configure the service:
Setting Value Root Directory breathe-appRuntime Python 3 Build Command pip install -r requirements.txtStart Command gunicorn app:appInstance Type Free Under Environment Variables, add:
FLASK_APP=app.py FLASK_DEBUG=false SECRET_KEY=<run: python -c "import secrets; print(secrets.token_hex(32))"> DATABASE_URL=<your Supabase connection string from Step 2>Click Create Web Service β Render will build and deploy.
Your backend URL will be:
https://your-service-name.onrender.com
β οΈ Free tier services spin down after 15 minutes of inactivity and take ~30s to wake up on the next request. This is normal.
Step 4 β Deploy the Frontend on Vercel (free)
Go to vercel.com β Add New Project
Import your GitHub repo
Configure the project:
Setting Value Root Directory breathe-app/frontendFramework Preset Vite Build Command npm run buildOutput Directory distUnder Environment Variables, add:
VITE_API_URL=https://your-service-name.onrender.comClick Deploy β Vercel builds and publishes instantly.
Your app will be live at:
https://your-project.vercel.app
Option C β Deploy on Hugging Face Spaces with Docker
This repository now includes a root-level Dockerfile so you can deploy the full app as one Docker Space.
Go to huggingface.co/spaces β Create new Space
Choose Docker as the SDK
Push or upload this repository to the Space
In Space settings, add environment variables:
SECRET_KEY=<a strong random value> DATABASE_URL=<optional postgres connection string> PSYCHO_MODEL_DIR=models/psychometric ROBERTA_CKPT=models/text/roberta-model.ptBuild the Space. The app will start on port
7860and serve both the React frontend and Flask API from the same domain.
Note: If model files are missing, the app falls back to demo mode for assessments.
Step 5 β Update the API Client
In frontend/src/api/client.js, make sure the base URL reads from the env variable:
const BASE_URL = import.meta.env.VITE_API_URL || ''
Redeploy the frontend after making this change.
Option B: ML on Hugging Face Spaces (free)
If you want the full ML-powered assessments for free:
- Go to huggingface.co/spaces β Create new Space
- Choose Docker as the SDK
- Upload:
app.py,backend/,models/,requirements.txt- A
Dockerfile(see below)
- Add the same environment variables in the Space settings
Dockerfile for Hugging Face:
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 7860
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
HF Spaces provides 2 CPU cores and 16 GB RAM on the free tier β enough for the ML models.
Summary
| Step | Action | Time |
|---|---|---|
| 1 | Push code to GitHub | 5 min |
| 2 | Create Supabase database, copy connection string | 5 min |
| 3 | Deploy Flask backend on Render | 10 min |
| 4 | Deploy React frontend on Vercel | 5 min |
| 5 | Set VITE_API_URL and redeploy frontend |
2 min |
Total: ~30 minutes, $0.