Full-stack face-recognition attendance project with a public scanner flow, protected admin workspace, student registration, analytics, CSV export, encrypted biometric embeddings, anti-spoof checks, and Docker-based deployment.
- Students use a public attendance scanner without creating accounts.
- Admins log in to register students, review attendance, export CSVs, inspect audit logs, and manage biometric data.
- Face matching runs on the backend with InsightFace.
- Attendance duplicate protection prevents repeated marking within the cooldown window.
- Raw face images are disabled by default; encrypted embeddings are stored in SQLite.
- Backend anti-spoof checks are enabled.
- Liveness is configurable and currently optional by default for faster attendance scans.
The project is deployable.
Recommended deployment options:
- Local demo / college presentation:
docker compose up --build - Public hosting: frontend on Vercel, backend on Render
- Full-stack container hosting: backend on Render, frontend on Render or any static host
Not recommended:
- Running the Python backend on Vercel serverless functions. The backend depends on OpenCV, InsightFace, and ONNX Runtime, which are a much better fit for a container host like Render.
Use this if you want the simplest deployable setup with persistent SQLite storage and the lowest ongoing cost that still keeps your data.
- Frontend on Vercel free tier
- Backend on Render starter plan
- SQLite on a Render persistent disk
- Vercel can host the frontend for free
- Render backend needs a paid plan if you want persistent disk support for SQLite
- you do not need Postgres or
DATABASE_URLfor this project right now
- Push this repo to GitHub.
- Deploy backend on Render using [render.yaml](D:\Project Build\Face\render.yaml).
- Let Render create the persistent disk mounted at
/app/data. - Confirm backend health at
/api/v1/health. - Deploy frontend on Vercel from the
frontendfolder. - Set
VITE_API_BASE_URL=https://your-backend.onrender.com/api/v1in Vercel. - Open frontend, log in, register one student, and test attendance.
Frontend:
- React
- Vite
- Tailwind CSS
- Axios
- React Router
Backend:
- FastAPI
- SQLite
- OpenCV
- InsightFace
- ONNX Runtime
Security / product features:
- signed admin access tokens
- login rate limiting
- encrypted embeddings at rest
- embedding re-encryption flow
- audit logs
- biometric purge workflow
frontend/ React + Vite frontend
backend/ FastAPI backend
docs/ project, API, deployment, and guidance docs
docker-compose.yml
render.yaml
- Open the public scanner page.
- Start the camera.
- If liveness is enabled, complete one quick live action.
- Backend validates the frame, runs anti-spoof checks, extracts the embedding, and matches it.
- Attendance is marked if the user is recognized and not inside the cooldown window.
- Go to
/admin/login. - Log in with admin credentials.
- Open the admin panel.
- Register students, inspect attendance, export CSVs, or purge biometric data.
Requirements:
- Docker Desktop running
Commands:
cd "D:\Project Build\Face"
docker compose up --buildURLs:
- Frontend:
http://localhost:8080 - Backend API:
http://localhost:8000 - API health:
http://localhost:8000/api/v1/health
Backend:
cd "D:\Project Build\Face\backend"
pip install -r requirements.txt
uvicorn app.main:app --reload --host 127.0.0.1 --port 8000Frontend:
cd "D:\Project Build\Face\frontend"
npm install
npm run devDefault URLs:
- Frontend:
http://localhost:5173 - Backend:
http://localhost:8000
Important backend variables:
APP_ENVAPP_HOSTAPP_PORTADMIN_USERNAMEADMIN_PASSWORDAUTH_SECRETAUTH_RATE_LIMIT_WINDOW_SECONDSAUTH_RATE_LIMIT_MAX_ATTEMPTSAUTH_TOKEN_EXPIRY_HOURSEMBEDDING_ENCRYPTION_KEYPREVIOUS_EMBEDDING_ENCRYPTION_KEYSENABLE_LIVENESS_CHECKSLIVENESS_SECRETLIVENESS_TOKEN_EXPIRY_SECONDSANTI_SPOOF_MODEL_PATHANTI_SPOOF_THRESHOLDDATABASE_PATHUPLOAD_DIRSTORE_FACE_IMAGESPURGE_LEGACY_FACE_IMAGESATTENDANCE_COOLDOWN_MINUTESFACE_MATCH_THRESHOLDDUPLICATE_MATCH_THRESHOLDCORS_ORIGINS
Recommended production values:
- set strong secrets for
AUTH_SECRET,EMBEDDING_ENCRYPTION_KEY, andLIVENESS_SECRET - change default admin credentials
- keep
STORE_FACE_IMAGES=falseunless you explicitly need raw image retention - start with
ENABLE_LIVENESS_CHECKS=falseif you want the fastest attendance demo
VITE_API_BASE_URL
Examples:
- local Vite dev:
http://localhost:8000/api/v1 - Docker / same-origin proxy setup:
/api/v1 - deployed frontend talking to Render backend:
https://your-backend.onrender.com/api/v1
The repo already includes:
- [backend/Dockerfile](D:\Project Build\Face\backend\Dockerfile)
- [frontend/Dockerfile](D:\Project Build\Face\frontend\Dockerfile)
Compose now builds tagged images:
face-attendance-backend:latestface-attendance-frontend:latest
Build manually:
cd "D:\Project Build\Face\backend"
docker build -t face-attendance-backend:latest .
cd "D:\Project Build\Face\frontend"
docker build -t face-attendance-frontend:latest --build-arg VITE_API_BASE_URL=/api/v1 .Build via Compose:
cd "D:\Project Build\Face"
docker compose buildYes.
Best production split:
- frontend on Vercel
- backend on Render
Also workable:
- both frontend and backend on Render
Use:
- [render.yaml](D:\Project Build\Face\render.yaml)
- [backend/Dockerfile](D:\Project Build\Face\backend\Dockerfile)
Set backend secrets in Render:
ADMIN_PASSWORDAUTH_SECRETEMBEDDING_ENCRYPTION_KEYLIVENESS_SECRET
Recommended additional backend env vars:
ENABLE_LIVENESS_CHECKS=falseSTORE_FACE_IMAGES=falseDATABASE_PATH=/app/data/face_attendance.dbUPLOAD_DIR=/app/data/images
Important note:
- Render free instances can sleep.
- SQLite on ephemeral disks is not ideal for serious production.
- For demos, Render is fine. For long-term usage, move persistence to a managed database and durable storage.
Use:
- [frontend/vercel.json](D:\Project Build\Face\frontend\vercel.json)
Set:
VITE_API_BASE_URL=https://your-backend.onrender.com/api/v1
Build settings:
- framework preset:
Vite - root directory:
frontend
If you deploy both services on Render:
- deploy backend first
- copy backend public URL
- set frontend
VITE_API_BASE_URLtohttps://your-backend.onrender.com/api/v1
The backend uses:
- OpenCV
- InsightFace
- ONNX Runtime
These are heavy native dependencies and are not a good match for Vercel serverless execution. Use Render or another container-based Python host instead.
After local run or deployment:
- Open
/api/v1/health - Confirm
face_engine.availableistrue - Confirm frontend loads and can reach backend
- Log in as admin
- Register one student
- Take attendance successfully
- Confirm duplicate attendance returns duplicate state instead of new mark
- Export attendance CSV
- Confirm admin audit logs load
Usually means:
- same student name already exists
- same face is already registered
Usually means:
- no face detected
- frame is too blurry or poorly lit
- backend face quality checks rejected the frame
- liveness is still enabled and the proof was rejected
Check:
/api/v1/health- camera framing
- backend restart after config changes
Likely causes:
- backend process is still running with old config
- face match threshold is too strict for your environment
- the registered image and live camera image are too different
- [docs/README.md](D:\Project Build\Face\docs\README.md)
- [docs/project-docs.md](D:\Project Build\Face\docs\project-docs.md)
- [docs/api-docs.md](D:\Project Build\Face\docs\api-docs.md)
- [docs/deployment-docs.md](D:\Project Build\Face\docs\deployment-docs.md)
- [docs/guidance-docs.md](D:\Project Build\Face\docs\guidance-docs.md)
Built a deployable face-recognition attendance system using React, Vite, FastAPI, SQLite, OpenCV, InsightFace, and ONNX Runtime, with protected admin workflows, encrypted biometric embeddings, anti-spoof detection, configurable liveness checks, audit logs, biometric purge, analytics dashboards, CSV export, Docker images, and Render/Vercel deployment support.
