A full-stack role-based food ordering web application built with Next.js 15, featuring country-based restaurant filtering and comprehensive order management.
- NextAuth.js integration with JWT sessions
- Role-based access control: ADMIN, MANAGER, MEMBER
- Country-based filtering: India & America
- Browse restaurants filtered by your country
- View detailed menus organized by categories
- Beautiful responsive UI with Unsplash images
- Add items to cart with quantity controls
- Prevents mixing items from different restaurants
- Real-time cart updates using LocalStorage
- Role-based checkout (ADMIN & MANAGER only)
- Multiple payment methods support
- Secure order placement
- View order history
- Track order status (CONFIRMED, PREPARING, READY, DELIVERED, CANCELLED)
- Cancel orders (ADMIN & MANAGER only)
- Manage payment methods (ADMIN only)
- Add/delete cards
- Set default payment method
- Framework: Next.js 15 (App Router)
- Database: PostgreSQL with Prisma ORM
- Authentication: NextAuth.js
- UI: Tailwind CSS + shadcn/ui
- Language: TypeScript
-
Clone the repository
git clone <your-repo-url> cd hungry
-
Install dependencies
npm install
-
Set up environment variables
# .env DATABASE_URL="your-postgres-connection-string" NEXTAUTH_URL="http://localhost:3000" NEXTAUTH_SECRET="your-secret-key"
-
Run database migrations
npx prisma migrate dev
-
Seed the database
npm run prisma:seed
-
Start the development server
npm run dev
Visit http://localhost:3000
| Password | Role | Country | |
|---|---|---|---|
| admin@test.com | password123 | ADMIN | INDIA |
| manager@test.com | password123 | MANAGER | INDIA |
| member@test.com | password123 | MEMBER | AMERICA |
| Feature | ADMIN | MANAGER | MEMBER |
|---|---|---|---|
| View restaurants & menus | Yes | Yes | Yes |
| Add items to cart | Yes | Yes | Yes |
| Checkout & pay | Yes | Yes | No |
| Cancel orders | Yes | Yes | No |
| Manage payment methods | Yes | No | No |
Users only see restaurants from their assigned country:
- India users: See Indian restaurants (Spice Garden, Curry House)
- America users: See American restaurants (Burger Palace, Pizza Paradise)
hungry/
├── app/
│ ├── actions/ # Server actions
│ ├── api/ # API routes
│ ├── admin/ # Admin pages
│ ├── cart/ # Shopping cart
│ ├── checkout/ # Checkout flow
│ ├── orders/ # Order management
│ ├── restaurants/ # Restaurant pages
│ ├── login/ # Authentication
│ └── register/
├── components/
│ └── ui/ # shadcn/ui components
├── lib/
│ ├── auth.ts # NextAuth config
│ └── prisma.ts # Prisma client
├── prisma/
│ ├── schema.prisma # Database schema
│ └── seed.ts # Seed data
└── types/ # TypeScript definitions
- User: Authentication & role management
- Restaurant: Restaurant information with country
- MenuItem: Menu items linked to restaurants
- Order: Order tracking with status
- OrderItem: Junction table for orders & menu items
- PaymentMethod: User payment methods
# Run development server
npm run dev
# Run Prisma Studio (database GUI)
npx prisma studio
# Generate Prisma Client
npx prisma generate
# Create migration
npx prisma migrate dev --name <migration-name>- Light color theme (orange/amber/yellow gradients)
- Responsive design for all screen sizes
- Backdrop blur effects on cards
- Smooth transitions and hover states
- Professional typography with Geist fonts
MIT
Built with Next.js 15