This application was created for demo simple wallet app with asynchronous transaction.
List of stack:
- NodeJs with Fastify
- PostgreSQL
- Prisma
- Docker
To install and run this application locally, follow these steps:
$ git clone https://github.com/username/backend-app.git
$ cd simple-wallet-app
$ npm install
Configure your .env file based by .env.example and adjust the parameters:
$ cp .env.example .env
Makesure your postgres is running and migrate and seed the database with this command:
$ npm run prisma:generate
$ npm run prisma:db:init
$ npm run prisma:db:seed
To start the api service, run the following command:
$ npm run build
$ npm run start
To install and run this application with docker, follow these steps:
$ git clone https://github.com/username/backend-app.git
$ cd simple-wallet-app
Configure your .env file based by .env.example and adjust the parameters:
$ cp .env.example .env
Then run database and api service with single command:
docker-compose up
For the API documentation you can check the postman collection with its example and environment. You can get the postman by this links:
Below is list of route provided:
- User login
- Route:
(POST) /auth/login
- Required body: email (string), password (string)
- Route:
- User register
- Route:
(POST) /register
- Required body: email (string), password (string), name (string)
- Route:
- Get user wallets
- Route:
(GET) /user/wallets
- Required header: Authorization: Bearer <jwt_token>
- Route:
- Get user transaction histories
- Route:
(GET) /user/wallets/:walletId/histories
- Required header: Authorization: Bearer <jwt_token>; path params: walletId (int)
- Route:
- Check transaction status
- Route:
(GET) /transaction/:transactionId
- Required header: Authorization: Bearer <jwt_token>; path params:
transactionId
(string)
- Route:
- User withdraw
- Route:
(POST) /transaction/withdraw
- Required header: Authorization: Bearer <jwt_token>; body: accountType (int), amout (int/float), toAddress (string)
- Route:
You can use 2 user for simulating the transaction. Lisf of user:
-
Email: [email protected] Password: test1234
-
Email: [email protected] Password: test1234