Inflate Web App Plan
1. App Overview
- Name: Inflate
- Purpose: Marketplace for selling, managing, and redeeming digital credits between merchants and customers
- Tech Stack (Phase 1):
- Frontend: Next.js, TypeScript, Tailwind CSS
- Backend & ORM: Next.js API Routes, Prisma
- Database: PostgreSQL
- Auth: SMS OTP (console-logged for dev) + email password reset
2. User Roles & Dashboards
2.1 Admin
Core Capabilities
- Load credits/points to merchant accounts
- View global transaction history
- View admin dashboard (totals: credits sold, active merchants/customers)
Phase 2 Enhancements
- Block/unblock merchants or customers
- Fraud & suspicious-activity reports
- System-wide policy settings (e.g., credit expiration rules)
2.2 Merchant
Core Capabilities
- Create/manage credit packages (e.g., 1,100 credits for the price of 1,000)
- Sell credits to customers
- View merchant dashboard
- Package list & details
- Transaction history (sales, redemptions, refunds)
- Customer activity
Phase 2 Enhancements
- Custom bundle/limited-time offers
- Sales analytics (popularity, revenue over time)
- Per-package expiration dates
2.3 Customer
Core Capabilities
- Purchase credits from merchants
- Redeem credits via QR code at merchants
- View personal dashboard
- Transaction history
- Participating merchants (name, location, packages)
- Account management (profile edit, delete)
Form fields: First/Last Name, Mobile, Email, Birthday, Gender, Current Credit Balance, QR Code
Phase 2 Enhancements
- Loyalty/rewards tiers
- Push notifications (expiration reminders, new offers)
- Peer-to-peer credit transfers (with limits)
3. Data Models (Prisma Schema Sketch)
model User {
id Int @id @default(autoincrement())
role Role
firstName String
lastName String
email String @unique
mobile String
birthday DateTime?
gender Gender?
credits Int @default(0)
qrCode String?
merchant Merchant?
transactions Transaction[]
}
model Merchant {
id Int @id @default(autoincrement())
user User @relation(fields: [userId], references: [id])
userId Int
packages CreditPackage[]
transactions Transaction[]
isBlocked Boolean @default(false)
}
model CreditPackage {
id Int @id @default(autoincrement())
merchant Merchant @relation(fields: [merchantId], references: [id])
merchantId Int
name String
credits Int
priceCents Int
expiresAt DateTime?
}
model Transaction {
id Int @id @default(autoincrement())
type TransactionType
date DateTime @default(now())
amount Int
user User @relation(fields: [userId], references: [id])
userId Int
merchant Merchant? @relation(fields: [merchantId], references: [id])
merchantId Int?
postBalance Int
creditPackage CreditPackage? @relation(fields: [packageId], references: [id])
packageId Int?
}
enum Role { ADMIN MERCHANT CUSTOMER }
enum Gender { MALE FEMALE OTHER }
enum TransactionType { PURCHASE REDEMPTION REFUND }
4. Core Flows & API Routes
Feature | API Route | Method | Auth |
Register / Login (SMS OTP) | /api/auth/otp/send | POST | public |
Verify OTP | /api/auth/otp/verify | POST | public |
Password reset (email) | /api/auth/password-reset | POST | public |
CRUD credit packages | /api/merchant/packages | GET/POST/PUT/DELETE | merchant |
Purchase credits | /api/customer/purchase | POST | customer |
Redeem credits (QR scan) | /api/customer/redeem | POST | customer |
Fetch transaction history | /api/transactions | GET | any logged-in |
Admin load credits | /api/admin/load-credits | POST | admin |
User profile (view/edit) | /api/user/profile | GET/PUT | any logged-in |
Delete user account | /api/user | DELETE | any logged-in |
5. Phase 2 Features & Roadmap
- Security & Privacy: 2FA, role-based access control, field encryption
- UX Enhancements: Onboarding/tutorial modals; Map view for merchant discovery; Ratings & reviews
- Analytics & Reporting: Admin fraud detection; Merchant sales trends
- Monetization: Per-transaction merchant fee; Merchant premium subscriptions
6. Development Plan & Milestones
Sprint | Goals |
1 | Project setup, auth (OTP & email), user models |
2 | Merchant flows: packages CRUD + dashboard basics |
3 | Customer flows: purchase, redeem, transaction history |
4 | Admin flows: load credits, global dashboards |
5 | Polish UI, add Tailwind components, basic styling |
6 | Testing: end-to-end, security, performance |
7+ | Phase 2 features (analytics, map, notifications) |