A comprehensive e-commerce platform for pet supplies and services across the Maldives
Pet Realm connects pet owners with local shops, veterinary clinics, and pet service providers throughout the Maldivian atolls and islands. Built with modern web technologies and designed specifically for the unique geographic and business needs of the Maldives.
- Browse & Search - Discover pet supplies and services across the Maldives
- Shopping Cart - Easy cart management with single-shop validation
- Order Tracking - Real-time order status with detailed timeline
- Flexible Delivery - Choose pickup or delivery based on shop availability
- Email Notifications - Stay updated on order status changes
- Profile Management - Manage your account and order history
- Shop Setup - Multi-step wizard to get your shop online quickly
- Product Management - Create, edit, and manage products with multiple images
- Dashboard - Track revenue, orders, and key metrics
- Delivery Zones - Configure custom delivery areas and fees
- Payment Verification - Review and verify receipt uploads
- Order Management - Process orders with status tracking
- Secure Authentication - Email verification and password reset
- Maldivian Location System - Atoll and island-based addressing
- Responsive Design - Optimized for mobile, tablet, and desktop
- Image Management - Up to 5 images per product with R2 cloud storage
- Receipt-Based Payments - Manual payment verification via receipt upload
- Multi-Region Support - Delivery across different atolls and islands
- Node.js 18+ and pnpm
- PostgreSQL database
- Resend API key (for emails)
- Cloudflare R2 bucket (for image storage)
-
Clone the repository
git clone https://github.com/MystSugar/pet-realm.git cd pet-realm -
Install dependencies
pnpm install
-
Set up environment variables
Create a
.envfile in the root directory:# Database DATABASE_URL="postgresql://user:password@localhost:5432/pet_realm" # NextAuth NEXTAUTH_SECRET="your-secret-key-here" NEXTAUTH_URL="http://localhost:3000" # Email (Resend) RESEND_API_KEY="re_xxxxxxxxxxxxx" EMAIL_FROM="Pet Realm <noreply@yourdomain.com>" # Cloudflare R2 Storage R2_ACCOUNT_ID="your-r2-account-id" R2_ACCESS_KEY_ID="your-r2-access-key" R2_SECRET_ACCESS_KEY="your-r2-secret-key" R2_BUCKET_NAME="pet-realm-receipts" R2_PUBLIC_URL="https://your-r2-public-url.com" # R2 Shop Images R2_SHOP_IMAGES_BUCKET_NAME="pet-realm-shop-images" R2_SHOP_IMAGES_PUBLIC_URL="https://your-shop-images-url.com" # App NEXT_PUBLIC_APP_URL="http://localhost:3000"
-
Set up the database
# Push schema to database pnpm prisma db push # Or run migrations pnpm prisma migrate deploy # Generate Prisma client pnpm prisma generate
-
Seed the database (optional)
pnpm db:seed
-
Run the development server
pnpm dev
-
Open your browser
Navigate to http://localhost:3000
pet-realm/
βββ prisma/
β βββ schema.prisma # Database schema
β βββ seed.ts # Database seeding
β βββ migrations/ # Database migrations
βββ public/
β βββ uploads/ # Local file uploads (dev only)
βββ src/
β βββ app/ # Next.js app directory
β β βββ api/ # API routes
β β β βββ auth/ # Authentication endpoints
β β β βββ cart/ # Shopping cart endpoints
β β β βββ checkout/ # Order creation
β β β βββ orders/ # Order management
β β β βββ products/ # Product endpoints
β β β βββ shop/ # Shop management (seller)
β β β βββ shops/ # Shop listing (public)
β β β βββ user/ # User profile endpoints
β β βββ auth/ # Auth pages (signin, register, etc.)
β β βββ shop/ # Seller dashboard pages
β β βββ marketplace/ # Product browsing
β β βββ cart/ # Shopping cart page
β β βββ checkout/ # Checkout page
β β βββ orders/ # Order history
β β βββ ... # Other pages
β βββ components/ # React components
β β βββ auth/ # Auth forms
β β βββ cart/ # Cart components
β β βββ checkout/ # Checkout flow
β β βββ layouts/ # Layout components
β β βββ marketplace/ # Product listing
β β βββ orders/ # Order displays
β β βββ products/ # Product cards
β β βββ shop/ # Seller components
β β βββ ui/ # Reusable UI components
β β βββ ...
β βββ hooks/ # Custom React hooks
β β βββ useAuth.ts # Authentication hook
β β βββ useCart.ts # Shopping cart hook
β β βββ ...
β βββ lib/ # Utility libraries
β β βββ auth.ts # NextAuth configuration
β β βββ prisma.ts # Prisma client
β β βββ email.ts # Email utilities
β β βββ validations/ # Zod schemas
β β βββ utils/ # Helper functions
β βββ types/ # TypeScript types
β βββ middleware.ts # Next.js middleware
βββ CHANGELOG.md # Version history
βββ package.json # Dependencies
βββ README.md # This file
| Category | Technology |
|---|---|
| Framework | Next.js 15.1 with App Router |
| Language | TypeScript 5 |
| Database | PostgreSQL with Prisma ORM 6.19 |
| Authentication | NextAuth.js (JWT sessions) |
| Styling | Tailwind CSS 4 |
| Resend API | |
| Storage | Cloudflare R2 (S3-compatible) |
| Validation | Zod |
| UI Components | Radix UI |
| Package Manager | pnpm |
- User - Customer, Seller, or Admin accounts
- Shop - Shop profiles and settings
- Product - Product listings with images and details
- Order - Customer orders with status tracking
- OrderItem - Individual items in orders
- CartItem - Shopping cart items
- ContactSubmission - Contact form submissions
- Account - OAuth accounts
- Session - Database sessions (currently using JWT)
- VerificationToken - Email verification tokens
-
Registration
- User signs up with email, phone, and ID verification
- Email verification token sent
- Account remains unverified until email confirmed
-
Email Verification
- Click link in verification email
- Token validated and marked as verified
- Account activated
-
Sign In
- Email/password authentication
- JWT token created (30-day expiry)
- Stored in HTTP-only cookie
-
Password Reset
- Request reset via email
- Reset token sent to email
- New password set via token link
Browse Marketplace β View Product β Add to Cart β Checkout β
Upload Receipt β Seller Verifies β Order Status Updates β Delivered/Picked Up
Setup Shop β Add Products β Receive Order β Verify Payment β
Update Status β Fulfill Order
- PENDING - Order placed, awaiting receipt upload
- CONFIRMED - Receipt verified, order confirmed
- PREPARING - Shop preparing the order
- READY - Ready for pickup
- OUT_FOR_DELIVERY - Out for delivery
- DELIVERED - Successfully delivered
- PICKED_UP - Customer picked up order
- CANCELLED - Order cancelled
- Set up PostgreSQL database (e.g., Supabase, Railway, Neon)
- Configure R2 buckets in Cloudflare
- Get Resend API key for email
- Set all environment variables
# Build for production
pnpm build
# Start production server
pnpm start- Vercel - Optimized for Next.js
- Railway - Easy database + app hosting
- Fly.io - Global edge deployment
pnpm dev # Start development server
pnpm build # Build for production
pnpm start # Start production server
pnpm lint # Run ESLint
pnpm db:seed # Seed database with sample data# Generate Prisma client
pnpm prisma generate
# Create migration
pnpm prisma migrate dev --name your_migration_name
# Apply migrations
pnpm prisma migrate deploy
# Open Prisma Studio
pnpm prisma studio
# Reset database (dev only)
pnpm prisma migrate resetSee CHANGELOG.md for version history and GitHub Issues for planned features.
This project serves as a comprehensive learning experience for:
- Modern Next.js 15 development with App Router
- TypeScript and type-safe development
- Database design and Prisma ORM
- Authentication and authorization patterns
- E-commerce platform architecture
- Cloud storage and email services
- GitHub workflows and versioning
- Project management and documentation
This is currently a personal learning project. Contributions are not being accepted at this time, but feel free to fork and adapt for your own learning!
Proprietary - All rights reserved. This is a personal learning project.
MystSugar
- GitHub: @MystSugar
This project wouldn't exist without the constant supervision and "helpful" feedback from:
- Totoro π€ - Head of Quality Assurance (Cockatiel Division). Expert at finding bugs by screaming at 4PM.
- Jojo π - Senior Code Reviewer. Named after a certain bizarre adventure. Provides feedback exclusively in chirps and aggressive keyboard inspections.
- Roro (Rose) π©· - Chief Motivational Officer. Specializes in moral support and head bobs.
- Pudding (Pood) π - Visiting Consultant (Kakariki Advisory Board). Offers expert judgment on all architectural decisions, mostly while giving speeches.
All commits are birb-approved. Most compile errors are definitely their fault. π¦β¨