Skip to content

Latest commit

 

History

History
57 lines (44 loc) · 2.7 KB

File metadata and controls

57 lines (44 loc) · 2.7 KB

Itishagroup Transactions Backend APIs

This is the Itishagroup Transactions backend project

Tech stack

  • Express web framework
  • Node.js v22.14.0
  • Pnpm Package Manager (v10.4.1)
  • PostgreSQL database management system (version 14 and above is preferred)
  • TypeORM as the Object Relational Mapper (ORM)
  • tsoa for generating OpenAPI docs for the project

Project setup

  • Clone this repository to your machine
  • Run pnpm i from the project directory to install the project dependencies
  • Setup a PostgreSQL database on your machine
  • Create an .env file at the root of the project directory and fill it with the contents available in .env.example. (NOTE: Replace the values with square branckets with your own values)

Database Setup

Making Database Migrations

Run the command below to create database tables as defined by the project's entities.

(NOTE: Make sure you have already created the database) The other TypeORM migration scripts are found in the scripts section of the package.json file.

$ pnpm migration:run # making TypeORM migrations from .ts config file (dev mode)

Running the app

Use one of the options below to run the app

# development (watch mode)
$ pnpm tsoa && pnpm start:dev

Generating TypeORM migration files

To generate migration files based on model changes, run the command below from the root directory of the project

$ pnpm migration:generate ./src/migrations/[YOUR_MIGRATION_NAME] # eg. pnpm migration:generate ./src/migrations/CreateUser

REST API Documentation

The REST API documentation can be found by visiting /docs after running the project.

For routes requiring authentication (e.g /api/v1/transactions), make sure the Authorization value is in the format Bearer xxx, where thexxx is your access token returned after successful login

TODOs

The following are some improvements that could be made:

  • Robust API error handling - Returning specific error codes and messages to the clients. Currently majority of the API errors have status 500
  • Robust Dependency Injection (DI) system - Configuring and using an IoC for Dependency Injection. Currently dependencies are manually injected
  • Implementing Rate limiting to prevent API abuse
  • Using Redis for caching transaction history responses

Final Words

Happy Coding ☕ 😄