{"id":48672553,"url":"https://github.com/khamzaevasad/mokcha-service","last_synced_at":"2026-04-10T12:34:41.587Z","repository":{"id":319916953,"uuid":"1080086320","full_name":"khamzaevasad/mokcha-service","owner":"khamzaevasad","description":"This is backend project Mokcha source","archived":false,"fork":false,"pushed_at":"2026-02-26T01:58:18.000Z","size":19042,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-26T04:24:38.147Z","etag":null,"topics":["database","nodejs","ssr","ts"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/khamzaevasad.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-20T21:05:40.000Z","updated_at":"2026-02-26T01:58:21.000Z","dependencies_parsed_at":"2025-10-20T23:43:03.122Z","dependency_job_id":null,"html_url":"https://github.com/khamzaevasad/mokcha-service","commit_stats":null,"previous_names":["khamzaevasad/burex","khamzaevasad/mokcha-service"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/khamzaevasad/mokcha-service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khamzaevasad%2Fmokcha-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khamzaevasad%2Fmokcha-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khamzaevasad%2Fmokcha-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khamzaevasad%2Fmokcha-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khamzaevasad","download_url":"https://codeload.github.com/khamzaevasad/mokcha-service/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khamzaevasad%2Fmokcha-service/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31643243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","nodejs","ssr","ts"],"created_at":"2026-04-10T12:34:41.452Z","updated_at":"2026-04-10T12:34:41.553Z","avatar_url":"https://github.com/khamzaevasad.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🍜 MOKCHA (먹자) - Korean Restaurant Ordering Platform\n\n![React](https://img.shields.io/badge/React-20232A?style=for-the-badge\u0026logo=react\u0026logoColor=61DAFB)\n![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge\u0026logo=typescript\u0026logoColor=white)\n![Node.js](https://img.shields.io/badge/Node.js-43853D?style=for-the-badge\u0026logo=node.js\u0026logoColor=white)\n![Express.js](https://img.shields.io/badge/Express.js-404D59?style=for-the-badge)\n![MongoDB](https://img.shields.io/badge/MongoDB-4EA94B?style=for-the-badge\u0026logo=mongodb\u0026logoColor=white)\n![Redux](https://img.shields.io/badge/Redux-593D88?style=for-the-badge\u0026logo=redux\u0026logoColor=white)\n![Tailwind CSS](https://img.shields.io/badge/Tailwind_CSS-38B2AC?style=for-the-badge\u0026logo=tailwind-css\u0026logoColor=white)\n![DaisyUI](https://img.shields.io/badge/DaisyUI-5A0EF8?style=for-the-badge\u0026logo=daisyui\u0026logoColor=white)\n\n## 📖 About The Project\n\n**MOKCHA** (먹자 - meaning \"Let's Eat\" in Korean) is a modern, full-stack restaurant ordering platform that provides seamless food ordering experience with comprehensive user management and order tracking capabilities. Built with React TypeScript frontend and Node.js/Express backend following MVC architecture, this application offers an intuitive interface for discovering dishes, placing orders, and managing your dining experience. The platform includes a powerful admin panel with server-side rendering for efficient management of users and products.\n\n### ✨ Key Features\n\n#### Client-Side Features\n\n- 🔐 **Complete Authentication System** - Login, Signup, and Logout functionality\n- 🏠 **Dynamic Home Page** - Popular Dishes, Fresh Menu, About Restaurant, and User Reviews sections\n- 🍽️ **Smart Product Filtering** - Filter by category (Dishes, Salads, Desserts, Drinks, Other)\n- 🔍 **Real-time Search** - Instant search functionality across all menu items\n- 💰 **Price-based Sorting** - Sort items by newest arrivals and price range\n- 📄 **Pagination** - Smooth navigation through extensive menu catalog\n- 📦 **Order Management** - Track orders through Paused, Processing, and Finished states\n- 👤 **User Profile** - Manage personal information, phone number, bio, points, and profile image\n- 📊 **Order History** - Complete history of placed orders with total pricing\n- 📱 **100% Responsive Design** - Optimized for all devices and screen sizes\n\n#### Admin Panel Features\n\n- 🛡️ **SSR Admin Dashboard** - Server-side rendered admin panel at `/admin`\n- 👥 **User Management** - Complete CRUD operations for user accounts\n- 🍽️ **Product Management** - Add, edit, delete, and organize menu items\n- 📊 **Advanced Filtering** - Filter users and products with custom criteria\n- 📄 **Pagination System** - Efficient data navigation for large datasets\n- 🔒 **Secure Access** - Protected admin routes with authentication\n- 📈 **Dashboard Analytics** - Overview of orders, users, and products\n\n### 🔄 Real-time Features\n\n- 🔄 **Live Updates** - Backend integration with Axios for dynamic data\n- 🍞 **Toast Notifications** - Elegant user feedback system\n- 🍪 **Cookie Management** - Secure session handling for frontend\n- 🔐 **JWT Authentication** - Token-based security system\n\n## 🏗️ Architecture\n\nThis project follows a **full-stack architecture** with clear separation between frontend and backend:\n\n### Frontend Architecture\n\n- **React + TypeScript** - Type-safe component development\n- **Redux + Context API** - Hybrid state management approach\n- **Component-based Structure** - Reusable and maintainable components\n- **Axios Integration** - HTTP client for API communication\n\n### Backend Architecture\n\n- **MVC Pattern** - Model-View-Controller architecture\n- **Express.js** - Fast, minimalist web framework\n- **MongoDB** - NoSQL database for flexible data storage\n- **Middleware Chain** - Request processing pipeline\n- **SSR with EJS** - Server-side rendering for admin panel\n\n## 🛠️ Technology Stack\n\n### Frontend Technologies\n\n- **[React 18+](https://react.dev/)** - Modern UI library\n- **[TypeScript](https://www.typescriptlang.org/)** - Type-safe JavaScript\n- **[Redux](https://redux.js.org/)** - Global state management\n- **[Context API](https://react.dev/learn/passing-data-deeply-with-context)** - Additional state management\n- **[React Router](https://reactrouter.com/)** - Client-side routing\n- **[Axios](https://axios-http.com/)** - HTTP client for API requests\n- **[Tailwind CSS](https://tailwindcss.com/)** - Utility-first CSS framework\n- **[DaisyUI](https://daisyui.com/)** - Component library for Tailwind\n- **Toast Library** - User notification system\n\n### Backend Technologies\n\n- **[Node.js](https://nodejs.org/)** - JavaScript runtime environment\n- **[Express.js](https://expressjs.com/)** - Web application framework\n- **[TypeScript](https://www.typescriptlang.org/)** - Type-safe backend development\n- **[MongoDB](https://www.mongodb.com/)** - NoSQL database\n- **[Mongoose](https://mongoosejs.com/)** - MongoDB object modeling with aggregation pipelines\n- **[EJS](https://ejs.co/)** - Embedded JavaScript templating for SSR\n- **[jQuery](https://jquery.com/)** - DOM manipulation for admin panel\n- **[Cookie-Parser](https://www.npmjs.com/package/cookie-parser)** - Cookie handling middleware\n- **[JWT](https://jwt.io/)** - JSON Web Tokens for authentication\n- **[Bcrypt](https://www.npmjs.com/package/bcrypt)** - Password hashing\n- **[Multer](https://www.npmjs.com/package/multer)** - Multi-image upload handling (up to 5 images per product)\n\n### Additional Tools \u0026 Libraries\n\n- **[Multer](https://www.npmjs.com/package/multer)** - File upload handling\n- **[Validator](https://www.npmjs.com/package/validator)** - Data validation\n- **[Dotenv](https://www.npmjs.com/package/dotenv)** - Environment variable management\n- **[CORS](https://www.npmjs.com/package/cors)** - Cross-Origin Resource Sharing\n- **[Morgan](https://www.npmjs.com/package/morgan)** - HTTP request logger\n\n## 🎯 Core Features\n\n### 🏠 Home Page\n\n**Popular Dishes Section**\n\n- Curated selection of trending menu items\n- Visual cards with pricing and descriptions\n- Quick add-to-cart functionality\n\n**Fresh Menu Section**\n\n- Latest additions to the menu\n- Seasonal and special offerings\n- Real-time updates from backend\n\n**About Restaurant**\n\n- Restaurant story and mission\n- Location and contact information\n- Operating hours\n\n**User Reviews Section**\n\n- Customer testimonials\n- Rating system\n- User-generated content\n\n### 🍽️ Product Page\n\n**Category Filtering**\n\n- **Dishes**: Main course items\n- **Salads**: Fresh salad options\n- **Desserts**: Sweet treats\n- **Drinks**: Beverage selection\n- **Other**: Additional menu items\n\n**Advanced Filtering Options**\n\n- Real-time search across all products\n- Sort by newest arrivals\n- Filter by price range\n- Instant results with backend integration\n\n**Pagination System**\n\n- Smooth page navigation\n- Configurable items per page\n- Efficient data loading from MongoDB\n\n### 📦 Orders Page\n\n**Access Control**\n\n- Available only to authenticated users\n- Secure order management\n- Real-time order status updates\n\n**Order States**\n\n- **Paused Orders**: Orders waiting to be processed\n- **Processing Orders**: Currently being prepared\n- **Finished Orders**: Completed and delivered orders\n\n**Order Management**\n\n- View order details\n- Track order status\n- Cancel or modify orders\n\n### 👤 My Page (User Profile)\n\n**Profile Information**\n\n- Personal details management\n- Phone number\n- Bio/Description\n- User points system\n- Profile image upload and update\n\n**Update Functionality**\n\n- Edit personal information\n- Change contact details\n- Update profile picture\n- Real-time backend synchronization\n\n**Order History**\n\n- Complete list of past orders\n- Order details and items\n- Total pricing for each order\n- Date and time stamps\n- Order status history\n\n### 🛡️ Admin Panel (localhost:3005/admin)\n\n**Server-Side Rendered Dashboard**\n\n- Built with EJS templating engine\n- jQuery for dynamic interactions\n- Custom CSS styling\n- Responsive admin interface\n\n**User Management**\n\n- View all registered users\n- Edit user information\n- Delete user accounts\n- Filter users by criteria\n- Pagination for large user lists\n- User role management\n\n**Product Management**\n\n- Add new menu items\n- Edit existing products\n- Delete products\n- Upload product images\n- Manage product categories\n- Set pricing and availability\n- Filter products by category\n- Pagination for product catalog\n\n**Advanced Features**\n\n- Search functionality for users and products\n- Bulk actions for efficient management\n- Data validation and error handling\n- Secure authentication for admin access\n- Activity logging and monitoring\n\n## 🚀 Getting Started\n\n### Prerequisites\n\n- **Node.js** (version 16.0 or higher)\n- **npm** or **yarn** package manager\n- **MongoDB** (local installation or MongoDB Atlas)\n- **Git** for version control\n\n### Backend Installation\n\n1. **Clone the repository**\n\n   ```bash\n   git clone https://github.com/khamzaevasad/mokcha-service.git\n   ```\n\n2. **Navigate to the backend directory**\n\n   ```bash\n   cd mokcha/backend\n   ```\n\n3. **Install backend dependencies**\n\n   ```bash\n   npm install\n   ```\n\n4. **Configure environment variables**\n\n   Create a `.env` file in the backend root directory:\n\n   ```env\n   PORT=3000\n   MONGODB_URI=mongodb://localhost:27017/mokcha\n   JWT_SECRET=your_jwt_secret_key\n   ```\n\n5. **Start the backend server**\n\n   ```bash\n   npm run dev\n   # or for production\n   npm start\n   ```\n\n6. **Access the admin panel**\n   ```\n   http://localhost:3005/admin\n   ```\n\n### Frontend Installation\n\n1. **Navigate to the frontend directory**\n\n   ```bash\n   cd mokcha/frontend\n   ```\n\n2. **Install frontend dependencies**\n\n   ```bash\n   npm install\n   ```\n\n3. **Configure environment variables**\n\n   Create a `.env` file in the frontend root directory:\n\n   ```env\n   VITE_API_BASE_URL=http://localhost:3005/api\n   ```\n\n4. **Start the development server**\n\n   ```bash\n   npm run dev\n   ```\n\n5. **Open your browser**\n   ```\n   http://localhost:5173\n   ```\n\n## 📁 Project Structure\n\n### Backend Structure\n\n```\nmokcha-backend/\n├── src/\n│   ├── controller/\n│   │   ├── authController.ts\n│   │   ├── userController.ts\n│   │   ├── productController.ts\n│   │   ├── orderController.ts\n│   │   └── adminController.ts\n│   ├── libs/\n│   │   ├── enums/\n│   │   ├── types/\n│   │   └── utils/\n│   │       ├── Errors.ts\n│   │       ├── config.ts\n│   │       └── logger.ts\n│   ├── model/\n│   │   ├── User.ts\n│   │   ├── Product.ts\n│   │   └── Order.ts\n│   ├── public/\n│   │   ├── css/\n│   │   ├── js/\n│   │   └── images/\n│   ├── schema/\n│   │   ├── userSchema.ts\n│   │   ├── productSchema.ts\n│   │   └── orderSchema.ts\n│   ├── views/\n│   │   ├── includes/\n│   │   │   ├── header.ejs\n│   │   │   └── footer.ejs\n│   │   ├── home.ejs\n│   │   ├── login.ejs\n│   │   ├── products.ejs\n│   │   ├── signup.ejs\n│   │   └── users.ejs\n│   ├── app.ts\n│   ├── router-admin.ts\n│   ├── router.ts\n│   └── server.ts\n├── .gitignore\n├── LICENSE\n├── package.json\n├── package-lock.json\n└── tsconfig.json\n```\n\n### Frontend Structure\n\n```\nmokcha-frontend/\n├── public/\n│   ├── images/\n│   └── favicon.ico\n├── src/\n│   ├── app/\n│   │   └── store.ts\n│   ├── assets/\n│   │   └── images/\n│   ├── components/\n│   │   ├── cards/\n│   │   ├── help/\n│   │   ├── home/\n│   │   ├── order/\n│   │   ├── product/\n│   │   ├── providers/\n│   │   └── user/\n│   ├── context/\n│   │   └── GlobalContext.tsx\n│   ├── css/\n│   │   └── styles.css\n│   ├── data/\n│   │   └── constants.ts\n│   ├── hooks/\n│   │   └── customHooks.ts\n│   ├── layout/\n│   │   ├── Header.tsx\n│   │   └── Footer.tsx\n│   ├── lib/\n│   │   ├── enums/\n│   │   ├── types/\n│   │   └── config.ts\n│   ├── pages/\n│   │   ├── help/\n│   │   ├── home/\n│   │   ├── order/\n│   │   ├── product/\n│   │   ├── productInfo/\n│   │   ├── user/\n│   │   └── index.ts\n│   ├── services/\n│   │   └── api.ts\n│   ├── utils/\n│   │   └── helpers.ts\n│   ├── Routes.tsx\n│   ├── main.tsx\n│   └── App.tsx\n├── .gitignore\n├── package.json\n├── tsconfig.json\n├── vite.config.ts\n├── tailwind.config.js\n└── README.md\n```\n\n## 🏛️ MVC Architecture\n\n### Model Layer\n\n**Responsibilities:**\n\n- Database schema definitions\n- Data validation rules\n- Business logic operations\n- MongoDB document structure\n- Mongoose model definitions\n\n**Models:**\n\n```typescript\n// User Model\n- User authentication data\n- Profile information\n- Order history references\n- Points and loyalty data\n\n// Product Model\n- Product details and pricing\n- Category classification\n- Availability status\n- Image references\n\n// Order Model\n- Order items and quantities\n- User reference\n- Order status tracking\n- Payment information\n- Timestamps and history\n```\n\n### View Layer\n\n**Frontend Views (React Components):**\n\n- React components for client interface\n- Responsive design with Tailwind CSS\n- Dynamic rendering with state management\n- User interaction handling\n\n**Backend Views (EJS Templates):**\n\n- Server-side rendered admin pages\n- EJS templating for dynamic content\n- jQuery for enhanced interactivity\n- Custom CSS for admin styling\n\n### Controller Layer\n\n**Responsibilities:**\n\n- Request handling and routing\n- Business logic coordination\n- Data validation and sanitization\n- Response formatting\n- Error handling\n\n**Controllers:**\n\n```typescript\n// membersController (Client API)\n- getRestaurant: Get restaurant information\n- signup: Member registration\n- login: Member authentication\n- logout: Member logout (requires verifyAuth)\n- getMemberDetail: Get authenticated member details\n- updateMember: Update member profile with image upload\n- getTopUsers: Get leaderboard of top users by points\n- verifyAuth: Middleware for authentication verification\n- retrieveAuth: Middleware for optional authentication\n\n// productController (Client API)\n- getProducts: Get all products with filters and pagination\n- getProduct: Get single product details (with optional auth)\n- getRecommendedProducts: Get recommended products based on product ID\n\n// orderController (Client API)\n- createOrder: Create new order (requires verifyAuth)\n- getMyOrders: Get all orders for authenticated member\n- updateOrder: Update order status (requires verifyAuth)\n\n// restaurantController (Admin SSR)\n- goHome: Render admin home/dashboard\n- getSignup: Render admin signup page\n- processSignup: Handle admin registration with image upload\n- getLogin: Render admin login page\n- processLogin: Handle admin authentication\n- checkedAuthenticated: Check admin authentication status\n- logout: Admin logout\n- verifyRestaurant: Middleware for admin authentication\n- getUsers: Get all users for admin panel\n- updateChosenUser: Update user information from admin panel\n\n// productController (Admin SSR)\n- getAllProducts: Get all products for admin management\n- createNewProduct: Create product with up to 5 images\n- updateChosenProduct: Update product from admin panel\n```\n\n## 🔧 Middleware Architecture\n\n### Authentication Middleware\n\n```typescript\n// JWT Token Verification (verifyAuth)\n- Validates JWT tokens for member routes\n- Extracts member information\n- Handles token expiration\n- Protects private member routes\n\n// Auth Retrieval (retrieveAuth)\n- Optional authentication for public routes\n- Enhances user experience with auth data\n- Used for personalized content\n\n// Restaurant Admin Verification (verifyRestaurant)\n- Validates admin/restaurant authentication\n- Protects admin panel routes\n- Ensures only authorized access to management features\n\n// Cookie Validation\n- Verifies session cookies\n- Manages cookie expiration\n- Secure cookie handling\n```\n\n### Authorization Middleware\n\n```typescript\n// Role-based Access Control\n- Admin route protection (verifyRestaurant)\n- Member route protection (verifyAuth)\n- Resource ownership validation\n- Separate authentication for client and admin\n```\n\n### Validation Middleware\n\n```typescript\n// Request Validation\n- Input sanitization\n- Data type checking\n- Schema validation\n- Error formatting\n```\n\n### Error Handling Middleware\n\n```typescript\n// Global Error Handler\n- Custom error classes\n- Error logging\n- User-friendly error messages\n- Status code management\n```\n\n### Logging Middleware\n\n```typescript\n// Request Logging\n- Morgan HTTP logger\n- Custom logging system\n- Error tracking\n- Performance monitoring\n```\n\n### File Upload Middleware\n\n```typescript\n// Multer Configuration\n- Member image upload handling (single image)\n- Product images upload (up to 5 images per product)\n- File size limits\n- File type validation\n- Storage configuration\n- Organized upload directories (members/, products/)\n```\n\n## 🗄️ MongoDB Aggregations\n\nThe application uses MongoDB aggregation pipelines for complex data operations:\n\n### Product Aggregations\n\n```typescript\n// Get Products with Filters\n- $match: Filter by category, price range, search query\n- $sort: Sort by price, views, createdAt\n- $skip and $limit: Pagination\n- $lookup: Join with related collections for enhanced data\n- $project: Select specific fields and format output\n\n// Get Recommended Products\n- $match: Filter by category or related criteria\n- $sample: Randomly select products\n- $lookup: Get product details\n- $limit: Limit recommendations count\n\n// Product Views Tracking\n- $inc: Increment view count atomically\n- Used for popularity tracking and analytics\n```\n\n### Order Aggregations\n\n```typescript\n// Get Member Orders\n- $match: Filter orders by member ID and status\n- $lookup: Join with products collection\n- $unwind: Flatten order items array\n- $group: Calculate totals and aggregate data\n- $sort: Sort by date, status\n- $project: Format output with calculated fields\n\n// Order Analytics (Admin)\n- $group: Aggregate by status, date, member\n- $sum: Calculate total revenue, order counts\n- $avg: Calculate average order value\n```\n\n### Member Aggregations\n\n```typescript\n// Get Top Users\n- $sort: Sort by points/orders\n- $limit: Get top N users\n- $lookup: Join with orders for statistics\n- $project: Format user data with rankings\n\n// User Statistics\n- $lookup: Join with orders collection\n- $group: Aggregate order counts and totals\n- $addFields: Calculate derived fields\n```\n\n### View Logic Implementation\n\n```typescript\n// Product View Counter\n- Increments view count when product is accessed\n- Uses atomic operation to prevent race conditions\n- Tracks product popularity for recommendations\n- Used in analytics and trending products\n\n// Implementation:\nrouter.get(\"/product/:id\",\n  membersController.retrieveAuth, // Optional auth for personalized experience\n  productController.getProduct    // Increments view count\n);\n```\n\n## 🗄️ Database Schema\n\n### MongoDB Collections\n\n**Users Collection**\n\n```javascript\n{\n  _id: ObjectId,\n  username: String,\n  email: String,\n  password: String (hashed),\n  phone: String,\n  bio: String,\n  image: String,\n  points: Number,\n  role: String (user/admin),\n  createdAt: Date,\n  updatedAt: Date\n}\n```\n\n**Products Collection**\n\n```javascript\n{\n  _id: ObjectId,\n  name: String,\n  description: String,\n  price: Number,\n  category: String (dish/salad/dessert/drink/other),\n  images: [String], // Array of image URLs (up to 5 images)\n  availability: Boolean,\n  views: Number, // Product view count for tracking popularity\n  createdAt: Date,\n  updatedAt: Date\n}\n```\n\n**Orders Collection**\n\n```javascript\n{\n  _id: ObjectId,\n  userId: ObjectId (ref: User),\n  items: [{\n    productId: ObjectId (ref: Product),\n    quantity: Number,\n    price: Number\n  }],\n  totalPrice: Number,\n  status: String (paused/processing/finished),\n  createdAt: Date,\n  updatedAt: Date\n}\n```\n\n## 🍪 Cookie Management\n\n### Frontend Cookies\n\n- **Session Cookie**: Stores user authentication state\n- **Preferences Cookie**: User settings and preferences\n- **Cart Cookie**: Shopping cart persistence\n\n### Backend Cookie Configuration\n\n```typescript\n// Cookie Options\n- httpOnly: true (prevents XSS attacks)\n- secure: true (HTTPS only in production)\n- sameSite: 'strict' (CSRF protection)\n- maxAge: 7 days (configurable)\n```\n\n## 🔐 Authentication Flow\n\n### User Authentication\n\n1. User submits login credentials\n2. Backend validates credentials\n3. JWT token generated\n4. Token stored in cookie\n5. Frontend receives authentication status\n6. Protected routes become accessible\n\n### Admin Authentication\n\n1. Admin accesses /admin route\n2. SSR login page rendered\n3. Credentials validated server-side\n4. Admin session cookie created\n5. Access granted to admin panel\n\n## 🎨 Admin Panel Features\n\n### Dashboard\n\n- Overview of key metrics\n- Recent orders display\n- User statistics\n- Product inventory status\n\n### User Management\n\n- User list with pagination\n- Search and filter users\n- Edit user profiles\n- Delete user accounts\n- View user order history\n\n### Product Management\n\n- Product catalog with pagination\n- Add new products with image upload\n- Edit product details\n- Delete products\n- Category management\n- Availability toggle\n\n### Filtering \u0026 Pagination\n\n- Server-side filtering logic\n- Efficient database queries\n- Customizable page size\n- Sort by multiple criteria\n\n## 📡 API Endpoints\n\n### Member Authentication \u0026 Management (Client API)\n\n```\nGET    /member/restaurant           - Get restaurant information\nPOST   /member/signup               - Register new member\nPOST   /member/login                - Member login\nPOST   /member/logout               - Member logout (Auth required)\nGET    /member/detail               - Get member details (Auth required)\nPOST   /member/update               - Update member profile (Auth required, with image upload)\nGET    /member/top-users            - Get top users by points\n```\n\n### Product Endpoints (Client API)\n\n```\nGET    /product/all                 - Get all products with filters\nGET    /product/:id                 - Get single product details\nGET    /product/:id/recommended     - Get recommended products for a product\n```\n\n### Order Endpoints (Client API)\n\n```\nPOST   /order/create                - Create new order (Auth required)\nGET    /order/all                   - Get all member orders (Auth required)\nPOST   /order/update                - Update order status (Auth required)\n```\n\n### Admin Authentication (SSR)\n\n```\nGET    /                            - Admin home/dashboard\nGET    /signup                      - Admin signup page\nPOST   /signup                      - Process admin signup (with image upload)\nGET    /login                       - Admin login page\nPOST   /login                       - Process admin login\nGET    /check-me                    - Check authentication status\nGET    /logout                      - Admin logout\n```\n\n### Admin Product Management (SSR)\n\n```\nGET    /product/all                 - Get all products (Admin auth required)\nPOST   /product/create              - Create new product (Admin auth required, up to 5 images)\nPOST   /product/:id                 - Update product (Admin auth required)\n```\n\n### Admin User Management (SSR)\n\n```\nGET    /user/all                    - Get all users (Admin auth required)\nPOST   /user/edit                   - Update user information (Admin auth required)\n```\n\n## 🚀 Performance Optimizations\n\n### Frontend Optimizations\n\n- Code splitting with React.lazy()\n- Image lazy loading\n- Redux state optimization\n- Memoization with useMemo and useCallback\n- Bundle size optimization with Vite\n\n### Backend Optimizations\n\n- MongoDB indexing for faster queries\n- Request caching\n- Compression middleware\n- Database connection pooling\n- Efficient pagination queries\n\n## 🔒 Security Features\n\n### Authentication \u0026 Authorization\n\n- JWT token-based authentication\n- Bcrypt password hashing\n- Secure cookie configuration\n- Role-based access control\n- Protected admin routes\n\n### Data Protection\n\n- Input validation and sanitization\n- SQL injection prevention\n- XSS protection\n- CSRF protection\n- Rate limiting (planned)\n\n### Best Practices\n\n- Environment variable management\n- Secure HTTP headers\n- CORS configuration\n- Error message sanitization\n- Audit logging\n\n## 🧪 Testing (Planned)\n\n```bash\n# Backend tests\nnpm run test:backend\n\n# Frontend tests\nnpm run test:frontend\n\n# Integration tests\nnpm run test:integration\n\n# E2E tests\nnpm run test:e2e\n```\n\n## 📝 TODO / Future Enhancements\n\n### Frontend\n\n- [ ] Progressive Web App (PWA) support\n- [ ] Dark mode theme\n- [ ] Multi-language support (Korean, English)\n- [ ] Real-time notifications with WebSocket\n\n### Backend\n\n- [ ] GraphQL API implementation\n- [ ] Redis caching layer\n- [ ] Email notification system\n- [ ] SMS notifications\n- [ ] Advanced analytics dashboard\n\n### Features\n\n- [ ] Payment gateway integration\n- [ ] Real-time order tracking with map\n- [ ] Social media authentication\n- [ ] Customer loyalty program enhancements\n- [ ] Restaurant table reservation\n- [ ] Promotional codes and discounts\n- [ ] Review and rating system\n- [ ] Favorites and wish list\n\n## 🤝 Contributing\n\nContributions are welcome! Please follow these steps:\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n### Development Guidelines\n\n#### Frontend\n\n- Follow React and TypeScript best practices\n- Use ESLint and Prettier for code formatting\n- Follow component naming conventions\n- Write meaningful commit messages\n\n#### Backend\n\n- Follow MVC architecture pattern\n- Use TypeScript strict mode\n- Implement proper error handling\n- Document API endpoints\n- Write unit tests for controllers\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 👨‍💻 Author\n\n**Khamzaev Asad**\n\n- GitHub: [@khamzaevasad](https://github.com/khamzaevasad)\n- Email: xamzayevasad442@gmail.com\n\n## 🙏 Acknowledgments\n\n### Frontend\n\n- React and TypeScript communities\n- Redux team for state management solution\n- Tailwind CSS and DaisyUI for beautiful styling\n\n### Backend\n\n- Node.js and Express.js communities\n- MongoDB team for excellent database solution\n- EJS templating engine contributors\n\n### All\n\n- All open-source contributors\n- Stack Overflow community\n- GitHub community\n\n## 📞 Contact \u0026 Support\n\nFor questions, feedback, or support:\n\n- Create an issue on GitHub\n- Email: xamzayevasad442@gmail.com\n\n---\n\n\u003cdiv align=\"center\"\u003e\n  \u003cp\u003eMade with ❤️ and 🍜\u003c/p\u003e\n  \u003cp\u003e먹자! (Let's Eat!) - MOKCHA\u003c/p\u003e\n  \u003cp\u003eFull-Stack Restaurant Ordering Platform\u003c/p\u003e\n  \u003cp\u003e© 2025 MOKCHA. All rights reserved.\u003c/p\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhamzaevasad%2Fmokcha-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhamzaevasad%2Fmokcha-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhamzaevasad%2Fmokcha-service/lists"}