All Projects → IBM → Innovate Digital Bank

IBM / Innovate Digital Bank

Licence: apache-2.0
This repository contains instructions to build a digital bank composed of a set of microservices that communicate with each other. Using Nodejs, Express, MongoDB and deployed to a Kubernetes cluster on IBM Cloud.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Innovate Digital Bank

Event Sourcing Jambo
An Hexagonal Architecture with DDD + Aggregates + Event Sourcing using .NET Core, Kafka e MongoDB (Blog Engine)
Stars: ✭ 159 (+38.26%)
Mutual labels:  microservice, mongodb
Hexagonal Architecture Acerola
An Hexagonal Architecture service template with DDD, CQRS, TDD and SOLID using .NET Core 2.0. All small features are testable and could be mocked. Adapters could be mocked or exchanged.
Stars: ✭ 293 (+154.78%)
Mutual labels:  microservice, mongodb
Space Cloud
Open source Firebase + Heroku to develop, scale and secure serverless apps on Kubernetes
Stars: ✭ 3,323 (+2789.57%)
Mutual labels:  microservice, mongodb
Cinema Microservice
Example of a cinema microservice
Stars: ✭ 1,616 (+1305.22%)
Mutual labels:  microservice, mongodb
Docker Flask Mongodb Example
Uses docker compose with a python flask microservice and MongoDB instance to make a sample application
Stars: ✭ 49 (-57.39%)
Mutual labels:  microservice, mongodb
Nodejs Roadmap
【Nodejs-Roadmap】侧重于 Node.js 服务端的开发指南,公众号 “Nodejs技术栈”
Stars: ✭ 2,278 (+1880.87%)
Mutual labels:  microservice, mongodb
Nodejs Microservice Starter
🌱 NodeJS RESTful API Microservice Starter
Stars: ✭ 220 (+91.3%)
Mutual labels:  microservice, mongodb
Appkernel
API development made easy: a smart Python 3 API framework
Stars: ✭ 152 (+32.17%)
Mutual labels:  microservice, mongodb
Goodskill
🐂基于springcloud +dubbo构建的模拟秒杀项目,模块化设计,集成了分库分表、elasticsearch🔍、gateway、mybatis-plus、spring-session等常用开源组件
Stars: ✭ 786 (+583.48%)
Mutual labels:  microservice, mongodb
Restheart
RESTHeart - The REST API for MongoDB
Stars: ✭ 659 (+473.04%)
Mutual labels:  microservice, mongodb
Refarch Cloudnative Kubernetes
Reference Implementation for Microservices based on Kubernetes and the IBM Container Service.
Stars: ✭ 115 (+0%)
Mutual labels:  microservice, kubernetes-cluster
Event Sourcing Castanha
An Event Sourcing service template with DDD, TDD and SOLID. It has High Cohesion and Loose Coupling, it's a good start for your next Microservice application.
Stars: ✭ 68 (-40.87%)
Mutual labels:  microservice, mongodb
Mongoke
Instant Graphql for MongoDb (active branch is golang, rewrite in process)
Stars: ✭ 203 (+76.52%)
Mutual labels:  microservice, mongodb
Microservices Event Sourcing
Microservices Event Sourcing 是一个微服务架构的在线购物网站,使用Spring Boot、Spring Cloud、Spring Reactor、OAuth2、CQRS 构建,实现了基于Event Sourcing的最终一致性,提供了构建端到端微服务的最佳实践
Stars: ✭ 657 (+471.3%)
Mutual labels:  microservice, mongodb
Aspnet Core Clean Arch
It is a clean architecture project template which is based on hexagonal-architecture principles built with .Net core.
Stars: ✭ 60 (-47.83%)
Mutual labels:  microservice, mongodb
Android Kubernetes Blockchain
WARNING: This repository is no longer maintained ⚠️ This repository will not be updated. The repository will be kept available in read-only mode. Refer to https://developer.ibm.com/patterns/category/blockchain/ for other blockchain code patterns.
Stars: ✭ 105 (-8.7%)
Mutual labels:  microservice, mongodb
Blockapi
A general framework for blockchain analytics
Stars: ✭ 111 (-3.48%)
Mutual labels:  mongodb
Sample Spring Microservices Advanced
More advanced samples of spring boot and spring cloud microservices showing usage of such tools like api Swagger2 on Zuul, integraction with MongoDB, configuration server, testing with Spring Cloud Contract or Hoverfly
Stars: ✭ 112 (-2.61%)
Mutual labels:  mongodb
Python Eureka Client
A eureka client written in python. Support registering your python component to Eureka Server, as well as calling remote services by pulling the the Eureka registry.
Stars: ✭ 111 (-3.48%)
Mutual labels:  microservice
Python
📃 A template for creating Open Microservices with Python
Stars: ✭ 111 (-3.48%)
Mutual labels:  microservice

