Skip to content

🚚 Fastfeet is a fictitious logistic company and this repository belong to the business logic and is the basis of a general structure.

License

Notifications You must be signed in to change notification settings

LeuAlmeida/fastfeet.api

Repository files navigation

FastFeet

FastFeet API from Rocketseat GoStack

⚡ API to obtain the GoStack bootcamp certify

GitHub language count Made by Léu Almeida License

Introduction

Fastfeet is a fictitious logistic company and this repository belong to the business logic and is the basis of a general structure and all of this be a part of the Rocketseat bootcamp certify. This API is based on Express for the overall structure, uses PostgreSQL for data storage, Redis for queue data control in conjunction with Bee-queue, and Sentry for error control and internal problem maintenance. Functions general features that use SMTP to trigger e-mails are done through nodemailer using express-handlebars and nodemailer-express-handlebars are kept in the src/app/views/emails folder.

🔌 Prerequisites

Quick Start

First get all the requirements installed on your system. You will need to run the API using some Docker Images like PostgreSQL and Redis. Certified that do you have wall prerequisites, start the docker images dependencies:

# Change the <password> below and on .env file to run PostgreSQL
$ sudo docker run --name fastfeet -e POSTGRES_PASSWORD=<password> -p 5432:5432 -d postgres:11

# Execute the Redis docker
$ sudo docker run --name redisfastfeet -p 6379:6379 -d -t redis:alpine

🔐 Getting started the API Restful backend

Make a clone from the repo and install the dependencies

# First of all, clone the project
$ git clone https://github.com/LeuAlmeida/fastfeet.api.git

# Enter in the DevRadar folder
$ cd fastfeet.api

# Install all dependencies using Yarn
$ yarn

Certify yourself that all environments are correct

# Copy the .env folder
$ cp .env.example .env

# Insert your environments into .env file
$ nano .env

Prepare the PostgreSQL database

# Migrate the database
$ yarn sequelize db:migrate

# Run the seeds
$ yarn sequelize db:seed:all

Start the project

# Run the development server
$ yarn dev

# Case the output appears like this, is all ok
yarn run v1.19.1
$ nodemon src/server.js
[nodemon] 2.0.2
[nodemon] to restart at any time, enter `rs`
[nodemon] watching dir(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node -r sucrase/register src/server.js`

# The backend will run on port 3333
# https://localhost:3333

In a separated terminal, run the queue

# Run the queue to enable mails and dependencies that uses bee-queue
$ yarn queue

# Case the output appears like this, is all ok
yarn run v1.19.1
$ nodemon src/queue.js
[nodemon] 2.0.2
[nodemon] to restart at any time, enter `rs`
[nodemon] watching dir(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node -r sucrase/register src/queue.js`

Routes

You can learn more about the Routes, or you can see the own file.

Demo

Live demo incoming.

✔️ Stack

Dependencies Security and Prevent errors
Nodemon Bcrypt
Bee-queue Dotenv
Express Handlebars Express-async-errors
Pg and pg-hstore JWT
Sequelize Sentry
Youch
Yup

©️ License

MIT License.

See LICENSE for details.


About

🚚 Fastfeet is a fictitious logistic company and this repository belong to the business logic and is the basis of a general structure.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published