2.9 KiB
VerifyPack
Full-stack QR code generation & product verification SaaS.
- Frontend: Next.js 14 (App Router) + Tailwind CSS + shadcn-style UI
- Backend: FastAPI (Python) + MongoDB (Beanie/Motor async ODM)
- Auth: JWT (email + Google OAuth), NextAuth on the frontend
- Payments: Razorpay (18% GST) — env-driven
- Storage/Email: AWS S3 / SES — env-driven, with mock fallbacks for local dev
Database note: project originally specced PostgreSQL + Prisma; switched to MongoDB on EC2 for faster single-read consumer verification and to avoid a second datastore on the box.
Repo layout
verify pack/
├── backend/ FastAPI + MongoDB
│ ├── app/
│ │ ├── main.py
│ │ ├── core/ config, security, deps
│ │ ├── db/ mongo connection, seed
│ │ ├── models/ Beanie documents
│ │ ├── schemas/ Pydantic request/response
│ │ ├── services/ email, storage, qr (mockable)
│ │ └── routers/ auth, brands, products, batches, qr, verify, ...
│ ├── requirements.txt
│ └── .env.example
└── frontend/ Next.js 14
├── app/ App Router pages
├── components/ UI + dashboard widgets
├── lib/ api client, utils
└── .env.local.example
Quick start (local dev)
Backend
cd backend
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env # MONGODB_URL defaults to local mongo
# Fastest way to try it with zero external services (in-memory Mongo, console email):
export MOCK_DB=1 MOCK_EMAIL=1 MOCK_STORAGE=1
# Smoke test (optional): app imports + Beanie init
python -c "import asyncio; from app.main import app; from app.db.mongo import init_db; \
print('routes', len(app.routes)); asyncio.run(init_db()); print('beanie OK')"
python -m app.db.seed # creates demo org, brand, product, batch, QR
uvicorn app.main:app --reload --port 8000
API docs at http://localhost:8000/docs · health at /health
Note: with
MOCK_DB=1the in-memory store resets each run, so runseedanduvicornin the same process is not possible — for a persistent demo, pointMONGODB_URLat a real Mongo (e.g. your EC2 instance) and seed once.
Demo logins after seeding (against a real Mongo):
- Client admin:
owner@abcpharma.example/Owner@123 - Super admin:
admin@verifypack.example/Admin@123
Frontend
cd frontend
npm install
cp .env.local.example .env.local
npm run dev
App at http://localhost:3000 — dashboard at /dashboard, public verify at /v/<qr_code>.
Service config
Razorpay / Google OAuth / AWS credentials are env-only (see .env.example).
The Product Admin settings page shows configured/not-configured status only.
With mock flags on, the app runs fully offline:
MOCK_DB=1 MOCK_EMAIL=1 MOCK_STORAGE=1.