Build Status

Building a Digital Bank with Node.js, Express, MongoDB, & Kubernetes

In this code pattern, we will build a dummy digital bank composed of a set of microservices that communicate with each other. We'll be using Node.js, Express, MongoDB, and the IBM Cloud Container Service.

Development of cloud native apps that are broken down into a set of microservices has been praised and commended as best-practice in software development methodologies. Software stacks like Kubernetes, which enable cloud native computing, have therefore picked up quite a bit of popularity.

It’s a little (a lot) more fun, however, to build a so-called cloud native app, than to talk about one.

So here's our attempt:

We’ll take a use-case that has a bit of real-world familiarity to it — A digital bank. Naturally inspired by Monzo. Let’s call it Innovate.

A live version deployed on a Kubernetes cluster in IBM Cloud is available for you to try here. To test it out, sign up for an account. A process runs periodically to dump randomized transactions and bills for user accounts, so give it a couple of minutes and refresh to see your populated profile.

Screens

Screens

Learning objectives

When you've completed this Code Pattern, you will understand how to:

  • Break an application down to a set of microservices
  • Create and manage a Kubernetes cluster on IBM Cloud
  • Deploy to a Kubernetes cluster on IBM Cloud
  • Deploy to IBM Cloud Private

Flow

When thinking of business capabilities, our imaginary bank will need the following set of microservices:

  1. Portal: Loads the UI and takes care of user sessions and relies on all other microservices for core functionality.
  2. Authentication: Handles user profile creation, as well as login & logout.
  3. Accounts: Handles creation, management, and retrieval of a user’s banking accounts.
  4. Transactions: Handles creation and retrieval of transactions made against users' bank accounts.
  5. Bills: Handles creation, payment, and retrieval of bills.
  6. Support: Handles communication with Watson Assistant to enable a support chat feature.

Demo architecture

Included components

  • IBM Cloud Kubernetes Service: IBM Cloud Kubernetes Service manages highly available apps inside Docker containers and Kubernetes clusters on the IBM Cloud.
  • Microservice Builder: Learn, build, run, and manage applications in a microservices framework.
  • Watson Assistant: Create a chatbot with a program that conducts a conversation via auditory or textual methods.

Featured technologies

  • Microservices: Collection of fine-grained, loosely coupled services using a lightweight protocol to provide building blocks in modern application composition in the cloud.
  • Node.js: An open-source JavaScript run-time environment for executing server-side JavaScript code.
  • Containers: Virtual software objects that include all the elements that an app needs to run.
  • Databases: Repository for storing and managing collections of data.
  • Hybrid Cloud: Enabling customers to draw on the capabilities of public cloud service providers while using private cloud deployment for sensitive applications and data.

Watch the Video

Setup

You have multiple options to setup your own instance:

Run Locally

1. Clone the repo

Clone the innovate-digital-bank repository locally. In a terminal, run:

$ git clone https://github.com/IBM/innovate-digital-bank.git

2. Create an Instance of MongoDB

This code pattern depends on MongoDB as a session and data store. From the IBM Cloud catalog, find Compose for MongoDB and click create. Give it a name, choose a region, pick the standard pricing plan and click create.

Get your mongo connection string. Almost all your microservices need it; keep it safe!

kubectl config

3. Configure your environment variables

Each of the 7 microservices must have a .env file that stores all credentials.

An example is already provided within each folder. From the directory of each microservice, copy the example file, rename it to .env, and fill it with the appropriate values.

For example, from within the /innovate folder, navigate into the accounts folder

$ cd accounts

Next, copy and rename the .env.example folder

$ cp .env.example .env

Finally, edit your .env folder and add your Mongodb connection string

Repeat these steps for all microservices. In addition to your mongo URL, most will need the public IP address of your Kubernetes cluster, You can find that under the overview of your cluster on IBM Cloud.

4. Configure your environment mode

When running the app locally without Kubernetes, the microservices do not run on the NodePorts specified in our helm chart, so we need to point our portal and userbase microservices to the correct ports.

If you're running on macOS or any linux-based system, run the following in a terminal from the git repo's directory

