This is the Itishagroup Transactions backend project
- 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
- 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)
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)
Use one of the options below to run the app
# development (watch mode)
$ pnpm tsoa && pnpm start:dev
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
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
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
Happy Coding ☕ 😄