An enterprise-grade full-stack Document Verification System built with FastAPI, React, PostgreSQL, and Docker.
The application enables organizations to securely manage document verification workflows through Role-Based Access Control (RBAC), JWT Authentication, Email OTP Verification, OCR-powered document processing, Audit Logging, and a modern responsive dashboard for Employees, Verifiers, and Administrators.
Designed with scalability, maintainability, and security in mind, this project demonstrates industry-standard backend architecture and modern frontend development practices.
- Overview
- Key Features
- Role-Based Access Control
- Technology Stack
- System Architecture
- Project Structure
- Installation
- Backend Setup
- Frontend Setup
- Docker Deployment
- Database Migration
- API Documentation
- OCR Support
- Screenshots
- Security Features
- Future Improvements
- Contributing
- License
- Author
The Document Verification System simplifies and secures document verification processes by providing separate dashboards for different user roles.
Employees can upload and manage their documents, Verifiers can review and approve submitted files, while Administrators have complete control over users, verification workflows, audit logs, and system monitoring.
The application follows modern software engineering practices including:
- Clean architecture
- RESTful APIs
- Secure authentication
- Token-based authorization
- OCR document extraction
- Comprehensive audit logging
- Responsive React frontend
- Docker containerization
- Email Registration
- Secure Login
- Strong Password Policy
- Email OTP Verification
- JWT Authentication
- Refresh Token Rotation
- Token Revocation
- Account Lockout Protection
- Password History Validation
- Forgot Password Workflow
- Security Questions Verification
- Date of Birth Verification
- BCrypt Password Hashing
- Security Headers Middleware
- Rate Limiting
- CORS Protection
Three independent roles are supported throughout the application.
| Role | Responsibilities |
|---|---|
| π€ Employee | Upload and manage personal documents |
| β Verifier | Review, approve and reject submitted documents |
| π Administrator | Complete system administration and monitoring |
Administrators can promote users, manage permissions, monitor verification activities, and oversee the entire platform.
- Secure File Upload
- PDF Support
- Image Support
- File Type Validation
- MIME Validation
- File Size Validation
- Filename Sanitization
- OCR Text Extraction
- Document Preview
- Download Documents
- Delete Documents
- Verification Status Tracking
The verification lifecycle includes:
- Pending Queue
- Review Requests
- Document Approval
- Document Rejection
- Verification Remarks
- Verification History
- Audit Trail
Administrators have access to:
- User Management
- Role Management
- Account Activation
- Account Deactivation
- User Profiles
- Verification Statistics
- Document Oversight
- Audit Log Viewer
- Security Monitoring
Every important activity is securely recorded, including:
- User Login
- Logout
- Registration
- Password Changes
- Password Reset Requests
- Document Uploads
- Verification Decisions
- User Management
- Role Changes
- Administrative Operations
- Client IP Address
- Browser Information
- React 18
- Vite
- Tailwind CSS
- Responsive Design
- Dark Mode
- Glassmorphism UI
- Animated Components
- OTP Input Component
- Charts & Analytics
- Drag & Drop Uploads
- Protected Routes
- Role-Based Navigation
| Category | Technology |
|---|---|
| Backend | FastAPI |
| Frontend | React 18 |
| Styling | Tailwind CSS |
| Database | PostgreSQL |
| ORM | SQLAlchemy 2.0 |
| Validation | Pydantic v2 |
| Authentication | JWT |
| Password Hashing | BCrypt |
| OCR Engine | Tesseract OCR |
| Database Migration | Alembic |
| Charts | Recharts |
| Testing | Pytest |
| Containerization | Docker |
| Version Control | Git & GitHub |
React Frontend
β
β REST API
βΌ
FastAPI Backend
β
βββββββββββββββββ¬ββββββββββββββββ¬ββββββββββββββββ
βΌ βΌ βΌ
Authentication Business Logic OCR Processing
β β β
βββββββββββββββββΌββββββββββββββββ
βΌ
SQLAlchemy ORM
β
βΌ
PostgreSQL
document-verification-system/
β
βββ backend/
β βββ routers/
β βββ services/
β βββ middleware/
β βββ models.py
β βββ schemas.py
β βββ database.py
β βββ config.py
β βββ auth.py
β βββ dependencies.py
β βββ main.py
β βββ requirements.txt
β βββ seed.py
β βββ Dockerfile
β βββ .env.example
β
βββ frontend/
β βββ src/
β β βββ pages/
β β βββ components/
β β βββ context/
β β βββ hooks/
β β βββ routes/
β β βββ services/
β β
β βββ public/
β βββ package.json
β βββ vite.config.js
β βββ tailwind.config.js
β βββ Dockerfile
β βββ nginx.conf
β
βββ images_folder/
β βββ admin_dashboard.jpg
β βββ employee_dashboard.jpg
β βββ verifier_dashboard.jpg
β βββ verify_document.jpg
β βββ upload_document.jpg
β βββ ...
β
βββ docker-compose.yml
βββ README.md
βββ LICENSE
- β JWT Authentication
- β Refresh Token Rotation
- β Email OTP Verification
- β BCrypt Password Hashing
- β Secure Password Reset Workflow
- β Password History Validation
- β Account Lockout Protection
- β Role-Based Authorization (RBAC)
- β Audit Logging
- β Security Headers
- β Rate Limiting
- β CORS Protection
Before running the project, ensure the following software is installed:
| Software | Recommended Version |
|---|---|
| Python | 3.11+ |
| Node.js | 18+ |
| npm | Latest |
| PostgreSQL | 15+ |
| Git | Latest |
| Docker Desktop (Optional) | Latest |
| Tesseract OCR | Latest |
git clone https://github.com/HuzaifaAIDev/document-verification-system.git
cd document-verification-systemNavigate to the backend directory:
cd backendpython -m venv .venv
.venv\Scripts\activatepython3 -m venv .venv
source .venv/bin/activatepip install --upgrade pip
pip install -r requirements.txtCreate a local environment file:
cp .env.example .envFor Windows (PowerShell), if cp is unavailable:
copy .env.example .envOpen the .env file and configure the required values.
Example:
DATABASE_URL=postgresql://username:password@localhost:5432/document_verification
SECRET_KEY=your-generated-secret-key
ACCESS_TOKEN_EXPIRE_MINUTES=30
REFRESH_TOKEN_EXPIRE_DAYS=7
ALGORITHM=HS256
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
SMTP_USERNAME=your-email@gmail.com
SMTP_PASSWORD=your-app-password
EMAIL_FROM=your-email@gmail.com
FRONTEND_URL=http://localhost:5173Important: Never commit your
.envfile to GitHub. Only commit.env.example.
Generate a secure secret key:
python -c "import secrets; print(secrets.token_urlsafe(48))"Copy the generated key into:
SECRET_KEY=Run:
python seed.pyThis script creates the default administrator account for local development.
Change the default credentials before deploying the application to production.
uvicorn main:app --reloadBackend will be available at:
http://localhost:8000
FastAPI automatically generates interactive API documentation.
| Documentation | URL |
|---|---|
| Swagger UI | http://localhost:8000/docs |
| ReDoc | http://localhost:8000/redoc |
| OpenAPI Schema | http://localhost:8000/openapi.json |
Open a new terminal.
Navigate to the frontend:
cd frontendnpm installCreate the environment file:
cp .env.example .envExample:
VITE_API_URL=http://localhost:8000npm run devFrontend:
http://localhost:5173
Docker allows the complete application stack to run inside containers.
cp backend/.env.example backend/.envUpdate all required environment variables before deployment.
docker compose builddocker compose upor
docker compose up --builddocker compose up -ddocker compose down| Service | URL |
|---|---|
| React Frontend | http://localhost:5173 |
| FastAPI Backend | http://localhost:8000 |
| Swagger UI | http://localhost:8000/docs |
| PostgreSQL | localhost:5432 |
This project uses Alembic for version-controlled database migrations.
alembic revision --autogenerate -m "Initial Migration"alembic upgrade headalembic downgrade -1alembic currentNavigate to the backend directory:
cd backendRun all tests:
pytestRun with verbose output:
pytest -vGenerate a coverage report (if configured):
pytest --cov=.| Endpoint | Description |
|---|---|
/auth |
User authentication and authorization |
/users |
User profile management |
/documents |
Upload and document management |
/verifier |
Document verification workflow |
/admin |
Administrative operations |
Employee
β
βΌ
Upload Document
β
βΌ
Pending Verification
β
βΌ
Verifier Review
β
ββββ΄βββββββββββββ
β β
βΌ βΌ
Approved Rejected
β β
βΌ βΌ
Visible to User with Status
The application currently supports:
- PDF (.pdf)
- PNG (.png)
- JPG (.jpg)
- JPEG (.jpeg)
Additional formats can be integrated in future releases.
The system integrates Tesseract OCR for extracting text from uploaded documents.
Extracted text can be utilized for:
- Document verification
- Search functionality
- Metadata extraction
- Data validation
- Future AI-powered document analysis
OCR supports both scanned images and PDF documents.
The following screenshots demonstrate the primary workflows and interfaces available within the Document Verification System.
The application has been designed with security as a primary objective.
- JWT Access Tokens
- Refresh Token Rotation
- Secure Logout
- Token Revocation
- Email OTP Verification
- Password Reset Workflow
- BCrypt Password Hashing
- Password History Validation
- Strong Password Policy
- Account Lockout Protection
- Role-Based Access Control (RBAC)
- Security Headers Middleware
- CORS Protection
- Request Validation
- Rate Limiting
- Audit Logging
- User Activity Tracking
- Login History
- Verification History
- Administrative Action Logging
The project roadmap includes several enhancements aimed at improving scalability, security, and user experience.
- Multi-Factor Authentication (MFA)
- Redis Caching
- Elasticsearch Integration
- AI-Powered Document Validation
- Automatic Fraud Detection
- Virus & Malware Scanning
- Digital Signatures
- Watermarking
- WebSocket Notifications
- Email Notifications
- SMS Notifications
- Kubernetes Deployment
- CI/CD Pipeline
- Cloud Storage Integration
- Background Task Processing
- Monitoring with Prometheus & Grafana
- API Rate Analytics
- Mobile Application Support
Before deploying to production, it is recommended to:
- Enable HTTPS using a trusted SSL certificate.
- Store secrets securely using environment variables or a secrets manager.
- Use a managed PostgreSQL database.
- Configure automated database backups.
- Use a production SMTP provider.
- Enable centralized logging.
- Monitor application health.
- Configure reverse proxy (Nginx or Traefik).
- Enable firewall rules.
- Rotate secrets regularly.
- Restrict CORS origins.
- Configure secure cookies.
- Enable automatic security updates.
Contributions are welcome and appreciated.
If you would like to contribute:
- Fork the repository.
- Create a feature branch.
git checkout -b feature/your-feature- Commit your changes.
git commit -m "Add new feature"- Push your branch.
git push origin feature/your-feature- Open a Pull Request.
Please ensure that:
- Code follows the existing style.
- New functionality includes appropriate tests where applicable.
- Documentation is updated for any new features.
This project is licensed under the MIT License.
See the LICENSE file for additional details.
Bachelor of Science in Artificial Intelligence
Passionate about building secure, scalable, and production-ready AI and Full-Stack applications using modern software engineering practices.
- GitHub: https://github.com/HuzaifaAIDev
Special thanks to the open-source community and the maintainers of the technologies used in this project.
This project is powered by:
- FastAPI
- React
- PostgreSQL
- SQLAlchemy
- Pydantic
- Docker
- Tesseract OCR
- Tailwind CSS
- Alembic
- Pytest
If you find this project helpful:
β Star the repository
π΄ Fork the repository
π Report issues
π¬ Share suggestions
π’ Share the project with others
Your support helps improve the project and motivates future development.
Thank you for taking the time to explore the Document Verification System.
Feedback, suggestions, and contributions are always welcome.
