$ export NODE_ENV=development

if you're running on Windows, edit the NODE_ENV attribute in your .env file from within the /portal folder and the /userbase folder to the following:

NODE_ENV=development

5. Run

Finally, navigate to each microservice folder, and start it. Make sure you run the 7 microservice in 7 separate terminals.

$ npm start

You can now visit localhost:3100 to access the portal

Deploy to IBM Cloud the Hard Way

NOTE: This guide requires a paid/upgraded account on IBM Cloud. You cannot complete the steps with a free or lite account.

  1. Get the tools
  2. Clone the repo
  3. Login to IBM Cloud
  4. Create a cluster
  5. Create an instance of MongoDB
  6. Configure your deploy target
  7. Configure your environment variables
  8. Configure kubectl
  9. Initialize helm
  10. Deploy

1. Get the tools

You'll need each of the following pre-requisites:

$ ibmcloud plugin install container-service
$ ibmcloud plugin install container-registry
$ ibmcloud plugin install dev

2. Clone the repo

Clone the innovate-digital-bank repository locally. In a terminal, run:

$ git clone https://github.com/IBM/innovate-digital-bank.git

3. Log into IBM Cloud

We'll need to log into IBM Cloud through both the console and the terminal.

NOTE: If you need to specify the region you want to deploy in, you can do so by adding the -a flag followed by the region URL.

$ ibmcloud login

4. Create a cluster

From the catalog, find Containers in Kubernetes Clusters and click create. Choose a region and a cluster type, and create your cluster. Allow it some time to deploy.

kubectl config

5. Create an instance of MongoDB

This demo depends on MongoDB as a session and data store. From the catalog, find Compose for MongoDB and click create. Give it a name, choose a region, pick the standard pricing plan and click create.

Get your mongo connection string. Almost all your microservices need it; keep it safe!

kubectl config

6. Configure your deploy target

Each of the 7 docker images needs to be pushed to your docker image registry on IBM Cloud. You need to set the correct deploy target. Depending on the region you've created your cluster in, your URL will be in the following format

registry.<REGION_ABBREVIATION>.bluemix.net/<YOUR_NAMESPACE>/<YOUR_IMAGE_NAME>

For example, to deploy the accounts microservice to my docker image registry in the US-South region, my deploy_target will be:

registry.ng.bluemix.net/amalamine/innovate-accounts

If you need to get your namespace, run:

$ ibmcloud cr namespace-list

You can also add a new namespace by running:

$ ibmcloud cr namespace-add <NAME>

From the directory of each microservice, replace the deploy target in cli-config.yml and in /chart/innovate-<MICROSERVICE_NAME>/values.yaml with the correct one

For example, from within the /innovate folder, navigate into the accounts folder

$ cd accounts

Next, edit line 58 of cli-config.yaml file. Replace the deploy-image-target with the correct value.

deploy-image-target: "registry.ng.bluemix.net/amalamine/innovate-accounts"

kubectl config

Edit line 6 of the values.yaml file. Replace the repository with the correct value.

repository: registry.ng.bluemix.net/amalamine/innovate-accounts

kubectl config

Repeat these steps for all 7 microservices.

7. Configure your environment variables

Each of the 7 microservices must have a .env file that stores all credentials. An example is already provided within each folder. From the directory of each microservice, copy the example file, rename it to .env, and fill it with the appropriate values.

For example, from within the /innovate folder, navigate into the accounts folder

$ cd accounts

Next, copy and rename the .env.example folder

$ cp .env.example .env

Finally, edit your .env folder and add your Mongodb connection string

Repeat these steps for all microservices. In addition to your mongo URL, most will need the public IP address of your Kubernetes cluster, You can find that under the overview of your cluster on IBM Cloud.

8. Configure kubectl

Run the following command:

$ ibmcloud cs cluster-config <YOUR_CLUSTER_NAME>

Then copy the output and paste it in your terminal

9. Initialize helm

If you dont have helm installed, see the Helm Documentation.

$ helm init

10. Deploy

Finally, navigate to each microservice folder, and run the following command

$ ibmcloud dev deploy

Once done, you'll be able to access the portal on port 30060 of your cluster's public IP address, which you can find under the overview of your cluster on IBM Cloud. Or if you are logged in ibmcloud cli, you can find your public ip of your worker node by

$ ibmcloud cs workers <name-of-cluster>

Deploy to IBM Cloud Private

