{"id":24665875,"url":"https://github.com/rafaelmoraes003/node-futebol-clube","last_synced_at":"2026-04-12T03:35:41.779Z","repository":{"id":132548182,"uuid":"545711758","full_name":"rafaelmoraes003/node-futebol-clube","owner":"rafaelmoraes003","description":"API that provides information about teams, matches and leaderboards in a soccer league.","archived":false,"fork":false,"pushed_at":"2023-02-14T02:52:04.000Z","size":780,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-10T04:04:29.845Z","etag":null,"topics":["chai","docker","docker-compose","express","integration-testing","mocha","mysql","nodejs","oop","sequelize","sinon","solid-principles","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rafaelmoraes003.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2022-10-04T21:13:37.000Z","updated_at":"2023-02-05T01:28:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"aa73f1e5-6230-4db0-ac7a-a55ca378901b","html_url":"https://github.com/rafaelmoraes003/node-futebol-clube","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rafaelmoraes003/node-futebol-clube","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafaelmoraes003%2Fnode-futebol-clube","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafaelmoraes003%2Fnode-futebol-clube/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafaelmoraes003%2Fnode-futebol-clube/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafaelmoraes003%2Fnode-futebol-clube/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rafaelmoraes003","download_url":"https://codeload.github.com/rafaelmoraes003/node-futebol-clube/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafaelmoraes003%2Fnode-futebol-clube/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31703501,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T21:17:31.016Z","status":"online","status_checked_at":"2026-04-12T02:00:06.763Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["chai","docker","docker-compose","express","integration-testing","mocha","mysql","nodejs","oop","sequelize","sinon","solid-principles","typescript"],"created_at":"2025-01-26T07:13:58.210Z","updated_at":"2026-04-12T03:35:41.771Z","avatar_url":"https://github.com/rafaelmoraes003.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node Futebol Clube (Back-End)\n\nThe Node Futebol Clube project aimed to develop an API that provides information about teams, matches and leaderboards in a soccer championship.\n\nIn this project, a dockerized back-end was built using data modeling through Sequelize in an MSC structure that respected the business rules of an already structured front-end.\n\nIn the API, it is possible to see data about users, teams, matches (all matches, ongoing matches and/or finished matches) and scores (overall score, home team and/or away team score). In addition, it is possible to create and update matches and users.\n\nThe project was made using TypeScript, Node.js, Express, MySQL, Sequelize and Docker, all applied to object-oriented programming and following the principles of SOLID. What's more, the integration tests done with Mocha, Chai and Sinon have +99% coverage of the entire project. \n\n###\n\n\u003ch2 align=\"left\"\u003eTechnologies used\u003c/h2\u003e\n\n###\n\n\u003cdiv align=\"left\"\u003e\n  \u003cimg src=\"https://cdn.jsdelivr.net/gh/devicons/devicon/icons/typescript/typescript-original.svg\" height=\"50\" width=\"62\" alt=\"typescript logo\"  /\u003e\n  \u003cimg src=\"https://cdn.jsdelivr.net/gh/devicons/devicon/icons/nodejs/nodejs-original.svg\" height=\"50\" width=\"62\"\" alt=\"nodejs logo\"  /\u003e\n  \u003cimg src=\"https://cdn.jsdelivr.net/gh/devicons/devicon/icons/express/express-original.svg\"height=\"50\" width=\"62\" alt=\"express logo\"  /\u003e\n  \u003cimg src=\"https://cdn.jsdelivr.net/gh/devicons/devicon/icons/mysql/mysql-original.svg\" height=\"50\" width=\"62\" alt=\"mysql logo\"  /\u003e\n  \u003cimg src=\"https://cdn.jsdelivr.net/gh/devicons/devicon/icons/sequelize/sequelize-original.svg\" height=\"50\" width=\"62\" alt=\"sequelize logo\"  /\u003e\n  \u003cimg src=\"https://cdn.jsdelivr.net/gh/devicons/devicon/icons/docker/docker-original.svg\" height=\"50\" width=\"62\" alt=\"docker logo\"  /\u003e\n  \u003cimg src=\"https://cdn.jsdelivr.net/gh/devicons/devicon/icons/mocha/mocha-plain.svg\" height=\"50\" width=\"62\" alt=\"mocha logo\"  /\u003e\n\u003c/div\u003e\n\n###\n\n\n\u003ch2 align=\"left\"\u003eHow to use the application\u003c/h2\u003e\n\n###\n\nClone the application using the `git clone` command. After that, enter the project folder using the `cd node-futebol-clube` command.\n\n###\n\n\u003ch2 align=\"left\"\u003eRequired settings\u003c/h2\u003e\n\n- `node` from version `16.14.0 LTS` \n- `docker-compose` from version `1.29.2`\n\n###\n\n\u003ch2 align=\"left\"\u003eRunning the application with Docker\u003c/h2\u003e\n\n###\n\nIn the root folder of the project, use the `npm run compose:up` command. The Front-End will be located on port `3000`, the Back-End on port `3001` and the database (MySQL) on port `3002`.\n\n###\n\n\u003ch2 align=\"left\"\u003eIntegration tests\u003c/h2\u003e\n\n###\n\nIn the folder `/app/backend`, to run the integration tests, use the `npm test` command. To check test coverage, use the `npm run test:coverage` command.\n\n###\n\n\u003ch2 align=\"left\"\u003eEndpoints\u003c/h2\u003e\n\n\u003ch3 align=\"left\"\u003eLogin\u003c/h3\u003e\n\n| Method | Functionality | URL |\n|---|---|---|\n| `POST` | Login | http://localhost:3001/login |\n| `GET` |  Receives a header with authorization parameter, where the token generated at login will be stored and returns the type of user  | http://localhost:3001/login/validate |\n\nIn the `POST` request, it is necessary to inform the following JSON:\n\n```JavaScript\n{\n  email: \"admin@admin.com\",\n  password: \"secret_admin\"\n}\n```\n\n\u003ch3 align=\"left\"\u003eTeams\u003c/h3\u003e\n\n| Method | Functionality | URL |\n|---|---|---|\n| `GET` | List all league teams | http://localhost:3001/teams |\n| `GET` | List a team based on its id | http://localhost:3001/teams/:id |\n\n\n\u003ch3 align=\"left\"\u003eMatches\u003c/h3\u003e\n\n| Method | Functionality | URL |\n|---|---|---|\n| `GET` | List all league matches | http://localhost:3001/matches |\n| `POST` | Create new match | http://localhost:3001/matches |\n| `PATCH` | Updates a match in progress based on its id | http://localhost:3001/matches/:id |\n| `PATCH` | Finish an ongoing match based on your id | http://localhost:3001/matches/:id/finish |\n\nIn the `GET` request, it is possible to filter by matches in progress and finished matches through the query string:\n\n```\nhttp://localhost:3001/matches?inProgress=true\nhttp://localhost:3001/matches?inProgress=false\n```\n###\n\nIn the `POST` request, it is necessary to pass a JSON in the following format:\n\n```JavaScript\n{\n  homeTeam: 16, // The value must be the team id\n  awayTeam: 8, // The value must be the team id\n  homeTeamGoals: 2,\n  awayTeamGoals: 2,\n  inProgress: true // The property is optional, but if passed it MUST have the value true\n}\n```\n\n`OBS`: It is necessary to login and put the token received as a header authorization parameter to be able to create a match.\n\n###\n\nIn the `PATCH` request, it is necessary to pass a JSON in the following format:\n\n```JavaScript\n{\n  homeTeamGoals: 3,\n  awayTeamGoals: 1\n}\n```\n\n\n\u003ch3 align=\"left\"\u003eLeaderboard\u003c/h3\u003e\n\n| Method | Functionality | URL |\n|---|---|---|\n| `GET` | Lists team rankings based on all their games played | http://localhost:3001/leaderboard |\n| `GET` | List rankings of home teams | http://localhost:3001/leaderboard/home |\n| `GET` | List rankings of visiting teams | http://localhost:3001/leaderboard/away |\n                \n###\n                \n\u003ch2 align=\"left\"\u003eConsiderations\u003c/h2\u003e\n                              \n###\n                \nIt is important to point out that ONLY the Back-End of the application was developed by me. The Front-End has already been structured and developed by the Trybe team.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frafaelmoraes003%2Fnode-futebol-clube","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frafaelmoraes003%2Fnode-futebol-clube","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frafaelmoraes003%2Fnode-futebol-clube/lists"}