A backend API service for a payments wallet.
Users can create account (includes an initial amount), transfer funds to another user's account and view their transaction history.
This is a technical Assessment project. This solution uses Node.js
runtime, GraphQL
for the API layer, Redis
for user sessions, MongoDB
for the database, Kafka
for transaction events.
Resolvers | Description |
---|---|
account | Gets authenticated user account information. |
balance | Gets authenticated user account balance. |
transactions | Gets authenticated user transaction history. |
login | Logs in and authenticates users. |
createAccount | Registers and authenticates users. |
transfer | Transferring of funds to other user's account. |
Before getting started, make sure you have the following requirements:
- Docker
- Docker Compose (Supporting compose file version 3)
- A bash compatible shell
Follow these steps to get your development environment set up:
- Clone this repository locally;
# Change to the desired directory
$ cd <desired-directory>
# Clone the repo
$ git clone https://github.com/evanigwilo/graphql-kafka-payment-system.git
# Change to the project directory
$ cd graphql-kafka-payment-system
-
Change environmental variables filename from
.env.example
to.env
-
Update the
.env
file values for the following variables:
# Kafka configurations
KAFKA_SERVER=
KAFKA_CLUSTER_API_KEY=
KAFKA_CLUSTER_API_SECRET=
- At the root directory, run the following command:
# Create external docker volume for the mongo database
$ docker volume create mongo-db-volume
# Build and run the server in a container environment
$ docker-compose --env-file .env -p payment-system-stack -f docker-compose.yml up --build -d
- The api-server will be running at http://localhost:4000/v1
# Stops and removes containers, networks and volumes
$ docker-compose --env-file .env -p payment-system-stack -f docker-compose.yml down -v --remove-orphans