Auto-Grad is a full-stack application for creating, distributing, and grading assignments (including coding assignments). It includes a Node/Express backend that integrates with Google Cloud services and a React (Vite) frontend.
- Backend: Backend — Express server, routes, controllers, Google Cloud service account files.
- Frontend: my-react-app — React + Vite SPA that talks to the backend.
- Uploads: uploads — stored assignment and submission files.
Prerequisites
- Node.js (v18+ recommended)
- npm or yarn
- MongoDB Atlas or local MongoDB instance
Start the backend
- Open a terminal and go to the backend folder:
cd Backend
npm install- Create a
.envfile inBackend/(copy from any example if present) and set the following variables:
MONGODB_URI— MongoDB connection string (required)PORT— optional, default 5000GOOGLE_APPLICATION_CREDENTIALS— (recommended) path to your Google service account JSON if you use Google Cloud services. You can also keep the providedservice-account.json(ensure it is not publicly shared).
Example .env:
MONGODB_URI=mongodb+srv://<user>:<password>@cluster0.mongodb.net/mydb
PORT=5000
GOOGLE_APPLICATION_CREDENTIALS=./service-account.json
- Run the server (development):
npm run devThe backend listens on http://localhost:5000 by default.
Start the frontend
- In a new terminal:
cd my-react-app
npm install
npm run dev- Open the app in the browser at the Vite-provided URL (usually
http://localhost:5173).
If your backend runs on a different host/port, update my-react-app/src/api.js baseURL to point to the backend address.
- Backend expects
MONGODB_URIin environment. See Backend/config/db.js. - Google Cloud credentials: there are
ai-assistance-...jsonandservice-account.jsoninBackend/. To let Google client libraries pick them up setGOOGLE_APPLICATION_CREDENTIALSto the JSON file path or provide credentials via your cloud provider's secret manager. - For Vercel deployment, set the same environment variables in the Vercel project settings.
Base URL: http://localhost:5000
-
Auth
POST /api/auth/register— register userPOST /api/auth/login— loginGET /api/auth/profile— get current user (auth required)
-
Assignments
-
GET /api/assignments— list assignments -
POST /api/assignments— create assignment (auth: teacher; supports file upload) -
GET /api/assignments/:id— assignment detail -
GET /api/assignments/:id/download/:fileType— download question/answer file -
Coding assignment routes:
POST /api/assignments/coding— create coding assignment (teacher)GET /api/assignments/coding/:id— get coding assignment by id
-
-
Submissions
POST /api/submit/assignments/:assignmentId/submissions— upload or update a submission (student)GET /api/submit/assignments/:assignmentId/student/:studentId— student's submissionGET /api/submit/assignments/:assignmentId/submissions— teacher: list submissions for assignmentPUT /api/submit/submissions/:id/grade— teacher grades submissionGET /api/submit/submissions/:id— submission detailGET /api/submit/submissions/:id/download— download submission file
Refer to route files in Backend/routes for details and required fields.
- Uploaded files are served statically from
/uploads(seeserver.js). - The repo contains an
uploads/folder withassignmentsandsubmissionssubfolders.
- Run backend in dev with
npm run dev(nodemon). Production start:npm start. - The backend is configured with
vercel.jsonto be deployable on Vercel as a Node serverless function. When deploying, add environment variables through the Vercel dashboard and securely upload any service account keys. - Frontend uses
my-react-app/src/api.jsaxios instance — updatebaseURLwhen backend URL changes.
-
Backend/ — Node/Express API
controllers/— route handlersmodels/— Mongoose schemasroutes/— Express routersmiddleware/— auth, upload, error handlerconfig/— DB + cloud config
-
my-react-app/ — React frontend (Vite)
-
uploads/ — runtime file storage
- Frontend: can be deployed on Vercel or Netlify from
my-react-appbuild output (npm run build). - Backend:
vercel.jsonpresent inBackend/— configure environment variables in Vercel and deploy theBackenddirectory as a project. Alternatively deploy to any Node host (Heroku, DigitalOcean, etc.) ensuringMONGODB_URIand Google credentials are available.
- Fork and create a branch for your feature/fix.
- Run the app locally and add tests where appropriate.
- Open a pull request with a clear description.
Add a license as appropriate for your project.
If you'd like, I can also:
- Add example
.env.examplefiles for Backend and Frontend - Add scripts to
package.jsonfor convenience - Create a short CONTRIBUTING.md and LICENSE file
Thanks — tell me which additional docs you'd like me to add or modify.