-
Notifications
You must be signed in to change notification settings - Fork 1
.5 Deployment & Hosting
Class-Guard is a fullstack app:
- Frontend: React + Permit.io integration (hosted on Netlify).
- Backend: Node.js server that talks to Permit.io PDP (can be hosted on Render, Railway, Vercel Serverless Functions, or local tunnel during dev).
- Your frontend is in a React app (structured with
/src,App.jsx,index.js). - You have pushed it to GitHub.
-
Push changes to GitHub
git add . git commit -m "Deploy-ready: Frontend with Permit.io" git push origin main
-
Login to Netlify
-
Go to Netlify
-
Click “Add New Site” → “Import from Git”
-
Choose your GitHub repo (Class-Guard)
-
Set:
-
Build Command:
npm run build -
Publish Directory:
build -
Environment Variables (if needed):
REACT_APP_API_URL=https://your-backend-url.com
-
-
-
Deploy
-
Handle "Page Not Found"
-
React is SPA (Single Page App), so routes break on reload.
-
Fix:
-
Create a
_redirectsfile in/publicfolder:/* /index.html 200
-
-
Backend Deployment (Render or Railway Recommended)
-
Go to Render
-
Click New > Web Service
-
Connect GitHub > Choose backend repo or folder
-
Set:
-
Build Command:
npm install -
Start Command:
node server.js -
Environment Variables:
PERMIT_TOKEN=your_permit_api_key PDP_URL=https://cloudpdp.api.permit.io
-
Option 2: Railway
- Login to Railway
- Create a new project > Deploy Node.js
- Add
server.js - Add environment variables
- Deploy and copy your Backend URL
In your frontend’s fetch calls (like in AdminDashboard.jsx), make sure the URL points to your backend:
fetch('https://your-backend-URL.com/api/check-permission', {
...
});Or if you're using .env in React:
REACT_APP_API_URL=https://your-backend-URL.comIn code:
fetch(`${process.env.REACT_APP_API_URL}/api/check-permission`)- Navigate to
https://your-netlify-app.netlify.app/admin - If permission is granted by Permit.io, the dashboard loads.
- If not, you see
Access Denied.
When working locally:
-
Backend: Run with
node server.jsornodemon -
Frontend: Run with
npm start -
Use [CORS middleware](https://www.npmjs.com/package/cors) in
server.js:const cors = require('cors'); app.use(cors());