This is a showcase vending machine app with a buyer and seller roles. A seller can post products. A buyer can insert coins and spend them to buy the products. The result of the purchase returns the solution of a Coin Change problem.
This turborepo uses Yarn as a package manager. It includes the following packages/apps:
-
api
:NEST JS
API for managing users, products, deposit and buying/selling.Passport.js
for authSwagger
for documentationPrisma
as ORMPostgreSQL
+Docker
for local database
-
webapp
: Rupees! Supports the API. Insert your rupees into the PEPSI machine and buy a product as a buyer or put products into the machine as a seller.Next JS
+React
componentsMaterial UI
as a design systemAxios
as API client
-
eslint-config-custom
:eslint
configurations (includeseslint-config-prettier
)
Prerequisites:
- Node 18 (tested on, probably supports less)
- Docker
- yarn
Install dependencies
yarn
Start the DB:
docker compose -f ./packages/database/docker-compose.yml up -d
Run the API and webapp
yarn dev
Adding a package to a monorepo
yarn workspace (api | webapp | database | eslint-config-custom) add react
e.g.
yarn workspace api add @types/node
To develop all apps and packages, run the following command:
yarn dev
API documentation available at http://localhost:3000/docs
Visit http://localhost:3001/ for the test webapp.
Watch out, running tests cleans the database TODO: separate DB for tests
Also requires the DB running TODO? Mock prisma?
yarn test
To build all apps and packages, run the following command:
yarn run build