REST APIs, code generation, banking
This is the first of a series of articles on generating REST API backend code for a simple banking system.
We take reference from the bank management system model from soft-builder.com for our project.

As we see in the above image we need nine different tables to build a simple bank management system. To understand the need for each of the tables, let us take the first principle approach towards defining the bank.
Defining the services offered by our bank.
Before we jump into understanding what every table above helps with, let us define what are all the different services offered by our bank.
To do this, we have to define what kind of customers we support, and to do that we need a customer_types table. We define what kind of accounts our customers can have, a simple example would be a savings account and a current account. and we have many such accounts defined in the below table.

Then we have what are the different types of products and services offered, we plan to offer below mentioned services to our customers, we have the product code, product service description, and merchant_id to do this. we have multiple internal or external merchants to offer such services and we define these different types of merchants in the merchant table.

The Merchants table comprises merchant_id, merchant_name, merchant_phone, and merchant_email. and the below image shows what are all the different types of merchants we will have in our bank.

Products and Services
Now we have defined what are all the different customer types, account types, transaction types, and products and services we support. and also we know the available merchants that manage the products and services offered.

When a customer opens a new account with us first we add a new customer to our database and for that, we have Customers tables. And when our customer purchases any of the products or services offered we need a table to store that information and we have a Customer_Purchase table to do that.
Transactions
And when our customer makes any transactions we need to store that information so we create a transactions table to do that. And customers can only do transactions supported by the bank we have a transaction types table to define the supported transaction.

Launch our code generation platform and create our project. It is free to do what we are doing in this article so you can follow along.
If you do not have an account drop your emailId to create your account, and you will receive an email to set your password, once it is done you can log in.
Once logged in, we get to see one free public subscription, and we can use it to create our project. This project is available to all the users of autocodegen, and if you want a private subscription, please contact us.

Click on view to launch the subscription and once inside, click on create. Now it is time to create our project, since it is in a public repository append your name to the project name as shown in the picture below. In project creation select our database as Postgresql and currently, we only support NodeJs, so keep it as what it is and create the project.

Once the project is created we can see it in the list of created projects, and you click on create button to launch the project. Once we launch our project, the first and foremost step to do is to give our project a name and save the project.
It is time to input each of the table/schema structures. I have already input that information into the project, and screenshots of each of the table is in the below attachment, and you can create your tables following that.
A couple of points to note before we start inputting the field information. To represent string we only have, TEXT and VARCHAR(100), and for numbers we only support Numeric. Providing dynamic data types and their size will be added in our upcoming release.
Accounts Table

Customer Types and Account Types

Customers

Merchants

Transactions

Customer Purchase

Transaction Types, and Products and Services
