Giter VIP home page Giter VIP logo

bank-nest-sqlite-prisma-docker-jest's Introduction

πŸ§ͺ Backend Test. πŸ’š

🚧 Finished πŸš€ 🚧

Prerequisites

Before you need install follow tools in your machine: Git, Node.js, Docker. Beyond is good to has an editor for to work with the code like VSCode

Summary

1. Overview

Bank is an API to open a new "current account" of already existing customers

Result:

API

1.1. Stack

1.2. Auxiliary libs

2. πŸ”¬ How To Run

# Clone this repository
$ git clone https://github.com/LucasJunio/bank

# Acces the project folder in your terminal/cmd
$ cd bank

# Copy base.env to .env
$ cp base.env .env

2.1. Containers

# Build the image docker
$ docker build -t bank .

# Run tests
$ docker run -e CI=true bank npm run test

# Build the container docker
$ docker run -p 3000:3000 bank

# Access SWAGGER documentation in:
http://localhost:3000/api

# The aplication going to open in  port:3000 - access http://localhost:3000

Diagram

2.2. Local

Run the development server local with "yarn", "npm", "pnpm" or manager package your preference:

# Create .env file
$ cp base.env .env

# Install dependencies
$ yarn install

# Generate the TypeScript code associated with your database models
$ npx prisma generate

# Building migrations
$ npx prisma migrate dev

# Building mock data
$ npx prisma db seed

# Run the project
$ yarn start

The aplication going to open in port:3000 - access http://localhost:3000

2.3 Evaluating Create New Account and Basic Info about new account

You can login by sending a POST request to the /current-account/ endpoint. Here's an example using cURL:

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{
  {
  "custumerId": 1,
  "initialCredit": 25.51
  }
}' \
http://localhost:3000/current-account/

The response will be status code 201 created and informations about the new account.

You can evaluate the basic info route by sending a GET request to the http://localhost:3000/current-account/basic-info/:id endpoint. Here's an example using cURL:

curl -X GET
  -H "Content-Type: application/json" \
http://localhost:3000/current-account/basic-info/:id

The response will be status code 200 success and informations about the account {:id}.

2.4 API Endpoints

  • POST http://localhost:3000/current-account/:
  • GET http://localhost:3000/current-account/basic-info/1:

3. Prisma Local Database

You can see the local database Prisma Studio is up on http://localhost:5555.

# Running local database
$ npx prisma studio

Result:

Prisma Local Database

4. How to create a new branch

Ever that's necessary to create a new branch feature, create by [main]branch, implement your development, merge this feature/branch to develop, when all it's ok, give a merge of this feature/branch to main[branch].

Let's go to follow the git flow patterns to create a new branch, to more info browse in link below to learn more how to implement in simple way.

Workflow gitflow: https://www.atlassian.com/br/git/tutorials/comparing-workflows/gitflow-workflow

# Example creating a new branch
$ git checkout -b feature/TASK-1

4.1. Commits

For commit your changes, you can follow the suggestion to use conventional commits [https://www.conventionalcommits.org/en/v1.0.0/] for to improve your commit descriptions and help the understand of the team. Exist a extension in vscode that can help you with this mission.

vscode extension id in .vscode/extensions.json:

"recommendations": ["vivaxy.vscode-conventional-commits"]

5. Software Architecture

Main folder tree.

C:.

  • src
  • β”œβ”€β”€β”€core
  • β”œβ”€β”€β”€modules
  • β”‚ β”œβ”€β”€β”€controller
  • β”‚ β”œβ”€β”€β”€inputs
  • β”‚ β”œβ”€β”€β”€repository
  • β”‚ β”œβ”€β”€β”€schema
  • β”‚ β”œβ”€β”€β”€service
  • β”‚ └───validators

6. Documentation

Diagram:

see diagram entity relationship for documentation

Diagram

7. Recommended Extensions

You can check out a list of recommended extensions in the file .vscode/extensions.json, or by opening the "Extensions" Tab in the "Recommended" pane.


🦸 Author


Lucas Junio
πŸš€

πŸ“ Licence

Made with ❀️ by Lucas Junio πŸ‘‹πŸ½ Contact

bank-nest-sqlite-prisma-docker-jest's People

Contributors

lucasjunio avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.