This is a Node.js based transaction system API built following the microservices architecture.
The project consists of the following modules:
The server module consists of the core logic to handle transactions.
- node-grpc: gRPC Server
- MySQL: Database
- Sequelize: ORM
- nodemailer: Mail Client
- bcrypt: Password Hashing
- socket.io-client: Socket.IO client
In order to run the server, a MySQL database is required. Download and install MySQL if your system does not have it already installed. Make sure the MySQL server is running.
A configuration file is required in order for the server to work. Create a file name .env.development in the server folder with the following fields:
DB_HOST="127.0.0.1"
DB_USER="root"
DB_PASSWORD="password"
DB_NAME="transaction_db"
DB_PORT="3306"
GRPC_ADDRESS="0.0.0.0"
GRPC_PORT="50051"
SOCKETIO_ADDRESS="0.0.0.0"
SOCKETIO_PORT="3001"
ENABLE_NODEMAILER=0
NODEMAILER_EMAIL="myemail@mail.com"
NODEMAILER_PASSWORD="mypassword"
Install all dependencies
cd server && npm installWhen running for the first time
npm run initAfter initialization, the server can be run with
npm startThe gateway module consists of a standard REST API to communicate with the server using gRPC client.
- express: HTTP Server
- jsonwebtoken: Handle JWT
- bcrypt: Password Hashing
A configuration file is required in order for the gateway to work. Create a file name .env.development in the gateway folder with the following fields:
GRPC_ADDRESS="0.0.0.0"
GRPC_PORT="3000"
JWT_KEY="MY JWT KEY"
JWT_EXPIRY_TIME="n d"
Note: The gateway is incomplete and all functionality might not work. Consider using BloomRPC to use the server. The .proto files can be found in the common folder.
Install all dependencies
cd gateway && npm installStart the gateway
npm startThe common module consists of files shared between two or more modules.
- No dependencies.
The qr-socketio module handles QR encoding/decoding and communication between server and a demo browser client. User can create a transaction request which generates a QR code. This QR code can be scanned by other users to transfer balance from their account to the user who requested the balance.
- express: HTTP Server
- socket.io: Socket.IO (Websocket)
- styled-qr-code-node: QR Code generation
The QR server has a web portal available at the root address.
Install all dependencies
cd qr && npm installStart the QR server
npm start- standard transaction features
- send and receive balance
- get transaction history
- user account creation and management
- authentication using JWT
- transaction verification through OTP
- transaction request and completion through QR code
- password hashing and encryption