FastAPI + MongoDB backend with a React frontend for managing faculty records, appraisal criteria, score calculation, and PDF report generation.
This README is based on the current implementation in the project files.
- Maintains faculty details (name, department, designation, contact, qualifications, experience, date of joining).
- Maintains appraisal criteria with category, weight, and active/inactive status.
- Assigns multiple criteria per faculty member and calculates total score from criterion weights.
- Generates downloadable PDF reports for one faculty member or all faculty members.
- Provides JSON APIs for the React frontend.
- Keeps the original Jinja2 templates available as legacy backend pages.
- Backend: FastAPI
- Database: MongoDB (Motor async client)
- Frontend: React + Vite
- Legacy Templating: Jinja2
- PDF Generation: ReportLab
- App Server: Uvicorn
Staff-Incriment-Management/
README.md
requirements.txt
app/
main.py
config/
database.py
models/
faculty.py
appraisalCat.py
FacultyCritScore.py
routes/
faculty_route.py
appraisalCat_route.py
crit_score_route.py
schema/
faculty_schema.py
appraisalCat_schema.py
crit_score_schema.py
services/
faculty_service.py
appraisalCat_service.py
faculty_crit_score_service.py
templates/
index.html
faculty.html
criteria.html
scores.html
static/
css/style.css
js/script.js
frontend/
package.json
vite.config.js
src/
api/client.js
App.jsx
main.jsx
styles.css
pages/
FacultyPage.jsx
CriteriaPage.jsx
ScoresPage.jsx
app/main.pycreates the FastAPI app, mounts static files, and includes route modules.- Route files in
app/routes/handle legacy page rendering, form submissions, and JSON APIs. - Service files in
app/services/perform MongoDB CRUD and score logic. app/config/database.pyprovides Mongo client and collections.- React files in
frontend/src/render the primary UI and call/api/...endpoints. - Templates in
app/templates/still render the older server-side pages.
GET /api/facultyPOST /api/facultyDELETE /api/faculty/{faculty_id}GET /api/criteriaPOST /api/criteriaPATCH /api/criteria/{criteria_id}/status?is_active=true|falseDELETE /api/criteria/{criteria_id}GET /api/scoresPUT /api/scores/{faculty_id}
PDF endpoints remain the existing backend endpoints:
GET /scores/pdf/{faculty_id}GET /scores/pdf/all
GET /- Renders
app/templates/index.html.
- Renders
GET /faculty/- Shows add form and all faculty table.
POST /faculty/create- Creates a faculty record from form input.
GET /faculty/delete/{id}- Deletes a faculty record.
GET /criteria/- Shows add form and criteria list.
POST /criteria/create- Adds criterion with category, name, and weight.
GET /criteria/deactivate/{id}- Marks criterion inactive.
GET /criteria/activate/{id}- Marks criterion active.
GET /criteria/delete/{id}- Deletes criterion.
GET /scores/- Initializes missing score documents.
- Shows faculty with selected criteria and computed total score.
POST /scores/update/{faculty_id}- Updates selected criteria for a faculty member.
GET /scores/pdf/{faculty_id}- Downloads single faculty appraisal PDF.
GET /scores/pdf/all- Downloads all-faculty appraisal PDF.
Defined in app/config/database.py:
facultycriteriascoresdocuments_metadata(currently defined)
git clone <your-repo-url>
cd Staff-Incriment-Managementpython3 -m venv .venv
source .venv/bin/activateUse the top-level requirements for this app:
pip install -r requirements.txtCurrent connection is hard-coded in app/config/database.py as MONGO_URI.
Replace it with your own MongoDB URI before running in your environment.
Start the backend:
.venv/bin/uvicorn app.main:app --reloadIn another terminal, start the React frontend:
cd frontend
npm install
npm run devOpen the React app:
http://127.0.0.1:5173/
The legacy backend pages are still available at:
http://127.0.0.1:8000/
app/schema/crit_score_schema.pyis currently empty.app/routes/faculty_route.pyimports update/get helper functions that are not exposed as routes yet.app/services/appraisalCat_service.pycontainsupdate_criteria(...), but update is not currently wired to a route.app/requirements.txtcontains a large set of unrelated packages; the rootrequirements.txtis the relevant lightweight dependency list for this app.
MONGO_URIcan be set through the environment; the current hard-coded URI remains only as a fallback for compatibility with the original project.- Add validation rules and error handling for all form inputs.
- Add edit/update routes for faculty and criteria.
- Add tests for route and service layers.
- Add authentication/authorization for admin operations.