https://github.com/larissaperinoto/trybesmith-api
The TrybeSmith API consists of a management interface for a medieval products store and was developed using TypeScript.
https://github.com/larissaperinoto/trybesmith-api
docker docker-compose express joi jwt msc mysql nodejs nodemon sql swagger typescript
Last synced: 8 months ago
JSON representation
The TrybeSmith API consists of a management interface for a medieval products store and was developed using TypeScript.
- Host: GitHub
- URL: https://github.com/larissaperinoto/trybesmith-api
- Owner: larissaperinoto
- Created: 2022-11-11T15:44:03.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-30T14:56:07.000Z (over 3 years ago)
- Last Synced: 2025-03-01T18:33:45.312Z (about 1 year ago)
- Topics: docker, docker-compose, express, joi, jwt, msc, mysql, nodejs, nodemon, sql, swagger, typescript
- Language: TypeScript
- Homepage:
- Size: 195 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TrybeSmith API
[Trybe](https://www.betrybe.com/) is a technology school focused on training Web Developers and the TrybeSmith project was proposed as an activity to improve studies on back-end development with TypeScript.
## Description
The developed application is an API and a database with the content of a medieval articles store. The application must allow creating, reading, updating and removing items from the store's database. It also performs authentication to grant permissions to users when creating new orders.
## Technologies and Tools
In the elaboration of the RESTful API, the **Model-Service-Controller(MSC)** architecture was used, in addition to the following tools:
- [TypeScript](https://www.typescriptlang.org/)
- [Node.JS](https://nodejs.org/en/)
- [Express](https://expressjs.com/pt-br/)
- [MySQL](https://www.mysql.com/)
- [Docker](https://www.docker.com/)
- [Sequelize](https://sequelize.org/)
- [JWT](https://jwt.io/)
- [Joi](https://joi.dev/api/)
## ⚙️ How to use
To run the application, start by making a clone of this repository with the command below.
git clone git@github.com:larissaperinoto/trybesmith-api.git
Navigate to the project root.
cd trybesmith-api/
Running locally
Obs: To run the application this way you must have [Node.JS](https://nodejs.org/en/) installed on your machine.
Install the dependencies with the command below.
npm install
Login to MySQL using your local credentials.
mysql -r -p
Logged in the MySQL instance, run the **Trybesmith.sql** script to create the database.
Make a copy of the file **.env.example** with the name **.env** and fill in the information that is necessary to connect with the database.
Information that must be present in the file.env
MYSQL_USER=root
MYSQL_PASSWORD=password
MYSQL_HOST=localhost
JWT_SECRET=secret
Start the application with the command below.
npm start
Running with Docker
Obs: To run the application this way you must have [Docker](https://www.docker.com/) installed on your machine.
In the root of the project, upload the trybesmith and trybesmith_db containers using docker-compose.
docker-compose up -d
Open the trybesmith container terminal.
docker exec -it trybesmith bash
Once in the container terminal, run the command below to install the project's dependencies.
npm install
To connect to the database, open the trybesmith_db container's terminal.
docker exec -it trybesmith_db bash
Login to the database using the credentials described in the docker-compose.yaml file.
mysql -r root -p
Logged in the MySQL instance, run the **Trybesmith.sql** script to create the database.
npm prestart
Start the application with the command below.
npm start
## Routes
You can check all the routes by accessing the /docs endpoint in your browser when running the application.
Routes preview

---
Developed by [Larissa Perinoto](www.linkedin.com/in/larissaperinoto), © 2022.