A full-stack web application for group attendance tracking using facial recognition technology.
- Facial Recognition: Advanced AI-powered face detection using RetinaFace and ArcFace
- Authentication: Secure login with NextAuth.js and Google OAuth
- Real-time Analytics: Comprehensive dashboards with Recharts visualization
- Monitoring: Prometheus metrics integration with Grafana dashboards
- Data Export: CSV/Excel export functionality for attendance records
- Responsive Design: Modern UI with shadcn/ui components and Framer Motion animations
overview.mp4
Main demo showing facial recognition, dataset management, and real-time analytics
Watch the video above for a walkthrough of the Facemark system, including facial recognition, dataset management, and real-time analytics in action.
facemark/
βββ apps/
| βββ web/ # Next.js web application
| βββ ml-service/ # Flask microservice for face recognition
βββ infra/
βββ grafana/ # Grafana Dashboards for visualisation
βββ prometheus/ # Prometheus for logging and monitoring
Frontend & Server:
- Next.js 14 (App Router)
- TypeScript
- TailwindCSS
- shadcn/ui components
- Framer Motion animations
- Recharts for analytics
Backend ML Service:
- Python Flask
- RetinaFace (face detection)
- ArcFace (face recognition)
- OpenCV
- scikit-learn
Database & Auth:
- PostgreSQL with Prisma ORM
- NextAuth.js with Google OAuth
Monitoring:
- Prometheus metrics
- Grafana dashboards
Grafana.mp4
Grafana dashboard overview and monitoring features
- Node.js 22
- Python 3.12
- PostgreSQL
- pnpm
- Clone the repository
git clone https://github.com/hsanirudh/facemark.git
`cd facemark
- Install dependencies
pnpm install
- Environment Configuration
Copy
apps/web/env.example
toapps/web/.env
and configure:
DATABASE_URL="postgresql://username:password@localhost:5432/facemark"
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-key"
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
FLASK_SERVICE_URL="http://localhost:5000"
PROMETHEUS_URL="http://localhost:9090"
- Database Setup
cd apps/web
npx prisma migrate dev
npx prisma generate
- ML Service Setup
cd apps/ml-service
pip install -r requirements.txt
- Start all services
pnpm dev
This starts:
- Next.js app on http://localhost:3000
- Flask ML service on http://localhost:5001
Web Application:
cd apps/web
pnpm dev
ML Service:
cd apps/ml-service
python app.py
Create the face recognition dataset in the following structure:
apps/ml-service/dataset/
βββ Alex/
β βββ img1.jpg
β βββ img2.jpg
β βββ img3.jpg
βββ Nat/
β βββ img1.jpg
β βββ img2.jpg
βββ ...
Each person should have multiple high-quality face images for better recognition accuracy.
POST /api/attendance
- Process attendance with image uploadGET /api/attendance
- Fetch attendance recordsGET /api/metrics
- Prometheus metrics exportGET /api/auth/[...nextauth]
- NextAuth endpoints
POST /recognize_faces
- Face recognition from imagePOST /detect_faces
- Face detection onlyPOST /dataset/add
- Add images to datasetGET /dataset/list
- List dataset entriesGET /metrics
- ML service metricsGET /health
- Health check
The application tracks:
- Authentication events
- Attendance processing events
- API request durations
- Face detection/recognition metrics
Access metrics at:
- Web app: http://localhost:3000/api/metrics
- ML service: http://localhost:5000/metrics
Import the provided Grafana dashboard configuration to visualize:
- System performance
- Recognition accuracy
- Usage patterns
Built with shadcn/ui components:
- Responsive cards and layouts
- Animated buttons and interactions
- Modern typography and spacing
- Secure session management
- Input validation and sanitization
# Build and run with Docker Compose
docker-compose up -d
# Build all applications
pnpm build
# Start production server
pnpm start
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
For support and questions:
- Create an issue on GitHub
- Check the documentation
- Contact the development team