Open-source AI-powered passport photo studio
Upload β Auto-process β Generate a print-ready sheet β in seconds.
SnapPass AI is a free, open-source web application that lets anyone generate professional passport-quality photos from any selfie or portrait.
No expensive studio. No complicated software. Just upload, click, and print.
| Step | Description |
|---|---|
| π€ Upload | Drag & drop or browse any portrait photo |
| π§ AI Process | Background removal, face centering, DPI optimisation |
| π Customise | Choose country standard (India, USA, UK, Schengenβ¦) |
| π¨οΈ Print | Download a print-ready A4 sheet with multiple photos |
β οΈ This project is in active early development. The frontend scaffold is complete and functional. The backend and Python AI service stubs are ready for contributors to build on.
| Layer | Status |
|---|---|
| Frontend (React) | β Scaffold complete β fully navigable |
| Backend (Express) | π‘ Scaffold ready β needs controller logic |
| Python AI Service | π‘ Structure ready β needs OpenCV / rembg logic |
| Database (MongoDB) | π² Structure planned β not yet implemented |
| Layer | Technology |
|---|---|
| Frontend | React.js, React Router DOM, Vanilla CSS |
| Backend | Node.js, Express.js, Multer |
| AI Microservice | Python, Flask, OpenCV, Pillow, rembg |
| Database (planned) | MongoDB |
snappass-ai/
β
βββ frontend/ # React frontend application
β βββ src/
β β βββ components/
β β β βββ layout/ # Shared layout components
β β β β βββ Navbar.jsx
β β β β βββ Footer.jsx
β β β βββ UploadBox.jsx # Drag-and-drop uploader
β β β βββ PhotoPreview.jsx # Image preview component
β β β βββ LoadingSpinner.jsx # Reusable loading UI
β β β βββ ...
β β β
β β βββ pages/ # Application pages
β β β βββ HomePage.jsx
β β β βββ UploadPage.jsx
β β β βββ EditorPage.jsx
β β β βββ PrintPreviewPage.jsx
β β β βββ AdminDashboard.jsx
β β β
β β βββ hooks/ # Custom React hooks
β β β βββ usePhotoUpload.js
β β β βββ useImageProcessor.js
β β β
β β βββ services/ # API communication layer
β β β βββ api.js
β β β βββ photoService.js
β β β
β β βββ utils/ # Utility/helper functions
β β β βββ fileValidation.js
β β β βββ formatters.js
β β β
β β βββ routes/ # App routing configuration
β β βββ AppRoutes.jsx
β β
β βββ Dockerfile
β βββ package.json
β βββ README.md
β
βββ backend/ # Express.js backend API
β βββ src/
β β βββ config/ # Environment & DB configs
β β β βββ config.js
β β β βββ db.js
β β β
β β βββ controllers/ # Route controllers
β β β βββ auth.controller.js
β β β βββ upload.controller.js
β β β βββ image.controller.js
β β β βββ print.controller.js
β β β
β β βββ routes/ # Express route definitions
β β β βββ auth.routes.js
β β β βββ upload.routes.js
β β β βββ image.routes.js
β β β βββ print.routes.js
β β β
β β βββ middleware/ # Express middlewares
β β β βββ auth.middleware.js
β β β βββ upload.middleware.js
β β β βββ validate.middleware.js
β β β βββ error.middleware.js
β β β
β β βββ models/ # MongoDB/Mongoose models
β β β βββ user.model.js
β β β βββ upload.model.js
β β β βββ processedImage.model.js
β β β βββ printSheet.model.js
β β β
β β βββ dao/ # Database access layer
β β βββ service/ # Business logic/services
β β βββ validation/ # Request validation rules
β β βββ utils/ # Shared backend utilities
β β βββ errors/
β β
β βββ docs/ # Backend documentation
β βββ server.js
β βββ Dockerfile
β βββ package.json
βββ python-ai-service/ # Python Flask AI microservice
| βββ app/
| β βββ services/
| β βββ bg_remove.py # rembg background removal
| β βββ face_center.py # OpenCV face detection
| β βββ dpi_optimizer.py # DPI resize logic
| β βββ sheet_generator.py # A4 sheet layout
| βββ requirements.txt
β
βββ docker-compose.yml
βββ CONTRIBUTING.md
βββ SECURITY.md
βββ README.md
Make sure you have these installed:
git clone https://github.com/souma9830/SnapPass-AI.git
cd SnapPass-AIcd frontend
npm install
npm startOpen http://localhost:3000 in your browser.
cd backend
npm install
npm run devBackend runs at http://localhost:5000.
Upload metadata is now stored in MongoDB. The POST /api/upload route is enabled.
Health check: GET http://localhost:5000/health
cd python-ai-service
pip install -r requirements.txt
python main.pyAI service runs at http://localhost:8000.
Run all services (frontend, backend, python-ai-service, MongoDB) with one command:
docker compose up --buildDefault ports:
- Frontend: http://localhost:5173
- Backend: http://localhost:5000
- Python AI: http://localhost:8000
- MongoDB: mongodb://localhost:27017
Note: the python-ai-service container expects a main.py entrypoint in python-ai-service/.
Home
βββ /upload (Upload your photo)
βββ /editor (Choose background + size β AI process)
βββ /print-preview (Set quantity β Download A4 sheet)
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/upload |
Upload photo |
GET |
/api/upload/:id |
Get upload metadata |
POST |
/api/process |
AI process photo |
GET |
/api/process/preview/:filename |
Get processed preview |
POST |
/api/print/generate-sheet |
Generate A4 print sheet |
GET |
/api/print/presets |
List size presets |
GET |
/health |
Backend health check |
| Preset ID | Standard | Dimensions |
|---|---|---|
35x45 |
India / UK Passport | 35 Γ 45 mm |
51x51 |
USA Visa | 51 Γ 51 mm |
33x48 |
Schengen Visa | 33 Γ 48 mm |
40x60 |
China Visa | 40 Γ 60 mm |
2x2in |
US Passport | 2 Γ 2 inches |
VITE_API_URL=http://localhost:5000/apiPORT=5000
NODE_ENV=development
AI_SERVICE_URL=http://localhost:8000
UPLOAD_DIR=uploads
MAX_FILE_SIZE=10485760
CORS_ORIGIN=http://localhost:3000
MONGO_URI=mongodb://localhost:27017/snappass- React frontend scaffold with all pages & components
- Express backend scaffold with all routes & controllers
- Python AI service structure
- Background removal using
rembg - Face detection & auto-centering using OpenCV
- DPI optimisation & resize to standard dimensions
- A4 print sheet generation using Pillow
- MongoDB database integration
- User session & upload history
- Real-time image preview after AI processing
- Admin dashboard with live statistics
- Multi-file batch upload support
- Docker Compose setup
- CI/CD pipeline
- Deploy guide (Vercel + Render + Railway)
- PWA support
- Dark mode
We β€οΈ contributions! Whether you're fixing bugs, building features, improving docs, or designing UI elements β every contribution matters.
π Read the full guide: CONTRIBUTING.md
Quick summary:
- Fork the repo
- Create a branch:
git checkout -b feature/your-feature-name - Make your changes
- Open a Pull Request to
master
New to open source? Look for issues tagged:
good first issueβ small, well-defined taskshelp wantedβ features awaiting a contributordocumentationβ improve docs and comments
This project is licensed under the MIT License β see LICENSE for details.
You are free to use, modify, and distribute this project for both personal and commercial use.
Soumadeep β @souma9830
β If you find this useful, please star the repository β it helps others discover the project!
β Star on GitHub Β· π Report a Bug Β· π‘ Request a Feature



