This application allows users to create an account, fund their account, send money to another user, and check their account balance and transaction history.
-
User Authentication Users are authenticated and validated using JWT web token. Generating tokens on signup and login ensures API endpoints are protected.
-
Users
- Create an account
- Fund their account
- Securely send money from their account to the account of another user
- Check their account balance and transactions
-
Node.js
-
Express.js
-
TypeScript
-
TypeORM
-
PostgreSQL
-
JWT
-
Bcrypt
You can access the app on render at BankAPI
Alternatively, You may clone the repository and run the app locally to use.
- Clone the repository
- git clone https://github.com/atomicman57/bank-api
- Navigate to the project directory cd bank-api
- Install the dependencies using yarn install
- Rename .env.sample to .env and add the required Database information.
- Run npm start to start the application.
- The app will start on your local server.
- Run tests with: npm test
The application will start on http://localhost:4000
by default.
Creates a new user account.
firstName
(string): Required. The first name of the user.lastName
(string): Required. The last name of the user.email
(string): Required. The email address of the user.password
(string): Required. The password of the user. Must be at least 6 characters long.
token
(string): The JWT token to be used for authentication.user
(object): The newly created user object.
Logs in a user.
email
(string): Required. The email address of the user.password
(string): Required. The password of the user.
token
(string): The JWT token to be used for authentication.user
(object): The user object.
Gets the current user.
user
(object): The current user object.
Gets the balance of the current user.
balance
(number): The current user's balance.
Gets the transactions of the current user.
page
(number): Optional. The page number to retrieve. Defaults to 1.limit
(number): Optional. The number of transactions to retrieve per page. Defaults to 10.
transactions
(array): An array of transaction objects.total
(number): The total number of transactions.totalPages
(number): The total number of pages.currentPage
(number): The current page number.
Funds the current user's account.
amount
(number): Required. The amount to fund the account with.
user
(object): The updated user object.
Transfers money from the current user's account to another user's account.
recipientId
(number): Required. The ID of the recipient user.amount
(number): Required. The amount to transfer.
sender
(object): The updated sender user object.recipient
(object): The updated recipient user object.
The API uses HTTP status codes to indicate the status of a request. The following HTTP status codes may be returned:
- 200 OK: The request was successful.
- 201 Created: The resource was created successfully.
- 400 Bad Request: The request was invalid or could not be understood by the server.
-
Fork this repositry to your account.
-
Clone your repositry: git clone [email protected]:your-username/docvault.git
-
Create your feature branch: git checkout -b feature/feature-id/<3-4 word feature description>
-
Commit your changes: git commit -m "feature(scope): (subject) (body) (footer)"
-
Push to the remote branch: git push origin new-feature
-
Open a pull request.
-
Note this project uses javascript ES6 and Airbnb style guide
- Commit Message Convention
-
scope should be something specific to the commit change e.g logo
-
subject text should:
- use present tense: "save" not "saved" or "saving"
- not capitalize first letter i.e no "Carry to safety"
- not end with a dot (.)
-
Message body (optional) If a body is to be written, it should:
- written in present tense.
- include reason for change and difference in the previous behaviour
-
Message Footer This should be used for referencing the issues using the following keywords: Start, Delivers, Fixes and Finishes. It should be written as:
- [Start #345]
-
This project is authored by Philips Blessing and is licensed for your use, modification and distribution under the MIT license.