{"id":38751930,"url":"https://github.com/wilsonfsouza/gobarber-rest-api","last_synced_at":"2026-01-17T11:50:28.483Z","repository":{"id":40751219,"uuid":"260801309","full_name":"wilsonfsouza/gobarber-rest-api","owner":"wilsonfsouza","description":"This is the backend REST API made with Node.js, Express, and TypeScript for the GoBarber project. GoBarber is a web application for appointment scheduling designed for barbershops and hair salons.","archived":false,"fork":false,"pushed_at":"2024-03-28T03:09:22.000Z","size":963,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-19T09:56:17.829Z","etag":null,"topics":["aws","docker","express","jest","nodejs","rest-api","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/wilsonfsouza.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}},"created_at":"2020-05-03T00:37:30.000Z","updated_at":"2024-04-19T09:56:17.830Z","dependencies_parsed_at":"2023-01-30T16:15:59.463Z","dependency_job_id":null,"html_url":"https://github.com/wilsonfsouza/gobarber-rest-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wilsonfsouza/gobarber-rest-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonfsouza%2Fgobarber-rest-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonfsouza%2Fgobarber-rest-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonfsouza%2Fgobarber-rest-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonfsouza%2Fgobarber-rest-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wilsonfsouza","download_url":"https://codeload.github.com/wilsonfsouza/gobarber-rest-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonfsouza%2Fgobarber-rest-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28508460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T10:25:30.148Z","status":"ssl_error","status_checked_at":"2026-01-17T10:25:29.718Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["aws","docker","express","jest","nodejs","rest-api","typescript"],"created_at":"2026-01-17T11:50:28.390Z","updated_at":"2026-01-17T11:50:28.470Z","avatar_url":"https://github.com/wilsonfsouza.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"GitHub top language\" src=\"https://img.shields.io/github/languages/top/wilsonfsouza/gobarber-rest-api\"\u003e\n  \u003ca href=\"https://github.com/wilsonfsouza/gobarber-rest-api/commits/master\"\u003e\n    \u003cimg alt=\"GitHub last commit\" src=\"https://img.shields.io/github/last-commit/wilsonfsouza/gobarber-rest-api\"\u003e\n  \u003c/a\u003e\n\n   \u003cimg alt=\"License\" src=\"https://img.shields.io/badge/license-MIT-%23F26C6C\"\u003e\n\n\n  \u003ca href=\"https://www.linkedin.com/in/wilsonfsouza/\"\u003e\n    \u003cimg alt=\"Made by Wilson Franca\" src=\"https://img.shields.io/badge/made%20by-Wilson%20Franca-%230AA186\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003e\n    GoBarber REST API\n\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003e\nTable of Contents\n\u003c/h4\u003e\n\n\u003cp align=\"center\"\u003e\n \u003ca href=\"#-about-the-project\"\u003eAbout\u003c/a\u003e •\n \u003ca href=\"#-how-to-run-the-project\"\u003eHow to run\u003c/a\u003e •\n \u003ca href=\"#-usage\"\u003eUsage\u003c/a\u003e •\n \u003ca href=\"#-tests\"\u003eTests\u003c/a\u003e •\n \u003ca href=\"#-technologies\"\u003eTechnologies\u003c/a\u003e •\n \u003ca href=\"#-author\"\u003eAuthor\u003c/a\u003e •\n \u003ca href=\"#user-content--license\"\u003eLicense\u003c/a\u003e\n\u003c/p\u003e\n\n\n## 💻 About the project\n\nThis is the backend REST API made with Node.js, Express, and TypeScript for the GoBarber project. GoBarber is a web application for appointment scheduling designed for barbershops and hair salons.\n\nBy signing up, users can schedule a new appointment with all available stylists working at the business. On the other hand, registered stylists have access to a web interface to manage their schedules with real-time updates (new or canceled appointments).\n\nTo see the **web client**, click here: [GoBarber Web](https://github.com/wilsonfsouza/gobarber-frontend-web)\u003cbr /\u003e\nTo see the **mobile client**, click here: [GoBarber Mobile](https://github.com/wilsonfsouza/appbarbershop)\n\n---\n\n## 🔥 Preview\n\nDemo credentials:\n\u003cbr /\u003e\n\nacc: peppa@test.com / password: demo-password-peppa\n\u003cbr /\u003e\n\n[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://gobarberweb.wilsonfranca.dev/)\n\n---\n\n## 🚀 [](https://github.com/wilsonfsouza/gobarber-rest-api#how-to-run-the-project)How to run the project\n\n### **Requirements**\n\nInitial requirements:\n[git](https://git-scm.com), [yarn](https://yarnpkg.com/), [docker](https://www.docker.com/), and a code editor of your choice.\n\n### **Install project and dependencies**\n\n```bash\n# Clone this repository\n$ git clone https://github.com/wilsonfsouza/gobarber-rest-api.git\n\n# Access the folder in your terminal\n$ cd gobarber-rest-api\n\n# Install all dependencies\n$ yarn install\n\n# Make a copy of '.env.example' to '.env'\n# and set with YOUR environment variables.\n# The AWS variables do not need to be filled for development environment\n$ cp .env.example .env\n```\n\n### **Setup databases**\nThis project uses three databases:\n- `Postgres`: to store most of the application data (general use)\n- `MongoDB`: to store application's notifications\n- `Redis`: to store the application's cache and rate limit middleware\n\n### Postgres\n```bash\n# Create the instance of postgreSQL using docker\n$ docker run --name postgres -e POSTGRES_USER=postgres \\\n              -e POSTGRES_DB=gostack_gobarber -e POSTGRES_PASSWORD=docker \\\n              -p 5432:5432 -d postgres\n\n# Make a copy of 'ormconfig.example.json'\n# to 'ormconfig.json'\n# and set YOUR default database configuration.\n$ cp ormconfig.example.json ormconfig.json\n\n# Run typeorm migrations\n$ yarn typeorm migration:run\n```\n\u003e If you do not have Postgres installed on your machine, the port 5432 should be available. Otherwise, you can use port 5433 instead. Use -d flag to run your container in detached mode. This mode allows you to start and run your container in the background.\n\n### MongoDB\n```bash\n# Create the instance of mongoDB using docker\n$ docker run --name mongodb -p 27017:27017 -d -t mongo\n\n# Access your ormconfig.json and add\n# YOUR mongo configuration\n\n# How do I know if MongoDB is running? Access localhost:27017 on your browser.\n```\n\n### Redis\n```bash\n# Create the instance of redis using docker\n$ docker run --name gobarber-redis -p 6379:6379 -d -t redis:alpine\n\n# Access your .env file and add your REDIS configuration\n```\n\n\u003e For Windows users using Docker Toolbox, you might need to set the host for your databases on your .env and ormconfig.json files to 192.168.99.100 (docker machine IP) instead of localhost or 127.0.0.1.\n\n### Understanding .env\n\n|key|description|default\n|---|---|---\n|APP_API_URL|Used to mount avatars' urls.|`http://localhost:3333`\n|APP_WEB_URL|Used to create the reset password link (front-end) sent in the recover password email.|`http://localhost:3000`\n|APP_SECRET|An alphanumeric random string. Used to create signed tokens.| -\n|MAIL_DRIVER|Indicate what email service use to send messages, the possible values are `ethereal` and `ses`, to use the [SES](https://aws.amazon.com/ses/) service remember to to configure the `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and `AWS_DEFAULT_REGION` keys.|`ethereal`\n|AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY|These keys are necessary to AWS allow the application to use the S3 and SES services throught API. See how to get yours keys here: [Set up AWS Credentials](https://docs.aws.amazon.com/toolkit-for-eclipse/v1/user-guide/setup-credentials.html).| -\n|AWS_DEFAULT_REGION|You can see your default region in the navigation bar at the top right after login in the [AWS Management Console](https://sa-east-1.console.aws.amazon.com/console/home). Read [AWS service endpoints](https://docs.aws.amazon.com/general/latest/gr/rande.html) to know more about regions.| -\n|STORAGE_DRIVER| Indicate where the users's avatar will be stored, the possible values are `disk` and `s3`, to store into [S3](https://aws.amazon.com/s3/) remember to configure all the `AWS_*` keys. | disk\n|REDIS_HOST|Redis host.|`localhost`\n|REDIS_PORT|Redis port.|`6379`\n|REDIS_PASS|Redis password.| -\n\n\n### Start the application\n```bash\n# To start development server, run:\n$ yarn dev:server\n```\n\n---\n\n## ⭐ Usage\n### **Bearer Token**\nThis app has open and private routes. Private routes expect a **Bearer token** in an `Authorization` header. The token is generated after a user sign in into the application throughout the `/sessions` route. This token will expire after 2 hours.\n\n### **Routes**\n\n### Users\n|Route|HTTP Method|Params|Description|Auth method\n|---|---|---|---|---\n|`/sessions`|POST|Body with user's email and password.|Authenticates user, return a Bearer Token and user's id and email.| ❌\n|`/users`|POST|Body with user's name, email, and password.|Sign up for new users. | ❌\n|`/profile`|GET| - |Shows user profile.|Bearer\n|`/profile`|PUT|Body with user `name`, `email`, `old_password`, `password`, and `password_confirmation`.|Updates user information.|Bearer\n|`/users/avatar`|PATCH|Multipart payload with a `avatar` field with a image.|Update user avatar.|Bearer\n|`/password/forgot`|POST|Body with user's `email`.|Sends to user the reset password email.| ❌\n|`/password/reset`|POST|Body with user's new `password` and `password_confirmation`.|Resets user's password.| ❌\n\n### Appointments\n|Route|HTTP Method|Params|Description|Auth method\n|---|---|---|---|---\n|`/appointments`|POST|Body with appointment `provider_id` and `date`.|Schedules a new appointment.|Bearer\n|`/appointments/me`|GET|`day`, `month` and `year` query parameters.|Returns user's scheduled appointments in a specific date.|Bearer\n|`/providers`|GET|`page` query parameter.|Lists providers.|Bearer\n|`/providers/:id/monthly-availability`|GET|`month` and `year` query parameters.|Lists provider's monthly availability|Bearer\n|`/providers/:id/daily-availability`|GET|`day`, `month` and `year` query parameters.|Lists provider's daily availability for a given day.|Bearer\n\n---\n\n## ⚙️ Tests\n```bash\n# Running tests\n$ yarn test\n\n# Generating test coverage\n$ yarn test --coverage\n```\n---\n\n## 🛠 Technologies\n\nThe following tools were used in this project:\n\n### **REST  API**  ([Node.js](https://nodejs.org/en/)  +  [TypeScript](https://www.typescriptlang.org/))\n\n- [Node.js](https://nodejs.org/en/)\n- [TypeScript](https://www.typescriptlang.org/)\n- [Express](https://expressjs.com/pt-br/)\n- [Docker](https://www.docker.com/)\n- [JWT-token](https://jwt.io/)\n- [Uuid v4](https://github.com/thenativeweb/uuidv4/)\n- [Multer](https://github.com/expressjs/multer)\n- [AWS SDK](https://aws.amazon.com/getting-started/tools-sdks/)\n- [TypeORM](https://typeorm.io/#/)\n- [PostgreSQL](https://www.postgresql.org/)\n- [MongoDB](https://www.mongodb.com/)\n- [Redis / ioredis](https://github.com/luin/ioredis)\n- [Date-fns](https://date-fns.org/)\n- [Nodemailer](https://nodemailer.com/about/)\n- [Jest](https://jestjs.io/)\n- [ESLint](https://eslint.org/)\n- [Prettier](https://prettier.io/)\n- [EditorConfig](https://editorconfig.org/)\n\n\u003e See the file  [package.json](https://github.com/wilsonfsouza/gobarber-rest-api/blob/master/package.json)\n\n### [](https://github.com/wilsonfsouza/gobarber-rest-api#utilities)**Utilities**\n\n-   Editor:  [Visual Studio Code](https://code.visualstudio.com/)\n-   Markdown: [Markdown Emoji](https://gist.github.com/rxaviers/7360908)\n\n---\n\n## 💪 How to contribute to this project\n\n1. **Fork** the project.\n2. Start a new branch with your changes: `git checkout -b my-new-feature`\n3. Save it and create a commit message describing what you have done: `git commit -m \"feature: My new feature\"`\n4. Send your alterations: `git push origin my-feature`\n\n\n---\n\n## 👨‍💻 Author\n\n\u003cbr/\u003e\n\u003ch3 style=\"display: flex; align-items: center; justify-content: flex-start;\"\u003e\n \u003cimg style=\"border-radius: 50%; margin-right: 20px; width: 80px;\" src=\"https://avatars0.githubusercontent.com/u/21347383?s=460\u0026u=fdb399c92e369762d45d6495cbd2e87eef9e4d65\u0026v=4\" width=\"100px;\" alt=\"\"/\u003e\n \u003cbr /\u003e\n \u003csub\u003eWilson Franca\u003c/sub\u003e\u003c/h3\u003e\n \u003cbr /\u003e\n\n[![Linkedin Badge](https://img.shields.io/badge/-Wilson-blue?style=flat-square\u0026logo=Linkedin\u0026logoColor=white\u0026link=https://www.linkedin.com/in/wilsonfsouza/)](https://www.linkedin.com/in/wilsonfsouza/)\n[![Gmail Badge](https://img.shields.io/badge/-wilson.franca.92@gmail.com-c14438?style=flat-square\u0026logo=Gmail\u0026logoColor=white\u0026link=mailto:wilson.franca.92@gmail.com)](mailto:wilson.franca.92@gmail.com)\n\n---\n\n## 📝 License\n\nThis project is being developed under [MIT License](./LICENSE).\n\nMade with ❤️ by Wilson Franca 👋\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilsonfsouza%2Fgobarber-rest-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilsonfsouza%2Fgobarber-rest-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilsonfsouza%2Fgobarber-rest-api/lists"}