Skip to content

izidormaklary/wbd-assignment

Repository files navigation

Customer tracking platform assignment

This project is a monorepo including the components of a full-stack customer tracking application. The repository is split into two parts:

  • apps/... including all the launchables, that are to be deployed and hosted as a part of the infrastructure
  • packages/... including utility/configurational packages eliminating redundancy within the project.

Turbo is used to ensure a smooth developer experience as well as reliable pipelines necessary for CI/CD integrations.

The Project is available at wbd.izidor.dev (requires login, users data will be deleted upon request)

Selected levels

  • DB: L2:
    • as the core of the project I set up the must have part first to allow development of other parts in time
  • Backend/API: L3
    • main focus was to have it ready for local development and develop further along the frontend if needed, then deploy in the end together with the frontend.
  • Cloud/DevOps: L3 (partly L4)
    • deployment were included in other tasks, so it was no question to add a few pipelines extra
  • Frontend: L3
    • one of the most timeconsuming, the level was not really a choice, I got as far as my time allowed.
  • System Services Monitoring and Support L4
    • little extra, since im already familiar with grafana

Challenges

  • System active users increased by 10 times.
    • Scalability is always a primary concern
  • The System should be highly available 247, with different environments.
    • Deployment pipelines and setups allow for convenient environment handling and quick deployments.

Database

Mongo database hosted on AWS via mongoDB Atlas.

Data structure

database diagram

See packages/db for mongoose schema/client implementation.

Particular decisions/Notes to self

  • separation of db models: follows principle of "queried together, kept together"
  • paginated queries: listed search results can be longer so pagination is required. Offset based pagination can heavily increase CPU usage as page number increases, which ideally should not happen but assuming the worst, one "bad" user can hinder the performance of the DB (skipping to page 129 of a poorly targeted search). Hence cursor based pagination is required.

Local Development

Backend requries MONGODB_URI env var provided. (in .env.local at root for below script to work)

Frontend requires .env.local file in apps/tracking-platform/ including

 yarn
# provide env -- turbo dev eg.:
 npx env-cmd -f  ./.env.local -- turbo dev

Deployment

Lambda deployment is covered by github actions leveraging the serverless framework. The frontend is deployed through vercel.

Both automatically on push. (lambda currently only deployed on pushes to the origin/dev and origin/main branches)

# deploying tracking-api from root (dummy env provider) 
# uses turbo so building step is included
provide-env -- yarn deploy --filter="tracking-api"

System architecture

system architecture

Prototype

The figma link to the prototype is invitation only, so I made a short gif depicting it. Feel free to ask for the invite here: figma link.

prototype

Releases

No releases published

Packages

 
 
 

Contributors