steps to stat the application:
-
clone the repo
git@github.com:Billa05/FintechApp.git
or
https://github.com/Billa05/FintechApp.git
-
cd Fintechapp/backend
-
npm install
-
node index.js
-
backend is running, now to start the frontend in open another terminal and follow below steps
-
cd Fintech/frontend
-
npm install
-
npm run dev
-
now head to http://localhost:5173/
-
now you can signup and add money to your accound and transfer money to others.
All the rest apis:
- http://localhost:3000/api/v1/user/signup
- http://localhost:3000/api/v1/user/signin
- http://localhost:3000/api/v1/user/update
- http://localhost:3000/api/v1/account/transfer
- http://localhost:3000/api/v1//account/auth
- http://localhost:3000/api/v1/account/balance
- http://localhost:3000/api/v1/account/deposit
I tried to use Hasura, but the decision of working with hasura with mongodb was not good as it doesnt support many features for mongodb. its better to go with an SQL database like Postgresql.
still, I managed to use the basic graphql feature using hasura:
hasura api: https://assured-ladybird-90.hasura.app/v1/graphql
query for fetching the firstname of user using the Mongo ID:
{
query: `
query MyQuery($_id: objectId_mongodb_comparison_exp = {}) @cached {
users(where: {_id: $_id}) {
firstName
}
}`,
variables: {
_id: {
_eq: {
$oid: userId,
},
},
},
}
query for fetching all the users in the db:
{
query: `
query MyQuery @cached {
users {
firstName
lastName
_id
}
}`,
}
some information about banking concepts:
In India, the smallest unit of currency is called "paise," represented by a value with only two decimal digits, in the format XX.XX.
It is not recommended to store monetary values as float or double types in a database, as it can lead to conversion issues. Instead, it is best practice to store the money value as an integer in databases. For example, 69.69 RS should be saved as 6969 in the database.
When working with MongoDB, it is essential to use the transaction and session APIs to ensure that the entire transaction process occurs smoothly, involving both users and updating the database accordingly. If any error occurs during the transaction, the transaction will not take place.