Merchandise Portal is a full-stack ordering and fulfillment platform for institute-branded merchandise built with Next.js, Prisma, and PostgreSQL. It covers customer shopping flows, payment capture, and admin operations in one project.
- Next.js 15 App Router (React 19, TypeScript)
- Prisma ORM with PostgreSQL
- NextAuth credentials provider with JWT sessions
- Tailwind CSS and shadcn/ui components
- Razorpay payments integration with webhook handling
- Vercel Blob storage for product media
- Vitest and ESLint for automated checks
- Account management: Self-service registration, email verification, password reset flows, and admin invitations with role-based access (user, dept_head, admin).
- Product discovery and cart: Landing page, catalogue, detailed product pages with rating summaries, and a persistent cart backed by Prisma orders.
- Checkout and fulfillment: Delivery or pickup capture, address validation, order state transitions, and user dashboards that surface order history.
- Payments: Razorpay order intent creation, webhook processing, order event logging, and a safe fallback test mode when Razorpay keys are absent.
- Reviews and moderation: Customers can create, update, and delete reviews; admins can hide or restore feedback while aggregates stay in sync.
- Admin workspace: Authenticated tools for managing inventory, orders, users, invitations, and review moderation, with audit-friendly event timelines.
- Media pipeline: Image uploads and deletions via Vercel Blob, including client-side guards for file type and size and clean-up endpoints.
capstone_project/
|-- docs/
| |-- Capstone.pdf
| |-- Design.md
| |-- ERD.md
| |-- RequirementAnalysis.md
| |-- Report.md
| `-- Wireframes/
|-- prisma/
| |-- schema.prisma
| `-- seed.ts
|-- public/
|-- src/
| |-- app/
| |-- components/
| |-- lib/
| `-- styles/
|-- tests/
| `-- reviews.test.ts
|-- .env.example
|-- package.json
|-- README.md
|-- TODO.md
`-- LICENSE
- Node.js 20+
- npm
- PostgreSQL 14+
- Optional: Resend account or SMTP provider for transactional emails
- Optional: Razorpay account for live payments
- Optional: Vercel Blob project for media storage
- Clone and install
git clone <repository-url> cd capstone_project npm install
- Configure environment variables
Copy
.env.exampleto.env(or.env.local) and fill in the values described below. - Provision the database
npx prisma migrate dev
- Seed demo data (recommended)
Seeding creates demo products plus accounts:
npm run seed
- Admin:
admin@demo.test/Passw0rd! - Customers:
user@demo.test,alex@demo.test,priya@demo.test,jordan@demo.test(all usePassw0rd!)
- Admin:
- Start the development server
Visit http://localhost:3000 to explore the app.
npm run dev
npm run dev- launch the development servernpm run buildornpm run start- build and run a production bundlenpm run seed- populate demo data (safe to re-run)npm run lint- run ESLintnpm run test- execute Vitest suites
Configure the following variables (see .env.example).
DATABASE_URL- PostgreSQL connection string.NEXTAUTH_SECRET- random string used by NextAuth to sign tokens.NEXTAUTH_URL- canonical URL of the deployed app (for examplehttp://localhost:3000).APP_BASE_URL- base URL used in links inside transactional emails. Falls back toNEXTAUTH_URL.
ALLOW_UNVERIFIED_LOGIN- set totrueto allow sign-in before email verification (defaults tofalse).
BLOB_READ_WRITE_TOKEN- Vercel Blob token with read/write permissions for the product image bucket.
Provide either Resend credentials or SMTP settings (both can co-exist; Resend is preferred when present).
RESEND_API_KEY- API key for Resend.RESEND_FROM- verified sender identity (for exampleMerch Portal <onboarding@resend.dev>).EMAIL_FROM- default "from" address used when neither Resend nor SMTP overrides it.SMTP_HOST,SMTP_PORT,SMTP_USERNAME,SMTP_PASSWORD,SMTP_SECURE- SMTP transport configuration.
RAZORPAY_KEY_IDandRAZORPAY_KEY_SECRET- Razorpay API credentials used to create orders.RAZORPAY_WEBHOOK_SECRET- shared secret for validating webhook signatures (optional but strongly recommended).
If Razorpay credentials are omitted, the checkout flow remains in test mode and generates mock order identifiers so that UI flows can be exercised without hitting the live API.
- Additional artefacts (requirements, design, ERD, report, and wireframes) live in the
docs/directory. - Implementation progress, completed work, and outstanding tasks are tracked in
TODO.md.
Contributions are welcome. Open an issue or submit a pull request if you spot a bug or want to collaborate.