How akshay0712-dev/biometric- works
Project type and purpose
• FaceLog is a full-stack, biometric-based attendance management system.
• Purpose: allow admins to upload attendance files, process biometric data, match it to users, and update attendance records in real time via a responsive web dashboard.
File structure
• Top-level directories:
• Frontend/ – React + TailwindCSS single-page application
• Backend/ – Node.js + Express REST API
• Backend substructure follows an MVC-style pattern:
• src/controllers – business logic for admin, user, biometric endpoints
• src/models – Mongoose schemas for User, Biometric, Performance
• src/routes – route definitions for user and admin APIs
• src/middlewares – JWT auth, file upload (multer)
• src/utils – custom error/response wrappers, async handler, Cloudinary config
• public/ – static assets placeholder
• Frontend substructure:
• src/components – UI components (login, register, admin dashboard, profile, reset password, etc.)
• src/utils – className helper
• index.html + 404.html for client-side routing
• Config/build files: package.json, tailwind.config.js, postcss.config.js, render.yaml (deployment), .env variables.
README for additional insights
• Data flow: Excel upload → backend Excel parsing → biometric matching → MongoDB update
• Authentication: JWT access & refresh tokens, bcrypt for password hashing
• External service: Cloudinary for uploading/storing profile images or attendance files
Main components and interactions
a. Components
1) Browser / Admin Client (React)
2) Frontend Server (served by Vite/dev server or static host)
3) Backend API Server (Express.js)
4) MongoDB Atlas (cloud database)
5) Cloudinary (external file storage)
6) Authentication subsystem (JWT issuance & verification)
b. Relationships & Data Flow
• Admin Client ↔ Frontend API layer (HTTP/WebSocket if used)
• Frontend → Backend (REST calls for login, register, upload, fetch records)
• Backend ↔ MongoDB (CRUD via Mongoose models)
• Backend ↔ Cloudinary (upload/download attendance images/files)
• Backend uses middlewares (auth, multer) before controllers
• Controllers call utility modules (ApiError, ApiResponse)
c. Architectural patterns & principles
• RESTful API design with versioned endpoints (e.g., /api/v1/users)
• MVC-style separation (routes → controllers → models)
• Middleware chain for cross-cutting concerns (auth, file parsing)
• Utility abstraction for consistent error/response handling
d. Key technologies/frameworks
• Frontend: React, TailwindCSS, Vite (npm scripts)
• Backend: Node.js, Express.js, Mongoose, Multer, Cloudinary SDK
• Auth: JWT (access/refresh tokens), bcrypt
• Database: MongoDB Atlas
– Auth Middleware → Controllers → Models
– File Upload Middleware → Biometric Controller
– Utilities (ApiError, ApiResponse)
• Client → API: login/register, upload attendance, fetch records
• API → MongoDB: user queries, attendance updates
• API → Cloudinary: file upload
• API → Client: JSON responses including JWT tokens