Bank System Experimenting with Express and MongoDB
This is a experimental project to create a full CRUD app using the best practices and latest tech stack.
To do so, we're experimenting with a banking system and the goal is to user:
- Create accounts(Saving and Checking) - Create
- Create Log Record Per Transaction - Create
- Display Account Details & Transactions History - Read
- Deposit Funds - Update
- Withdraw Funds - Update
- Close an account - Delete
npm init -y
npm i cors express mongoose morgan nodemon chance
touch server.js //server route
touch .ignore //add node_modules
Update your Scripts block in your package.json
"scripts": {
"start": "node server.js",
"dev": "nodemon server.js"
},
For your index.html
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src=".scripts/script.js" type="module" defer></script>
<link rel="stylesheet" href="style/style.css" />
config/db file,
const mongoose = require("mongoose");
mongoose
.connect("mongodb://127.0.0.1:27017/mongoBankExpress")
.then(() => {
console.log("Successfully connected to MongoDB.");
})
.catch((e) => {
console.error("Connection error", e.message);
});
const db = mongoose.connection;
module.exports = db;
🔧 V1 express-mongo-bank
- MongoDB - Database
- mongoose - Database Framework
- nodemon
- Express - Server Framework
- NodeJs - Server Environment
- CORS - Connect/Express middleware
- Morgan - HTTP request logger middleware for node.js
- Live Server - A Quick Development Live Server with live browser reload.
make sure you have live Server extension installed
- Create one user total (✓)
- User can create new account by selecting Create A New Account button (Saving / Checking) (✓)
- User can see the account number, balance and the status of the account (if it's open) (✓)
- Select and account takes user to the account details page (✓)
- Uer can deposit/withdraw and transfer to/from all of their account via cash,check (✓)
- User can delete their account but they need to transfer the balance before that. Balance need to be 0 before request to close an account (✓)
- User can see a history of transactions in their account page(reflecting account transactions). (✓)
- Account history gets updated as transactions happened (✓)
- User can transfer money from one account to another account and can see a history record on bot(to/from) accounts (✓)
Previews:
- MongoDB - Database
- mongoose - Database Framework
- nodemon
- Express - Server Framework
- NodeJs - Server Environment
- CORS - Connect/Express middleware
- Morgan - HTTP request logger middleware for node.js
- Live Server - A Quick Development Live Server with live browser reload.
make sure you have live Server extension installed
- User can login (Google Auth) (✓)
- User can login (GitHub) (✓)
- Migrate UI from ES6 to React (✓)
- There is no business logic handled in the front-end (✓)
- Both front-end and back-end are managed in the same repo (✓)
- Account history displays in pagination
- Account history can be searched
- Account history can be filtered
- Improve styling (mobile friendly)
- Run it as an expo project
Add additional notes about how to deploy this on a live system.
Shirin - Idea & Initial work