Skip to content

souma9830/SnapPass-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“· SnapPass AI

Open-source AI-powered passport photo studio
Upload β†’ Auto-process β†’ Generate a print-ready sheet β€” in seconds.

License: MIT PRs Welcome Open Source Made with React Node.js Python


πŸ“Œ What is SnapPass AI?

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.

✨ What it does

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

🧭 Project Status

⚠️ 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

πŸ–₯️ Tech Stack

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

πŸ“ Folder Structure

snappass-ai/
β”‚
β”œβ”€β”€ frontend/                   # React.js web app
β”‚   └── src/
β”‚       β”œβ”€β”€ components/
β”‚       β”‚   β”œβ”€β”€ layout/
β”‚       β”‚   β”‚   β”œβ”€β”€ Navbar.js          # Top navigation bar
β”‚       β”‚   β”‚   └── Footer.js          # Site footer
β”‚       β”‚   β”œβ”€β”€ UploadBox.js           # Drag-and-drop upload
β”‚       β”‚   β”œβ”€β”€ PhotoPreview.js        # Before/after photo viewer
β”‚       β”‚   β”œβ”€β”€ BackgroundSelector.js  # BG colour picker
β”‚       β”‚   β”œβ”€β”€ SizeSelector.js        # Country preset dropdown
β”‚       β”‚   β”œβ”€β”€ QuantityInput.js       # Number of photos stepper
β”‚       β”‚   β”œβ”€β”€ PrintButton.js         # Download/print CTA
β”‚       β”‚   └── LoadingSpinner.js      # Reusable spinner
β”‚       β”œβ”€β”€ pages/
β”‚       β”‚   β”œβ”€β”€ HomePage.js            # Landing page
β”‚       β”‚   β”œβ”€β”€ UploadPage.js          # Step 1 β€” upload
β”‚       β”‚   β”œβ”€β”€ EditorPage.js          # Step 2 β€” AI editor
β”‚       β”‚   β”œβ”€β”€ PrintPreviewPage.js    # Step 3 β€” preview & print
β”‚       β”‚   └── AdminDashboard.js      # Admin panel
β”‚       β”œβ”€β”€ hooks/
β”‚       β”‚   β”œβ”€β”€ usePhotoUpload.js      # Upload state management
β”‚       β”‚   └── useImageProcessor.js   # AI processing state
β”‚       β”œβ”€β”€ services/
β”‚       β”‚   β”œβ”€β”€ api.js                 # Axios base instance
β”‚       β”‚   └── photoService.js        # All photo API calls
β”‚       β”œβ”€β”€ utils/
β”‚       β”‚   β”œβ”€β”€ fileValidation.js      # Client-side validation
β”‚       β”‚   └── formatters.js          # String/number formatting
β”‚       └── routes/
β”‚           └── AppRoutes.js           # Central route config
β”‚
β”œβ”€β”€ backend/                    # Express.js REST API
β”‚   └── src/
β”‚       β”œβ”€β”€ config/app.config.js
β”‚       β”œβ”€β”€ controllers/
β”‚       β”‚   β”œβ”€β”€ upload.controller.js
β”‚       β”‚   β”œβ”€β”€ image.controller.js
β”‚       β”‚   └── print.controller.js
β”‚       β”œβ”€β”€ routes/
β”‚       β”‚   β”œβ”€β”€ upload.routes.js
β”‚       β”‚   β”œβ”€β”€ image.routes.js
β”‚       β”‚   └── print.routes.js
β”‚       └── middlewares/
β”‚           β”œβ”€β”€ upload.middleware.js
β”‚           β”œβ”€β”€ error.middleware.js
β”‚           └── validate.middleware.js
β”‚
└── 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

πŸš€ Getting Started

Prerequisites

Make sure you have these installed:


1. Clone the Repository

git clone https://github.com/souma9830/SnapPass-AI.git
cd SnapPass-AI

2. Run the Frontend

cd frontend
npm install
npm start

Open http://localhost:3000 in your browser.


3. Run the Backend (optional β€” not fully implemented yet)

cd backend
npm install
npm run dev

Backend runs at http://localhost:5000.

Health check: GET http://localhost:5000/health


4. Run the Python AI Service (optional β€” not fully implemented yet)

cd python-ai-service
pip install -r requirements.txt
python main.py

AI service runs at http://localhost:8000.


πŸ—ΊοΈ App Flow (UI)

Home
  └── /upload         (Upload your photo)
        └── /editor   (Choose background + size β†’ AI process)
              └── /print-preview  (Set quantity β†’ Download A4 sheet)

πŸ“‘ API Endpoints

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

🌍 Supported Passport Photo Sizes

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

πŸ”§ Environment Variables

Frontend (frontend/.env)

REACT_APP_API_URL=http://localhost:5000/api

Backend (backend/.env)

PORT=5000
NODE_ENV=development
AI_SERVICE_URL=http://localhost:8000
UPLOAD_DIR=uploads
MAX_FILE_SIZE=10485760
CORS_ORIGIN=http://localhost:3000

πŸ›£οΈ Roadmap

Phase 1 β€” Foundation βœ…

  • React frontend scaffold with all pages & components
  • Express backend scaffold with all routes & controllers
  • Python AI service structure

Phase 2 β€” Core Features 🚧 (contributors needed!)

  • Background removal using rembg
  • Face detection & auto-centering using OpenCV
  • DPI optimisation & resize to standard dimensions
  • A4 print sheet generation using Pillow

Phase 3 β€” Enhancements πŸ”²

  • MongoDB database integration
  • User session & upload history
  • Real-time image preview after AI processing
  • Admin dashboard with live statistics
  • Multi-file batch upload support

Phase 4 β€” Production πŸ”²

  • Docker Compose setup
  • CI/CD pipeline
  • Deploy guide (Vercel + Render + Railway)
  • PWA support
  • Dark mode

🀝 Contributing

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:

  1. Fork the repo
  2. Create a branch: git checkout -b feature/your-feature-name
  3. Make your changes
  4. Open a Pull Request to master

🏷️ Good First Issues

New to open source? Look for issues tagged:

  • good first issue β€” small, well-defined tasks
  • help wanted β€” features awaiting a contributor
  • documentation β€” improve docs and comments

πŸ“œ License

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.


πŸ‘¨β€πŸ’» Project Admin

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

Releases

No releases published

Packages

 
 
 

Contributors