A progressive Node.js framework for building efficient and scalable server-side applications.
Nest framework TypeScript starter repository.
$ yarn install
# development
$ yarn run start
# watch mode
$ yarn run start:dev
# production mode
$ yarn run start:prod
# unit tests
$ yarn run test
# e2e tests
$ yarn run test:e2e
# test coverage
$ yarn run test:cov
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
- Author - Kamil Myśliwiec
- Website - https://nestjs.com
- Twitter - @nestframework
Nest is MIT licensed.
Welcome to the Wallet Project! This project allows users to create wallets, perform transactions, and view payment summaries. It provides a user-friendly API for seamless integration with your applications.
🚀 Getting Started
To use the Wallet Project, follow these steps:
-
Clone the repository:
git clone <repository_url>
-
Install the dependencies using Yarn:
yarn install
-
Configure the necessary environment variables (e.g., database connection details, JWT secret key).
-
Build the project:
yarn build
-
Start the application:
yarn start
Test Card Information To facilitate testing of payment transactions, you can use the following test card information:
Card Number: 4084084084084081 CVV: 408 Expiry Month: 01 Expiry Year: 99 Card PIN: 0000
- Access the application at
http://localhost:3000
.
📚 Documentation
Comprehensive documentation is available to guide you through the project features and API endpoints. Please refer to the Swagger API documentation for detailed information about the available endpoints, request/response structures, and authentication requirements. Access the documentation at http://localhost:3000/docs#/default
.
🔑 Authentication and Authorization
The Wallet Project utilizes JWT (JSON Web Tokens) for authentication and authorization. You can generate a JWT token by calling the appropriate authentication endpoint and including the token in the Authorization
header of subsequent requests.
⚙️ Project Structure
The project is structured as follows:
src/
- Contains the source code filescontrollers/
- Defines the API endpoints and request handlersdto/
- Contains the Data Transfer Objects (DTOs) used for request and response validationentities/
- Defines the database entities/modelsenums/
- Contains the enum definitionsconfig/
- Custom configurationsmigrations/
- Database migration scriptsrepositories/
- Data access layer for interacting with the databaseservices/
- Business logic servicesutils/
- Utility functions and helper modulesapp.module.ts
- Application module and dependencies configurationmain.ts
- Entry point of the application
test/
- Contains the test filesdocs/
- Project documentation files
📖 Usage
To understand how to use the Wallet Project, follow this user story:
-
As an admin, you have the authority to create wallets for users and approve transactions.
-
Create a user using the
/user/create-user
endpoint. The user object will be created with the user role and a generated password. In a real-world scenario, you would send the password to the user's email address. However, for testing purposes, the password is returned in the response object. -
Log in as the user using the appropriate authentication method (e.g., JWT). Obtain the JWT token required for subsequent requests.
-
Set a transaction pin for the user by calling the corresponding endpoint. This pin will be used for transaction authorization.
-
Perform wallet operations such as deposits, withdrawals, or transfers using the provided endpoints. Make sure to include the necessary authentication headers (e.g., JWT token) in your requests.
🔒 Security
Please note that some endpoints are restricted to admin users only. These include /user/create-user
and /transactions/get-summary/{year}/{month}
. Make sure to authenticate with an admin user to access these endpoints.
For simplicity, the JWT secret key has been intentionally left in the codebase. In a production environment, it's crucial to secure the secret key and follow industry best practices for JWT security.
I apologize for not including unit tests in this project. Due to the limitations of this text-based environment and time constraints, it was not feasible to write comprehensive unit tests for all components. However, writing unit tests is highly recommended for ensuring code quality and reliability. I encourage you to add unit tests to the project to cover critical functionality and edge cases.
🌟 Enjoy Coding!
Thank you for using the Wallet Project! If you have any questions or need assistance, feel free to reach out. Happy coding! 😊