Files
verify/README.md
Mohamed Mathar Irfan ed6610d5d8 Initial project upload
2026-07-28 17:57:02 +05:30

80 lines
2.9 KiB
Markdown

# 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
```bash
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=1` the in-memory store resets each run, so run `seed` and
> `uvicorn` in the **same** process is not possible — for a persistent demo, point
> `MONGODB_URL` at 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
```bash
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`.