This is a full-stack Food Ordering Web Application built as part of the Slooze Take-Home Assignment.
It allows users (Admin, Managers, and Team Members) to browse restaurants and menus, create and manage orders, and handle payments — all with Role-Based Access Control (RBAC) and country-based data segregation.
Nick Fury is a business owner with 5 employees:
| Name | Role | Country |
|---|---|---|
| Nick Fury | Admin | Global |
| Captain Marvel | Manager | India |
| Captain America | Manager | America |
| Thanos | Member | India |
| Thor | Member | India |
| Travis | Member | America |
Nick wants a web-based food ordering application with the following functionalities:
| Function | Admin | Manager | Member |
|---|---|---|---|
| View restaurants & menu items | ✅ | ✅ | ✅ |
| Create order (add food items) | ✅ | ✅ | ✅ |
| Place order (checkout & pay) | ✅ | ✅ | ❌ |
| Cancel order | ✅ | ✅ | ❌ |
| Update payment method | ✅ | ❌ | ❌ |
Additional rules:
- Managers and Members can only access data from their own country (India or America).
- Admin has global access.
- Node.js / Express
- TypeScript
- MongoDB / Mongoose
- JWT Authentication
- RBAC Middleware
- Next.js 16
- React 19
- Tailwind CSS
- Axios for API integration
- ShadCN UI
✅ Authentication & RBAC
- JWT-based login with role validation middleware
- Role-based and country-based authorization
✅ Restaurants & Menu
- View restaurants and their menu items
- Filter access by country
✅ Orders & Cart
- Create and manage orders
- Add food items to cart
- Checkout and payment simulation (Admin/Manager only)
- Cancel orders (Admin/Manager only)
✅ Payment Management
- Admin can add or update payment methods
✅ Data Isolation
- Managers and Members can only access data from their assigned country
Flow:
Frontend (Next.js)
↓
API Gateway (Express + JWT)
↓
RBAC Middleware (role + country check)
↓
MongoDB (Users, Restaurants, Orders, Cart, Payment)
| Route | Admin | Manager | Member | Description |
|---|---|---|---|---|
| GET /restaurants | ✅ | ✅ | ✅ | View all restaurants |
| GET /menu/:id | ✅ | ✅ | ✅ | View menu items |
| POST /cart/add | ✅ | ✅ | ✅ | Add food items to cart |
| POST /order/checkout | ✅ | ✅ | ❌ | Checkout and pay |
| POST /order/cancel/:id | ✅ | ✅ | ❌ | Cancel an order |
| PATCH /payment-method | ✅ | ❌ | ❌ | Update payment method |
git clone https://github.com/rupesh-dev30/Slooze-Full-Stack-Assessment.git
cd Slooze-Full-Stack-Assessmentcd backend
npm installCreate a .env file inside backend/:
PORT=9001
MONGO_URI=<YOUR_MONGO_DB_URL>
JWT_SECRET=<YOUR_JWT_SECRET>
COOKIE_NAME=token
NODE_ENV=developmentRun the seed file to insert initial users and data:
# If tsx is not installed globally
npm install -g tsx
# Then run seed
tsx src/database/seed.tsStart the server:
npm run devcd ../frontend
npm install
npm run devOpen 👉 http://localhost:3000
| Name | Password | Role | Country | |
|---|---|---|---|---|
| Nick Fury | nick@avengers.com |
password123 |
Admin | America |
| Captain Marvel | cm@company.com |
password123 |
Manager | India |
| Captain America | ca@company.com |
password123 |
Manager | America |
| Thanos | thanos@company.com |
password123 |
Member | India |
| Thor | thor@company.com |
password123 |
Member | India |
| Travis | travis@company.com |
password123 |
Member | America |
POST /api/auth/register→ Register a new userPOST /api/auth/login→ Login and get JWT token in cookiesPOST /api/auth/logout→ Logout userGET /api/auth/me→ Get current logged-in user info
GET /api/restaurants→ Get all restaurantsGET /api/restaurants/:id/menu→ Get menu items
GET /api/cart→ Get user cartPOST /api/cart→ Add itemPUT /api/cart→ Update quantityDELETE /api/cart/:menuItemId→ Remove itemDELETE /api/cart→ Clear entire cart
POST /api/orders→ Create new orderGET /api/orders→ List orders (filtered by role/country)POST /api/orders/:id/checkout→ Checkout & payPOST /api/orders/:id/cancel→ Cancel orderGET /api/orders/:id→ Get single order details
GET /api/payments→ List payment methodsPOST /api/payments→ Create payment methodPUT /api/payments/:id→ Update payment method (Admin only)
authMiddleware:
- Checks JWT token in cookies
- Verifies user and attaches to
req.user - Returns 401 if unauthorized
permit(...roles):
- Restricts access to certain roles
- Example:
permit("ADMIN", "MANAGER")
restrictByCountry(getResourceCountry):
- Blocks users from accessing another country’s data
- Admin bypasses this check
Your seed script automatically creates:
- 6 users (Admin, Managers, Members)
- Sample restaurants for India and America
- Menu items for each restaurant
🎬 Watch the demo video here:
| Login | Restaurants | Cart | Orders |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
| Restaurants-Details | Payment | Profile |
|---|---|---|
![]() |
![]() |
![]() |
- ✅ Role-based Access Control (RBAC)
- ✅ Country-based data filtering
- ✅ JWT Auth with cookie storage
- ✅ Seed script for auto data setup
- ✅ Payment management system
Rupesh Kumar 🔗 GitHub
This project is open-sourced under the MIT License.






