comprehensive sales tracking system that enables sales agents to record sales, calculate commissions, and receive email notifications containing statements of their sales within a requested period.
To install and run the application locally, make sure to have the following dependencies:
Make sure docker is up and running. Go to your command line and execute the following instructions:
$ git clone https://github.com/JayKay24/Sales_Tracking.git
$ cd Sales_Tracking
- Create a
.env
with the following keys:
JOBS_CONN_STR_LOCAL="mongodb://sales_database:27017/inc_olap"
DB_PASSWORD="<ANY PASSWORD WILL DO>"
CONN_STR_LOCAL="mongodb://server_oltp_database:27017/inc_oltp"
JWT_SECRET="<YOUR JWT SECRET>"
NODE_ENV="development"
JWT_EXPIRY="1d"
BROKER_URL="amqp://rabbitmq_broker:5672"
BREVO_API_KEY="<YOUR BREVO_API_KEY>"
EMAIL_SENDER="<YOUR email sending domain e.g [email protected]>"
$ docker-compose up
To shut down the application, run docker-compose down
in the root directory of the project.
A postman collection is included at this location. Import it into your postman client and view the endpoints and docs.
Alternatively, with the application running, visit http://localhost:4000/api/v1/docs
to view the OpenAPI spec for this application.
The application uses a microservices arechitecture and splits the workload into two categories:
- OLTP(Server/API) - These are the day to day transactional requests that the users will make to the application e.g registration, buying a product etc.
- OLAP(Jobs) - These are the background jobs required to fulfill application requirments that will require long-running calculations e.g calculating agent commissions and unpaid commissions within a given date range, sending emails to agents etc. Will also run cron jobs at specific intervals to send emails.
Also, this repository is structured as a monorepo to run tests in parallel and to keep all services under one repository.
To run the tests locally, navigate to the root directoy and run npx lerna run test
.
- Hosting
- Increasing test coverage