Skip to content

kinho/mkg-bank-api

Repository files navigation

MongoDB KoaJS GraphQL Bank API

Overview

This project is a sample bank API built with MongoDB, KoaJS, and GraphQL. It provides CRUD operations for managing users, companies, accounts, and transactions. The API enables secure transactions between accounts, calculates balances based on transaction history, and includes JWT authentication for access control.

Key Features

  • Account and Transaction Management: Complete CRUD operations for accounts and transactions.
  • Account Transfers: Enables secure transactions between accounts.
  • Balance Calculation: Automatically calculates account balances based on the transaction history.
  • JWT Authentication: Protects routes, allowing access only to authenticated users.
  • Access Control: Verifies access permissions for sensitive operations.

Prerequisites

Ensure the following are installed and configured:

Running the Project

After cloning the repository, in your project directory:

  1. Create Environment File:

    • Make a copy of the .env.example file and rename it to .env.
    • Update the values in the .env file with your actual configuration settings.
  2. Start Docker Environment:

    • Run the following command to start the Docker environment in the background:

      $ docker compose up -dV

Exploring the API

Use the Apollo Explorer at the above link to test queries and mutations, visualize the schema, and explore the data.

Testing

To run the test suite and validate API functionality, use the command:

$ npm run test

This command will execute the defined tests, ensuring reliability of operations.

Exporting to Postman

To facilitate development and testing with Postman, the GraphQL schema can be converted into a JSON file, allowing you to import API definitions directly into Postman.

To generate the JSON file, run:

$ npm run postman:json

This file can be imported into Postman, enabling quick testing of the defined queries and mutations.

About

MongoDB KoaJS GraphQL Bank Example Api Server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published