Sample Ecommerce application built to demonstrate redis solutions to solve common problems in microservice architecture.
Following are the Microservice tutorials referring this application :
- Front end : built using nextJs and Tailwind
- Backend : built using express (nodejs)
- Database : Prisma (MongoDB, Postgresql ..etc) , Redis
# to start docker app
docker compose up -d- Open "http://localhost:4200/" in browser
Note:
-
Can view MongoDB data in MongoDB compass at URI
mongodb://localhost:27017/dbFashion?directConnection=true- If postgresql, connection url is
postgresql://prisma:prisma@localhost:5432/dbFashion?schema=public
- If postgresql, connection url is
-
Can view Redis data in RedisInsight at localhost with port 6379
-
Can change above connection details or ports by the environment variables in .env file
# to stop docker app
docker compose down
# to stop & also delete volumes (mongodb & redis data)
docker compose down -v
# to rebuild all images & start
docker compose up -d --build
# to rebuild image of specific service (after any code changes)
docker-compose build --no-cache <service_name>
# example
docker-compose build --no-cache orders-service- Configure
DATABASE_URLin root.envfile
DATABASE_URL=mongodb://mongodb-server:27017/dbFashion
# OR
DATABASE_URL="postgresql://prisma:prisma@postgresql-server:5432/dbFashion?schema=public"- Run specific db schema generation
npm run mongodb-schema
# OR
npm run relational-schemaNote : above command copies database prisma schema file to various services (orders, payments..etc) and generate prisma types
- Start docker
docker compose up -d --build-For MongoDB, download mongodb compass and connect with url mongodb://localhost:27017/dbFashion?directConnection=true
-
For postgresql, connection url is
postgresql://prisma:prisma@localhost:5432/dbFashion?schema=public-
Current application contains pg admin GUI (docker) for postgres, if you want to use same then perform following
- open http://localhost:5200/ in browser & enter below details
email: [email protected] password: password
- Add new db server -> connection details
hostname: host.docker.internal port: 5432 username: prisma password: prisma
-
Run prettier on all the files with the following:
npm i
npm run formatAll API docs are available at /docs/api folder
Smaller dataset of products is used for the demo, but refer database docs to add larger dataset easily
- cdn : Contains product images to be served to client (UI)
- client : frontend of the application
- database : To seed initial products data
- docs : API documentation
- server/ :
- services : Some microservices of ecommerce app
- api-gateway : Sample http proxy in-front of micro services
- common : Shared files among microservices
-
Dashboard: Shows the list of products with search functionality -
Chat bot: The chat bot is available on the bottom right corner of the page. It can be used to search for products and view the product details.Clicking on a product in the chat shows the product details on dashboard
-
Shopping Cart: Add products to the cart, then check out using the "Buy Now" button
-
Order history: Once an order is placed, theOrderslink in the top navigation bar shows the order status and history -
Admin: Theadminlink in the top navigation bar shows purchase stats and trending products. -
Settings: To control UI features
and so on
- products table
- orders table
- orderProducts table
- payments table
- products table
- orders table
- orderProducts table
- payments table
- order-with-products
- transaction-stream
















