{"id":23865145,"url":"https://github.com/mariosantosdev/fitmanager-server","last_synced_at":"2025-02-22T13:39:45.512Z","repository":{"id":45281429,"uuid":"291154704","full_name":"mariosantosdev/FitManager-server","owner":"mariosantosdev","description":"REST API built with NodeJS, TypeScript, Express to the app FitManager","archived":false,"fork":false,"pushed_at":"2021-12-24T15:26:05.000Z","size":441,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-03T08:47:55.728Z","etag":null,"topics":["bcryptjs","cors","dayjs","docker-compose","express","fit","fitness","fitness-app","jsonwebtoken","nodejs","nodemailer","postgresql","prisma","typescript"],"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/mariosantosdev.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}},"created_at":"2020-08-28T22:06:08.000Z","updated_at":"2024-11-19T18:32:02.000Z","dependencies_parsed_at":"2022-09-22T19:20:48.385Z","dependency_job_id":null,"html_url":"https://github.com/mariosantosdev/FitManager-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariosantosdev%2FFitManager-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariosantosdev%2FFitManager-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariosantosdev%2FFitManager-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariosantosdev%2FFitManager-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mariosantosdev","download_url":"https://codeload.github.com/mariosantosdev/FitManager-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240181803,"owners_count":19761129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["bcryptjs","cors","dayjs","docker-compose","express","fit","fitness","fitness-app","jsonwebtoken","nodejs","nodemailer","postgresql","prisma","typescript"],"created_at":"2025-01-03T08:47:44.819Z","updated_at":"2025-02-22T13:39:45.483Z","avatar_url":"https://github.com/mariosantosdev.png","language":"TypeScript","readme":"# FitManager Server\n\nREST API built with NodeJS, Express and Knex to the app FitManager.\nThis project is part of my portfolio, I'll accept suggestions and criticism.\nYou can use this project as you wish!\n\n## Getting Started\n\n### Prerequisites\n\nThis project was built with NodeJS 14.6, I recommend you use this version or similar.\n\n### Installing\n\n**Clone the repo**\n\n```\n$ git clone https://github.com/nvrsantos/FitManager-server.git\n$ cd fitManager-server\n```\n\n**Installing dependencies**\n\n```\n$ yarn\n```\n\n_or_\n\n```\n$ npm install\n```\n\n**Set settings**\n\n1.  Change name of file `template_env` to `.env`\n2.  Replace `\u003cSECRET_KEY\u003e` for your of key (anything), change `\u003cUSER_DB\u003e` and `\u003cPASSWORD_DB\u003e` for credentials of connection of mongodb collection and end chance `\u003cEMAIL\u003e` and `\u003cPASSWORD_EMAIL\u003e` for credentials login of your service of email\n\n### Running project\n\nIn the environment of development execute\n\n```\n$ yarn dev\n```\n\n_or_\n\n```\n$ npm run dev\n```\n\nIn the environment production execute\n\n```\n$ yarn start\n```\n\n_or_\n\n```\n$ npm run start\n```\n\n## Routes\n\n#### Signin Route\n\n- **This is the route that you can use to signin**\n  \u003e http://localhost:3000/signin\n\n| ENDPOINT | Method | Body                      | URL Params | Success Response                                                                           | Server Error Response                                                                              |\n| -------- | ------ | ------------------------- | ---------- | ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- |\n| /        | `POST` | `{ \u003cemail\u003e, \u003cpassword\u003e }` | -          | **Code:** 200 - OK\u003cbr /\u003e**Content:** `{ user: {\u003cemail\u003e, \u003cpassword\u003e}, token: \u003cToken JWT\u003e }` | **Code:** 500 _or_ 400 \u003cbr /\u003e**Content:** `{ error: \u003cA Message with a description of the Error\u003e }` |\n\n#### Signup Route\n\n- **This is the route that you can use to create a new user**\n  \u003e http://localhost:3000/signup\n\n| ENDPOINT | Method | Body                              | URL Params | Success Response                                                      | Server Error Response                                                                              |\n| -------- | ------ | --------------------------------- | ---------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |\n| /        | `POST` | `{ \u003cname\u003e, \u003cemail\u003e, \u003cpassword\u003e }` | -          | **Code:** 200 - OK\u003cbr /\u003e**Content:** `{message: \u003cA Message Success\u003e}` | **Code:** 500 _or_ 400 \u003cbr /\u003e**Content:** `{ error: \u003cA Message with a description of the Error\u003e }` |\n\n#### Forgot Password Route\n\n- **This is the route that you can use to generate a new password and send to your email**\n  \u003e http://localhost:3000/forgot\n\n| ENDPOINT | Method | Body          | URL Params | Success Response                                                      | Server Error Response                                                                              |\n| -------- | ------ | ------------- | ---------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |\n| /        | `POST` | `{ \u003cemail\u003e }` | -          | **Code:** 200 - OK\u003cbr /\u003e**Content:** `{message: \u003cA Message Success\u003e}` | **Code:** 500 _or_ 400 \u003cbr /\u003e**Content:** `{ error: \u003cA Message with a description of the Error\u003e }` |\n\n#### User Route\n\n\u003e http://localhost:3000/user\n\n| ENDPOINT | Method   | Body                   | URL Params | Success Response                                                                                       | Server Error Response                                                                              |\n| -------- | -------- | ---------------------- | ---------- | ------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- |\n| /        | `GET`    | -                      | -          | **Code:** 200 - OK\u003cbr /\u003e**Content:** `{ user: {\u003cid\u003e, \u003cname\u003e, \u003cemail\u003e, \u003cavatar\u003e}, token: \u003cToken JWT\u003e }` | **Code:** 500 _or_ 400 \u003cbr /\u003e**Content:** `{ error: \u003cA Message with a description of the Error\u003e }` |\n| /info    | `GET`    | -                      | -          | **Code:** 200 - OK\u003cbr /\u003e**Content:** `{\u003cweight\u003e, \u003cheight\u003e, \u003cIMC\u003e}`                                     | **Code:** 500 _or_ 400 \u003cbr /\u003e**Content:** `{ error: \u003cA Message with a description of the Error\u003e }` |\n| /        | `PUT`    | `{\u003cFields to update\u003e}` | -          | **Code:** 200 - OK\u003cbr /\u003e**Content:** `{ message: \u003cA Message of success\u003e, token: \u003cToken JWT\u003e }`         | **Code:** 500 _or_ 400 \u003cbr /\u003e**Content:** `{ error: \u003cA Message with a description of the Error\u003e }` |\n| /        | `DELETE` | -                      | -          | **Code:** 200 - OK\u003cbr /\u003e**Content:** `{ message: \u003cA Message of success\u003e }`                             | **Code:** 500 _or_ 400 \u003cbr /\u003e**Content:** `{ error: \u003cA Message with a description of the Error\u003e }` |\n\n#### Update Password Route\n\n- **This is the route that you can update your password**\n  \u003e http://localhost:3000/user/password\n\n| ENDPOINT | Method | Body                            | URL Params | Success Response                                                                           | Server Error Response                                                                              |\n| -------- | ------ | ------------------------------- | ---------- | ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- |\n| /        | `PUT`  | `{ \u003cpassword\u003e, \u003cnewPassword\u003e }` | -          | **Code:** 200 - OK\u003cbr /\u003e**Content:** `{ user: {\u003cemail\u003e, \u003cpassword\u003e}, token: \u003cToken JWT\u003e }` | **Code:** 500 _or_ 400 \u003cbr /\u003e**Content:** `{ error: \u003cA Message with a description of the Error\u003e }` |\n\n#### Weight Route\n\n\u003e http://localhost:3000/weight\n\n| ENDPOINT | Method   | Body                | URL Params | Success Response                                                                                 | Server Error Response                                                                              |\n| -------- | -------- | ------------------- | ---------- | ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- |\n| /        | `GET`    | -                   | -          | **Code:** 200 - OK\u003cbr /\u003e**Content:** `[ {\u003cid\u003e, \u003ctitle\u003e, \u003cdate\u003e}, {\u003cid\u003e, \u003ctitle\u003e, \u003cdate\u003e}, ... ]` | **Code:** 500 _or_ 400 \u003cbr /\u003e**Content:** `{ error: \u003cA Message with a description of the Error\u003e }` |\n| /        | `POST`   | `{\u003ctitle\u003e, \u003cdate\u003e}` | -          | **Code:** 200 - OK\u003cbr /\u003e**Content:** `{ message: \u003cA Message of success\u003e }`                       | **Code:** 500 _or_ 400 \u003cbr /\u003e**Content:** `{ error: \u003cA Message with a description of the Error\u003e }` |\n| /        | `DELETE` | -                   | id         | **Code:** 200 - OK\u003cbr /\u003e**Content:** `{ message: \u003cA Message of success\u003e }`                       | **Code:** 500 _or_ 400 \u003cbr /\u003e**Content:** `{ error: \u003cA Message with a description of the Error\u003e }` |\n\n#### Exercise Route\n\n\u003e http://localhost:3000/exercise\n\n| ENDPOINT | Method   | Body                                                   | URL Params | Success Response                                                                                     | Server Error Response                                                                              |\n| -------- | -------- | ------------------------------------------------------ | ---------- | ---------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |\n| /        | `GET`    | -                                                      | -          | **Code:** 200 - OK\u003cbr /\u003e**Content:** `[ {\u003cid\u003e, \u003ctitle\u003e, \u003cday_of_week\u003e, \u003cloop\u003e, \u003cdelay_time\u003e}, ... ]` | **Code:** 500 _or_ 400 \u003cbr /\u003e**Content:** `{ error: \u003cA Message with a description of the Error\u003e }` |\n| /        | `POST`   | `{\u003cid\u003e, \u003ctitle\u003e, \u003cday_of_week\u003e, \u003cloop\u003e, \u003cdelay_time\u003e}` | -          | **Code:** 200 - OK\u003cbr /\u003e**Content:** `{ message: \u003cA Message of success\u003e }`                           | **Code:** 500 _or_ 400 \u003cbr /\u003e**Content:** `{ error: \u003cA Message with a description of the Error\u003e }` |\n| /        | `DELETE` | -                                                      | id         | **Code:** 200 - OK\u003cbr /\u003e**Content:** `{ message: \u003cA Message of success\u003e }`                           | **Code:** 500 _or_ 400 \u003cbr /\u003e**Content:** `{ error: \u003cA Message with a description of the Error\u003e }` |\n\n#### Height Route\n\n\u003e http://localhost:3000/height\n\n| ENDPOINT | Method   | Body                | URL Params | Success Response                                                                                 | Server Error Response                                                                              |\n| -------- | -------- | ------------------- | ---------- | ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- |\n| /        | `GET`    | -                   | -          | **Code:** 200 - OK\u003cbr /\u003e**Content:** `[ {\u003cid\u003e, \u003ctitle\u003e, \u003cdate\u003e}, {\u003cid\u003e, \u003ctitle\u003e, \u003cdate\u003e}, ... ]` | **Code:** 500 _or_ 400 \u003cbr /\u003e**Content:** `{ error: \u003cA Message with a description of the Error\u003e }` |\n| /        | `POST`   | `{\u003ctitle\u003e, \u003cdate\u003e}` | -          | **Code:** 200 - OK\u003cbr /\u003e**Content:** `{ message: \u003cA Message of success\u003e }`                       | **Code:** 500 _or_ 400 \u003cbr /\u003e**Content:** `{ error: \u003cA Message with a description of the Error\u003e }` |\n| /        | `DELETE` | -                   | id         | **Code:** 200 - OK\u003cbr /\u003e**Content:** `{ message: \u003cA Message of success\u003e }`                       | **Code:** 500 _or_ 400 \u003cbr /\u003e**Content:** `{ error: \u003cA Message with a description of the Error\u003e }` |\n\n#### Logs Route\n\n\u003e http://localhost:3000/logs\n\n| ENDPOINT | Method | Body | URL Params | Success Response                                  | Server Error Response                                                                              |\n| -------- | ------ | ---- | ---------- | ------------------------------------------------- | -------------------------------------------------------------------------------------------------- |\n| /error   | `GET`  | -    | -          | **Code:** 200 - OK\u003cbr /\u003e**Content:** `\u003clog file\u003e` | **Code:** 500 _or_ 400 \u003cbr /\u003e**Content:** `{ error: \u003cA Message with a description of the Error\u003e }` |\n| /info    | `GET`  | -    | -          | **Code:** 200 - OK\u003cbr /\u003e**Content:** `\u003clog file\u003e` | **Code:** 500 _or_ 400 \u003cbr /\u003e**Content:** `{ error: \u003cA Message with a description of the Error\u003e }` |\n| /debug   | `GET`  | -    | -          | **Code:** 200 - OK\u003cbr /\u003e**Content:** `\u003clog file\u003e` | **Code:** 500 _or_ 400 \u003cbr /\u003e**Content:** `{ error: \u003cA Message with a description of the Error\u003e }` |\n\n## Database Models\n\n### User\n\n- Id - `[Integer]`\n- Name - `[String]`\n- Email - `[String]`\n- Password - `[String]`\n- Exercises - `[Exercise]`\n- Weight - `[Weight]`\n- Height - `[Height]`\n\n### Weight\n\n- Id - `[Integer]`\n- Title - `[String]`\n- Date - `[String]`\n- User_ID - `[Integer]`\n\n### Height\n\n- Id - `[Integer]`\n- Title - `[String]`\n- Date - `[String]`\n- User_ID - `[Integer]`\n\n### Exercise\n\n- Id - `[Integer]`\n- Title - `[String]`\n- Day_of_week - `[String]`\n- Loop - `[String]`\n- Delay_time - `[String]`\n- User_ID - `[Integer]`\n\n### Backup\n\n- Id - `[Integer]`\n- Data - `[Longtext]`\n- User_ID - `[Integer]`\n\n### Refresh Token\n\n- Id - `[Integer]`\n- Expires_in - `[Integer]`\n- User_ID - `[Integer]`\n\n## TODO Functions\n\n### User Routes\n\n- [x] - SignUp\n- [x] - SignIn\n- [x] - Forgot Password\n- [x] - Update User\n- [x] - Update Password\n- [ ] - Generate backup\n- [ ] - Restore backup\n\n### App Routes\n\n- [x] Create New Weight\n- [x] Delete Weight\n- [x] List Weight\n- [x] Create New Height\n- [x] Delete Height\n- [x] List Height\n- [x] Create New Exercise\n- [x] Delete Exercise\n- [x] List Exercise\n- [x] List End Weight, End Height\n- [x] Edit Profile\n- [x] Calculate IMC\n\n## Built With\n\n- [NodeJS](https://nodejs.org/en/) - Build the project\n- [TypeScript](https://www.typescriptlang.org/) - Language that Build the project\n- [express](https://expressjs.com/) - Router of the Application\n- [bcryptjs](https://github.com/dcodeIO/bcrypt.js) - Module for encode the password in a hash\n- [cors](https://github.com/expressjs/cors) - Middleware for provide connection\n- [jsonwebtoken](https://github.com/auth0/node-jsonwebtoken) - Encode and Decode JWT\n- [dayJS](https://day.js.org/) - Parsing, validating, manipulating, and formatting dates\n- [nodemailer](https://nodemailer.com/) - Module for send email\n- [prisma](https://prisma.io) - Database ORM\n- [postgresql](https://www.postgresql.org/) - Database\n- [docker-compose](https://docs.docker.com/compose/) - DevOps Database virtual environment\n\n## Thanks\n\nThis README was based in [README](https://github.com/steniowagner/mindcast-server/blob/master/README.md)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmariosantosdev%2Ffitmanager-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmariosantosdev%2Ffitmanager-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmariosantosdev%2Ffitmanager-server/lists"}