Coder Social home page Coder Social logo

lite-bank's Introduction

Lendsqr API

This application allows you to create an account while being able to deposit, transfer and withdraw from it.

Manual Installation

If you would still prefer to do the installation manually, follow these steps:

Clone the repo:

git clone --depth 1 https://github.com/Vectormike/lite-bank
cd lite-bank

Install the dependencies:

npm install

Set the environment variables:

cp .env.example .env

# open .env and modify the environment variables (if needed)

Commands

Run the migration:

knex migrate:latest

Start the server in development"

npm run dev

Run in production

npm run serve

Start up the containers

docker-compose up -d on the root directory of the project

Run Migration

docker exec -t -i app knex migrate:latest

Database schema

Screenshot

API Documentation

To view the list of available APIs and their specifications, vist Postman API documentation

API Endpoints

List of available routes:

Auth routes:
POST /api/auth/register - register
POST /api/auth/login - login\

Account routes:
POST /api/account/deposit - fund
POST /api/account/transfer - transfer
POST /api/account/withdraw - withdraw\

Features

  • MySQL database: MySQL object data modeling using Knex
  • Authentication and authorization: using passport
  • Validation: request data validation using Joi
  • Logging: using winston and morgan
  • Testing: unit and integration tests using Jest
  • Dependency management: with NPM
  • Environment variables: using dotenv
  • Compression: gzip compression with compression
  • Docker support
  • Git hooks: with husky and lint-staged
  • Linting: with ESLint and Prettier
  • Editor config: consistent editor configuration using EditorConfig

Environment Variables

The environment variables can be found and modified in the .env file. They come with these default values:

# Port number
NODE_ENV=development
PORT=8000

BASE_URL_DEV=http://localhost:8000
BCRYPT_SALT=12
REFRESH_TOKEN_SECRET=hththjjkekdkkkdkd
JWT_AUTH_SECRET=kdkdkkdkk
ELK_VERSION=7.5.1

DB_NAME=lendsqr
TEST_DB_NAME=lendsqr_test
DB_HOST=127.0.0.1
DB_PORT=8889
DB_USERNAME=root
DB_PASSWORD=root

Project Structure

src\
 |--components\     # Modules for each services
 |--config\         # Database, jwt and redis configuration
 |--database\       # Migrations
 |--errors\         # Error handlers
 |--helpers\        # Helpers
 |--middlewares\    # Custom express middleware
 |--shared\         # Utility classes and functions
 |--tests\          # Unit tests
 |--app.js          # Express app
 |--server.js        # App entry point

lite-bank's People

Contributors

vectormike avatar

Stargazers

Roman avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

endowmissy

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.