This project is a sophisticated currency exchange platform that offers:
- API for Currency Exchange: Calculate and perform currency exchanges with ease.
- Real-time Updates: Stay updated with the latest currency reserves through WebSockets.
- Interactive Front-end: A sleek React-based interface for an enhanced user experience.
The application leverages Domain-Driven Design (DDD) principles and supports both in-memory and PostgreSQL databases.
For testing convenience, the default mode is in-memory, but you can easily switch the repository implementation,
seesrc/app.module
.
Get started with the following commands:
$ npm install
Choose your preferred mode to run the application:
$ npm run start
$ npm run start:dev
$ npm run start:prod
Once the application is running, you can access the frontend at http://localhost:3000
The API documentation is available through Swagger UI. Once the application is running, you can access the API documentation at:
This interactive documentation provides detailed information about all available endpoints, request/response schemas, and allows you to test the API directly from the browser.
Ensure the robustness of the application with these commands:
$ npm run test
$ npm run test:e2e
- Currency Exchange API: Endpoints for calculating and performing currency exchanges.
- Real-time Updates: WebSocket integration for live updates of currency reserves.
- Front-end Interface: A React-based interface for user interactions.
- Currency Precision:
- TWD (New Taiwan Dollar) is handled in whole number units (no decimal places).
- USD (US Dollar) is handled with precision up to 2 decimal places.
- Backend: NestJS, TypeScript, MikroORM, PostgreSQL, EventEmitter, DDD
- Frontend: React, Axios, Socket.IO
- Testing: Jest
currency-exchange/
├── src/
│ ├── application/
│ ├── domain/
│ │ ├── core/
│ │ ├── exchange/
│ │ └── reserve/
│ ├── infrastructure/
│ │ └── persistence/
│ │ ├── memory/
│ │ └── mikro-orm/
│ └── interfaces/
│ ├── http/
│ │ └── client/
│ └── websocket/
├── test/
└── README.md
src/
: Contains the main application codeapplication/
: Application services and DTOsdomain/
: Core domain logic and entitiesinfrastructure/
: Implementation details (e.g., database)interfaces/
: API controllers and client-side code
test/
: Contains test files