Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
\# Deploying PyBe to Render



This guide documents the steps to deploy the PyBe app (server + client) to Render.com for free, based on hands-on testing.



\## Backend (Server) Deployment



1\. On Render, create a \*\*New Web Service\*\* and connect your GitHub repository.

2\. Set the following:

  - \*\*Root Directory:\*\* `server`

  - \*\*Build Command:\*\* `npm install`

  - \*\*Start Command:\*\* `node src/index.js`

  - \*\*Instance Type:\*\* Free

3\. Deploy. Note the live URL Render gives you (e.g. `https://your-app.onrender.com`).



\## Frontend (Client) Deployment



1\. On Render, create a \*\*New Static Site\*\* and connect the same repository.

2\. Set the following:

  - \*\*Root Directory:\*\* `client`

  - \*\*Build Command:\*\* `npm install; npm run build`

  - \*\*Publish Directory:\*\* `dist`

3\. Add an environment variable so the client knows where the backend lives:

  - \*\*Key:\*\* `VITE\_API\_URL`

  - \*\*Value:\*\* `https://your-backend-url.onrender.com/api`

4\. Deploy.



\## Fixing CORS Issues



If the deployed client shows `Failed to fetch` or CORS errors in the browser console, it usually means the backend's allowed origin doesn't match the deployed frontend URL.



Fix: On the backend service in Render, go to \*\*Environment\*\* and add:

  - \*\*Key:\*\* `CLIENT\_ORIGIN`

  - \*\*Value:\*\* your deployed frontend URL (e.g. `https://your-frontend.onrender.com`)



Save changes — Render will automatically redeploy the backend with the new setting.



\## Notes



\- Render's free tier spins down services after inactivity, so the first request after idling can take 30-50 seconds to respond.

\- Always redeploy the backend after changing environment variables for the change to take effect.