Since HostelOS is a full-stack app (React + Python), we need to host the two parts separately. This guide uses free-tier services.
Render is great for Python/FastAPI apps.
- Push your code to GitHub (You just did this!).
- Go to dashboard.render.com and create a New Web Service.
- Connect your GitHub repository.
- Settings:
- Root Directory:
backend - Runtime:
Python 3 - Build Command:
pip install -r requirements.txt - Start Command:
uvicorn main:app --host 0.0.0.0 --port 10000
- Root Directory:
- Click Deploy.
- Copy the URL Render gives you (e.g.,
https://hostel-backend.onrender.com).
Vercel is best for React/Vite apps.
- Go to vercel.com and Add New Project.
- Import your GitHub repository.
- Project Settings:
- Framework Preset: Vite
- Root Directory:
frontend(Click "Edit" next to Root Directory and selectfrontend).
- Environment Variables:
- Add a variable named
VITE_API_URL. - Value: The Render Backend URL you copied in Step 1 (e.g.,
https://hostel-backend.onrender.com). - Note: I will update your code to use this variable.
- Add a variable named
- Click Deploy.
Once both are live:
- Open your Frontend Vercel URL in a browser.
- It should load and talk to your Render backend automatically!
If you just want to show it to a friend right now without deploying:
- Run the backend locally:
uvicorn backend.main:app --reload - Run the frontend locally:
npm run dev - Install ngrok and run:
ngrok http 5173 - Share the link ngrok gives you.
When you first deploy, the database is empty (No Rooms). To fix this, go to your Render Dashboard -> Shell (tab on the left) and run:
python seed_rooms.pyThis will populate the rooms, and your 3D view will light up! ✨