git clone https://github.com/aXenDeveloper/nextjs-cookingfit
npm i
# or
yarn
npm run dev
# or
yarn dev
Use commands:
npm run build
# or
yarn build
npm start
# or
yarn start
See the section about deployment for more information.
- Go to .env.local.example file
- Rename this file to .env.local
- Complete all fields:
MYSQL_HOST=
MYSQL_DATABASE=
MYSQL_USERNAME=
MYSQL_PASSWORD=
MYSQL_PORT=
CSRF_KEY=
JWT_SIGNING_PRIVATE_KEY=
NEXTAUTH_URL=http://localhost:3000
You can generate CSRF_KEY and JWT_SIGNING_PRIVATE_KEY by GUID / UUID Generator.
Packages | Description |
---|---|
nextjs | Core for Single Page Application (SPA) |
next-translate | Translate |
next-auth | Authentication |
next-seo | SEO |
next-connect | The smol method routing and middleware for Next.js |
nextjs-progressbar | Progressbar |
react | Library for Single Page Application (SPA) |
react-query | Fetch, cache and update data |
react-beautiful-dnd | Drag & Drop with Animation |
typescript | Types in JavaScript |
font-awesome | Icons SVG |
sass | CSS Preprocessors |
eslint | Identifying and reporting on patterns found in ECMAScript/JavaScript code |
bcrypt | Hash passwords |
js-cookie | Cookies |
tippyjs | tooltip, popover, dropdown |
slugify | Convert strings |
CKEditor | Wysiwyg editor |
multer | Files upload |
http | Types for server response |
uuid | Generate random UUID |
Code | Description |
---|---|
5C100/1 | (Authenticated) Catch error function (500) |
2C100/2 | (Authenticated) Invalid session (401) |
2C100/3 | (Authenticated) Invalid session - empty user object (401) |
2C100/4 | (Authenticated) Banned user (401) |
5C101/1 | (Sign up) Catch error function (500) |
3C101/2 | (Sign up) Invalid method API (405) |
2C101/3 | (Sign up) Invalid data from body (403) |
1C101/4 | (Sign up) Exist user email (403) |
1C101/5 | (Sign up) You are already logged in (403) |
1C101/6 | (Sign up) Exist user name (403) |
5C102/1 | (Sign in) Error with fetch (500) |
1C102/2 | (Sign in) You are already logged in (403) |
------- | --------------------------------------------------------- |
5R101/1 | (Recipes) Error with fetch (500) |
3R101/2 | (Recipes) Invalid method API (405) |
5R102/1 | (Recipe Item) Error with fetch (500) |
3R102/2 | (Recipe Item) Invalid method API (405) |
3R102/3 | (Recipe Item) Invalid query params (400) |
1R102/4 | (Recipe Item) Not found (404) |
5R103/1 | (Add Recipe) Error with fetch (500) |
3R103/2 | (Add Recipe) Invalid method API (405) |
3R103/3 | (Add Recipe) Invalid query params (400) |
3R103/6 | (Add Recipe) Invalid category (400) |
1R103/7 | (Add Recipe) Access denied (403) |
5R104/1 | (Upload File Recipe) Error with fetch (500) |
3R104/2 | (Upload File Recipe) Invalid method API (405) |
1R104/3 | (Upload File Recipe) Access denied (403) |
5R105/1 | (Edit Recipe) Error with fetch (500) |
3R105/2 | (Edit Recipe) Invalid method API (405) |
3R105/3 | (Edit Recipe) Invalid query params (400) |
3R105/6 | (Edit Recipe) Invalid category (400) |
1R105/7 | (Edit Recipe) Access denied (403) |
1R105/8 | (Edit Recipe) Access denied - invalid member ID (403) |
5R106/1 | (Delete Recipe) Error with fetch (500) |
3R106/2 | (Delete Recipe) Invalid method API (405) |
3R106/3 | (Delete Recipe) Invalid query params (400) |
1R106/4 | (Delete Recipe) Access denied (403) |
------- | --------------------------------------------------------- |
5S107/1 | (Shopping Add) Error with fetch (500) |
3S107/2 | (Shopping Add) Invalid method API (405) |
3S107/3 | (Shopping Add) Invalid query params (400) |
1S107/4 | (Shopping Add) Access denied (403) |
5S108/1 | (Shopping Item) Error with fetch (500) |
3S108/2 | (Shopping Item) Invalid method API (405) |
3S108/3 | (Shopping Item) Invalid query params (400) |
1S108/4 | (Shopping Item) Access denied (403) |
ID | Description |
---|---|
1 | Guest |
2 | Banned |
3 | User |
4 | Administrator |
api/account/signup
- name: string,
- email: string,
- password: string,
- confirmPassword: string
api/recipes
- page?: number,
- limit?: number,
- category?: string
{
id: number;
title: string;
url: string;
name: string;
name_seo: string;
publish_date: number;
difficulty: 1 | 2 | 3;
time: number;
text: string;
category_name: string;
image?: string;
}
api/recipes/item
- id: number,
- category: string
{
id: number;
title: string;
member_id: number;
name: string;
name_seo: string;
publish_date: number;
difficulty: 1 | 2 | 3;
time: number;
text: string;
category_id: number;
category_name: string;
image?: string;
calories?: number;
proteins?: number;
fats?: number;
carbohydrates?: number;
ingredients?: {
id: string;
quantity: number;
unit: string;
name: string;
}[],
serve_count?: number;
}
api/recipes/add
- title: string,
- text: string,
- time: number,
- category_id: _number*,
- author_id: _number*,
- date: number,
- file: number,
- calories: _number*,
- proteins: _number*,
- fats: _number*,
- carbohydrates: _number*,
- ingredients?: _string*,
- serve_count?: _number*
{
result: {
insertId: number;
},
recordURL: string;
url?: string;
}
api/recipes/edit
- id: number
- title: string,
- text: string,
- time: number,
- category_id: _number*,
- author_id: _number*,
- date: number,
- file: number,
- calories: _number*,
- proteins: _number*,
- fats: _number*,
- carbohydrates: _number*,
- ingredients?: _string*,
- serve_count?: _number*
{
result: {
insertId: number;
},
recordURL: string;
url?: string;
}
api/recipes/delete
- id: number
api/shopping
- member__id: number
{
id: number;
member_id: number;
name: string;
quantity: number;
checked: number;
unit?: string;
}
api/shopping/edit
- member__id: number,
- name: string,
- unit?: string,
The Figma project is name: CookingFit.fig