|
1 | | -# This is used for only deployment purposed to see the main code use this link https://github.com/Ninjas-Code-official/Marketplace-Food-Delivery-Solution |
| 1 | +# Restaurant Delivery Management System |
| 2 | + |
| 3 | +This project is a Restaurant Delivery Management System built with modern web technologies. |
| 4 | + |
| 5 | +## Technologies Used |
| 6 | + |
| 7 | +- **Next.js 14** |
| 8 | +- **TypeScript** |
| 9 | +- **UI Libraries**: Next UI, Chakra UI, or Prime React |
| 10 | +- **React Icons** (if required) |
| 11 | +- **Tailwind CSS** |
| 12 | +- **Cypress** for: |
| 13 | + - Component Testing |
| 14 | + - Integration Testing |
| 15 | + - E2E Testing |
| 16 | + |
| 17 | +## Build Size and Performance |
| 18 | + |
| 19 | +- **Page Size**: Must be between 150KB. |
| 20 | +- **Critical JS and CSS**: Must be below 100KB. |
| 21 | +- **Bundle Analysis**: Use `webpack-bundle-analyzer` as a dev dependency to analyze the bundle. |
| 22 | +- **Dynamic Imports**: Use dynamic imports in Next.js. |
| 23 | +- **Image Optimization**: Use the `<Image/>` tag of Next.js. |
| 24 | + |
| 25 | +### Performance Metrics |
| 26 | + |
| 27 | +The app must follow the standard render times as follows: |
| 28 | + |
| 29 | +- **First Contentful Paint (FCP)**: Under 1.8 seconds |
| 30 | +- **Largest Contentful Paint (LCP)**: Under 2.5 seconds |
| 31 | +- **First Input Delay (FID)**: Under 100 milliseconds |
| 32 | +- **Time to Interactive (TTI)**: Under 5 seconds |
| 33 | +- **Total Blocking Time (TBT)**: Under 300 milliseconds |
| 34 | +- **Cumulative Layout Shift (CLS)**: Under 0.1 |
| 35 | +- **Speed Index (SI)**: Under 4.3 seconds |
| 36 | +- **Time to First Byte (TTFB)**: Under 600 milliseconds |
| 37 | +- **First Meaningful Paint (FMP)**: Under 2.5 seconds |
| 38 | + |
| 39 | +Use the browser's Lighthouse tool for performance reports. |
| 40 | + |
| 41 | +## Folder Structure |
| 42 | + |
| 43 | +### `app` Folder |
| 44 | + |
| 45 | +- Contains only routes and layouts. |
| 46 | + |
| 47 | +### `cypress` Folder |
| 48 | + |
| 49 | +- Contains only test cases |
| 50 | + |
| 51 | +### `lib` Folder |
| 52 | + |
| 53 | +- **hooks Folder**: Custom hooks (e.g., `useAuth`, `useConfiguration`). |
| 54 | +- **hoc Folder**: Higher-order components (e.g., `Route Protection HOC`, `Data Refresh HOC`). |
| 55 | +- **services Folder**: Services for different flows, third-party API calls (e.g. `Apollo`, `Geolocation API`). |
| 56 | + - create separate sub-folders. |
| 57 | +- **ui Folder**: Reusable components, layouts, and screens. |
| 58 | +- **utils Folder**: |
| 59 | + - **methods Folder**: Utility methods (e.g. string manipulation). |
| 60 | + - **interfaces Folder**: TypeScript interfaces (prefixed with "I"). |
| 61 | + - **constants Folder**: Common constants (strings, headers). |
| 62 | + - **types Folder**: Custom TypeScript types, if necessary. |
| 63 | + |
| 64 | +## Component Guidelines |
| 65 | + |
| 66 | +- Divide complex components into sub-components (e.g., header, body, footer). |
| 67 | +- Recommended code lines per component: `100-200 lines`. |
| 68 | + |
| 69 | +## Changelog |
| 70 | + |
| 71 | +- Log code changes in the `CHANGELOG.md` file. |
| 72 | +- Only log merges/pushes to develop/staging/production branches. |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +```plaintext |
| 77 | +
|
| 78 | +├── .husky |
| 79 | +│ └── git hooks |
| 80 | +├── .vscode |
| 81 | +│ └── IDE configuration |
| 82 | +├── dist |
| 83 | +│ └── built and minifed app. |
| 84 | +├── .npmrc |
| 85 | +│ └── npm configuration |
| 86 | +├── .nvmrc |
| 87 | +│ └── nvm configuration |
| 88 | +├── cypress.config.ts |
| 89 | +│ └── cypress configuration |
| 90 | +├── app |
| 91 | +│ └── routes |
| 92 | +│ └── layouts |
| 93 | +├── lib |
| 94 | +│ ├── hooks |
| 95 | +│ │ ├── useAuth.ts |
| 96 | +│ │ ├── useConfiguration.ts |
| 97 | +│ │ └── index.ts |
| 98 | +│ ├── hoc |
| 99 | +│ │ ├── withRouteProtection.ts |
| 100 | +│ │ └── withDataRefresh.ts |
| 101 | +│ │ |
| 102 | +│ ├── services |
| 103 | +│ │ ├── support |
| 104 | +│ │ │ ├── support.service.ts |
| 105 | +│ │ │ └── index.ts |
| 106 | +│ │ └── index.ts |
| 107 | +│ ├── ui |
| 108 | +│ │ ├── components |
| 109 | +│ │ ├── layouts |
| 110 | +│ │ └── screens |
| 111 | +| ├── utils |
| 112 | +| │ ├── methods |
| 113 | +| | | | ├── string |
| 114 | +| │ │ | | ├── sort.ts |
| 115 | +| │ │ | | ├── toSentenceCase.ts |
| 116 | +| │ │ | | ├── index.ts |
| 117 | +| | | | ├── regex |
| 118 | +| │ │ | | ├── email.ts |
| 119 | +| │ │ | | ├── password.ts |
| 120 | +| │ │ | | ├── url.ts |
| 121 | +| │ │ | | ├── index.ts |
| 122 | +| | | | └── index. ts |
| 123 | +| │ ├── interfaces |
| 124 | +| │ │ ├── common |
| 125 | +| │ │ │ ├── IParent.ts |
| 126 | +| │ │ │ └── index.ts |
| 127 | +| │ │ ├── support.interface (sub-folders if required and index.ts for each) |
| 128 | +| │ │ └── index.ts |
| 129 | +| │ ├── constants |
| 130 | +| │ │ ├── strings |
| 131 | +| │ │ │ ├── global.strings.ts |
| 132 | +| │ │ │ └── support.strings (sub-folders if required and index.ts for each) |
| 133 | +| | | | └── index.ts (export all above) |
| 134 | +| │ │ ├── headers |
| 135 | +| │ │ │ ├── global.headers.ts |
| 136 | +| │ │ │ └── support.headers (sub-folders if required and index.ts for each) |
| 137 | +| | | | └── index.ts (export all above) |
| 138 | +| │ │ └── index.ts |
| 139 | +| │ ├── types (same as interfaces) |
| 140 | +| │ │ └── index.ts |
| 141 | +├── CHANGELOG.md |
| 142 | +├── tsconfig.json |
| 143 | +├── next.config.js |
| 144 | +├── package.json |
| 145 | +└── README.md |
| 146 | +``` |
| 147 | + |
| 148 | +### Git |
| 149 | + |
| 150 | +- **Commit Predefined Types**: |
| 151 | + - build |
| 152 | + - fix |
| 153 | + - refactor |
| 154 | + - revert |
| 155 | + - style |
| 156 | + - test |
| 157 | + - translation |
| 158 | + - security |
| 159 | + - changeset |
| 160 | + - config |
| 161 | + |
| 162 | +### Note |
| 163 | + |
| 164 | +- Under constant modifications. |
0 commit comments