---
# System prepended metadata

title: Running the tracking example locally

---

# Running the tracking example locally
    
1.  Adding Github API keys to .npmrc. 
	 - User profile --> Settings --> Developer Settings --> Personal Access tokens. 
	 - Copy the key before doing anything and save it in a secure place
	 - Click on 'Configure SSO' and authorize Delhivery using SSO
	 - Add the following line to any .npmrc file you set-up for any node module. `@foxtrotplatform:registry=https://npm.pkg.github.com`
`//npm.pkg.github.com/:_authToken=<your_code_here>` 
2. Run `npm run build` to install all the required dependencies . If you are seeing a error similar to `404 Not Found - GET https://registry.npmjs.org/@foxtrotplatform%2fevent-sourcing-application - Not found`, it  is most likely happening because of authorization issues.

2. Install Docker and docker-compose. Ensure that Docker is allocated atleast **4GB**. Cassandra and Kafka will throw memory exceptions and exit if this is not in place.

3.  Run `docker-compose up`  or `npm run compose`in the directory where the `docker-compose.yml` file is present and wait for all the containers to spin up and stay healthy. If you see an error similar to `404 Not Found - GET https://registry.npmjs.org/@foxtrotplatform%2fevent-sourcing-application - Not found`, it  is most likely happening because of authorization issues. If the issues still persists, remove `event-sourcing-ui` from the docker-compose file.

4. This service needs two independent sub-services running. The first one is the docker containers running above, which are making sure some of the key components of the infrastructure are running: ElasticSearch, Kafka, Cassandra, Zookeeper and Kibana. Once these are up and running, we run the node app(or a specific package like ingress from the `packages` folder)
   
To get one of the packages up and running, follow the next set of steps. Let us take the exmaple of Ingress.(**Not required after monorepo merged into main**)

1. Move to the directory `packages/ingress`. To install packages from `package-lock.json` run `npm ci` to install dependencies from the current build. `npm install` overwrites the existing package-lock.json by installing and upgrading transient dependencies from package.json

2. If you did not delete 'event-sourcing-ui' from the `docker-compose.yml` file, you can skip this step. Else, we'll need to generate the events and the entities from the given schemas by pulling the platform-coreos-event-sourcing-lib repo and using the npm generate commands. 

3. Once they are generated, they'll need to be copied to `ingress/src/models`. So the final structure of the directory would contain two folders named `events` and `entities` in the above path. Check the contents of the `events` and `entities` folders to make sure you see the correct events and entities

4. Once the above setup is done, we are ready to run `npm run dev` to get dev and running. Do make sure you modify the `.npmrc` file to add your credentials in order for it to run without throwing any errors. 

Future enhancements: 
1. ~~The generation of events and entities need not be done separately and moved to the right repository. If there aren't any authorization errors, the coreos-event-sourcing-lib will also be directly pulled by Docker. Need to verify this, and make amends to the instructions accordingly~~(As indicated this will be solved for after monorepo is merged into main)