Its a simple loan app built on top of NestJS.
- Node.js v18 or higher
- npm v8 or higher
- pnpm v8 or higher
- PostgreSQL
Server: Node, NestJS
Database: PostgreSQL, TypeORM
Security: JWT, bcrypt
Package Manager: pnpm
Versions: node v18.12.1 (npm v8.19.2) , pnpm 8.6.0
NestJS - It was chosen due to the below reasons,
> Typescript support - Typescript makes life a lot easier with strict type
checking on variables and functions. NestJS is officially supported
by the core typescript team and provides out of the box support for latest features.
> Modular Architecture Pattern - Its easily scalable and easily understandable with
its module driven approach
> Wide support for packages - Jest for testing, Swagger for documentaion,
JWT for security etc. integrates with NestJS with an ease.
> TypeORM support
PostgreSQL - It was chosen due to the below reasons,
> Data is structured.
> Data is predictable, and is expected to undergo minimal or gradual changes over time.
> It's a finance-related project, so there will be a lot of transactional queries,
which are any day better suited for a SQL database.
Clone the project
git clone https://github.com/LordNayan/nest-loan
Go to the project directory
cd nest-loan
Change the .env file by putting your local DB Details
#APPLICATION CONFIG
PORT=3000
#DATABASE CONFIG
DATABASE_HOST=localhost
DATABASE_NAME=postgres
DATABASE_USER=nayanlakhwani
DATABASE_PASSWORD=
DATABASE_PORT=5432
Install node and pnpm (Optional)
After you have installed node,
RUN: sudo npm install -g pnpm
RUN: ./setup.sh
Install dependencies
RUN: pnpm install
Run Migrations
RUN: pnpm migration:run
Start the server
RUN: pnpm run start
Open Swagger
localhost:3000/docs
- Role Based API Authorization & JWT Authentication
- Create loan
- Approve loan
- Repay loan
- Get all loans
- Get particular loan by id
- Create new users
- Login
-
- Admin
- User
-
Default users:- Admin: username - admin, password - 123456 User: username - nayan, password - 123456
After login, you will get a token, copy it and authorize in swagger. It is required by all other apis.
-
- Create User - /user/create
- Approve Loan - /loan/approve
To run tests, run the following command
unit test:
RUN: pnpm test:cov
e2e test:
RUN: pnpm test:e2e
For support, email [email protected].