/credit-wallet-demo-

This repository contains credit wallet demo API endpoints.

Primary LanguageTypeScript

Credit wallet demo application

This repository contains all the business logics and API endpoints for the credit wallet demo application.

A comprehensive documentation for building server-side application for credit wallet demo application with Express.js, Postgresql, Knex and TypeScript.

Table of Contents

Introduction

This project implements a basic wallet service for a mobile lending app using NodeJS, TypeScript, and PostgreSQL. This documentation provides the guidelines in cloning the repository and running the codes on your local machine.

Features

  • Create an account
  • Funding account
  • Transferring funds between accounts
  • Withdraw funds from account
  • Prevent users in the Lendsqr Adjutor Karma blacklist from onboarding (the blacklist is not found)

Technologies

  • Node.js: LTS version for the backend.
  • TypeScript: For type safety and improved developer experience.
  • PostgreSQL: Database of choice due to hosting constraints on Render.
  • Knex.js: SQL query builder for interacting with the PostgreSQL database.
  • Docker: Containerization of the application for consistency across environments.
  • Makefile: Task automation for setting up and running the application.
  • Jest: Testing framework for unit tests.
  • ESLint: Linting to maintain code quality and consistency.
  • JWT: For token-based authentication.
  • bcrypt: For hashing passwords.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Node.js and npm installed on your machine.
  • Basic knowledge of TypeScript and Express.js.
  • Docker
  • Make

Entities-Relationship Diagram

Alt text

Getting Started

Installation

  1. Clone the repository:
    git clone https://github.com/CaptainLeon445/credit-wallet-demo-.git
    cd credit-wallet-demo-
    
  2. Install dependencies
    make install-dep

Running the Development Server

  1. Runs the application in development mode

    make dev
    
  2. Open Browser or Postman

curl http://127.0.0.1:3000/
  • The /api-docs endpoint is for the swagger UI
curl http://127.0.0.1:3000/api-docs
  • Check the routes files to get the other resource

Testing

Testing is done using Jest. Run the tests using:

make test

Linting

Linting is done using ESLint. Check for linting issues using:

make lint

Documentation

Important Notification

  • Lendsqr Adjutor Karma blacklist is not found in the Lendsqr documentation
  • Render hosting platform does not provide free MySql database. PostgreSQL database is used.
  • Docker is used to build images for deployment on render hosting platform.

Conclusion

This document summarizes the implementation of the Demo Credit wallet service. The use of Docker, Makefile, PostgreSQL, Knex, TypeScript, Jest, ESLint, JWT, and bcrypt ensures a robust, scalable, and maintainable codebase. The design decisions and technology choices were influenced by the constraints of the hosting platform and the need for type safety, code quality, and developer productivity.