-
Notifications
You must be signed in to change notification settings - Fork 1
2. Getting Started
Collins Dada edited this page May 4, 2025
·
1 revision
Before you begin, ensure you have the following installed:
- [Node.js](https://nodejs.org/en/download) (v18+ recommended)
- [npm](https://www.npmjs.com/)
- [Git](https://git-scm.com/)
- [Permit.io Account](https://www.permit.io/)
- [Netlify Account](https://www.netlify.com/) (for frontend deployment)
- Basic understanding of React and Express
git clone https://github.com/YOUR_USERNAME/Class-Guard.git
cd Class-Guardcd backend
npm installcd ../frontend
npm installPermit.io Setup
- Log into Permit.io
- Go to Projects → Your Project
- Grab your API Key and Cloud PDP URL (usually
https://cloudpdp.api.permit.io) - In
backend/server.js, update:
const permit = new Permit({
pdp: 'https://cloudpdp.api.permit.io',
token: 'YOUR_PERMIT_API_KEY',
});Use the test username/password combo from Permit.io challenge if specified.
- Optional: Sync users and roles using the Permit.io dashboard.
cd backend
node server.js
# Runs on http://localhost:5000cd frontend
npm run dev
# Runs on http://localhost:3000 (or specified port)The frontend sends a POST request to the backend to validate user permissions using Permit.io:
const response = await fetch('http://localhost:5000/api/check-permission', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ resource: 'admin-dashboard' }), // or teacher/student
});Make sure the endpoint is live and your backend is running when testing.
Deploying to Netlify
-
Push the frontend to GitHub
-
Log into Netlify
-
Click "New site from Git"
-
Connect your GitHub repo
-
For build settings:
- Build command:
npm run build - Publish directory:
dist/orbuild/depending on your setup
- Build command:
-
Hit Deploy
Note: If you're using client-side routing, add a
_redirectsfile in/public:
/* /index.html 200