If you have an instance of IBM Cloud Private running, you can follow the steps below to deploy the app. If you'd like to deploy your own instance of ICP, you can follow this great writeup.

  1. Create a persistent volume
  2. Create a persistent volume claim
  3. Create an instance of MongoDB
  4. Configure your environment variables
  5. Add your ICP's address to your hosts file
  6. Login to docker
  7. Configure kubectl
  8. Configure cloudctl
  9. Install Helm
  10. Deploy

1. Create a persistent volume

This code pattern depends on MongoDB as a session and data store. From ICP's menu, click on Storage > Create persistent volume. Give it a name and a capacity, choose storage type Hostpath, and add a path parameter

More details here

2. Create a persistent volume claim

From ICP's menu, click on Storage > Create Persistent Volume Claim. Give it a name and a storage request value.

More details here

3. Create an instance of MongoDB

From the catalog, choose MongoDB. Give it a Name, specify the Existing Volume Claim Name, and give it a password.

More details here

Get your mongo connection string; Almost all your microservices need it; keep it safe!

Your connection string will be in the following format:

mongodb://<USERNAME>:<PASSWORD>@<HOST>:<PORT>/<DATABASE_NAME>

4. Configure your environment variables

Each of the 7 microservices must have a .env file. An example is already provided within each folder. From the directory of each microservice, copy the example file, rename it to .env, and fill it with the appropriate values.

For example, from within the /innovate folder, navigate into the accounts folder

$ cd accounts

Next, copy and rename the .env.example folder

$ cp .env.example .env

Finally, edit your .env folder and add your Mongodb connection string

Repeat those steps for all microservices. In addition to your mongo url, you may the IP address of your ICP.

5. Add your ICP's address to your hosts file

Add an entry to your /etc/hosts file as follows

<YOUR_ICP_IP_ADDRESS> mycluster.icp

6. Login to docker

For Mac users, if you are running ICP locally in VM you would also have to add the cluster info to the insecure registry. To do so, go to the Docker icon in the system tray, select Preferences > Daemon, and choose to enable experimental features and add cluster to insecure registries list.

Docker 1 Docker 2

$ docker login mycluster.icp:8500

7. Configure kubectl

From your ICP's dashboard, copy the kubectl commands under admin > configure client

kubectl config

8. Configure cloudctl

IBM Cloud Private provides a custom CLI, similar to kubectl, called cloudctl. To find the CLI for your ICP version, navigate to Menu > Command Line Tools > Cloud Private CLI and follow instruction to get cloudctl installed.

cloudctl config cloudctl config

Once you have cloudctl cli installed, log into ICP

$ cloudctl login -a https://mycluster.icp:8443 -u admin --skip-ssl-validation

NOTE: The default password for the local ICP VM is admin.

9. Install Helm

If you dont have helm installed, see the Helm Documentation.

$ helm init

10. Deploy

Finally, navigate to each microservice, and run the following command

$ ibmcloud dev deploy

Once the deployment is successfully completed, you can access the portal on port 30060 of your ICP's IP address.

(Optional) Adding Support with Watson Assistant

The Support microservice connects to an instance of Watson Assistant on IBM Cloud to simulate a chat with a virtual support agent. This is an optional step. You only need to continue if you'd like to enable the Support feature in the app.

  1. Create an instance of Watson Assistant
  2. Get your credentials
  3. Configure your environment variables
  4. Deploy

1. Create an instance of Watson Assistant

From the IBM Cloud Catalog, choose Watson Assistant, and click Create.

2. Get your credentials

Navigate to the Credentials tab and copy your credentials.

Watson Conversation

3. Configure your environment variables

From within the support folder, edit your .env to include your newly acquired credentials.

4. Deploy

Re-deploy the Support microservice, the support feature should now be accessible through the portal.

$ ibmcloud dev deploy

Troubleshooting

  1. Trouble with IBM Cloud CLI? See their Troubleshooting Documentation.
  2. Trouble with IBM Cloud Private? See their Troubleshooting Documentation
  3. IBM Cloud Private on local VM not working? Check the ICP version, Vagrant version and VirtualBox version carefully. Update them if necessary. If all else fails, vagrant destroy and vagrant up again to reset the cluster.

Learn more

Docs

Additional documentation of all the backend endpoints is available in DOCS.md.

License

This code pattern is licensed under the Apache Software License, Version 2. Separate third party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 (DCO) and the Apache Software License, Version 2.

Apache Software License (ASL) FAQ

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].