A Platform to create an online store for your business. Powered by Redis Stack!
Redis Stack (RedisJSON, RedisSearch, Redis Streams) NodeJS Angular
Checkout video here
- Merchant can register on the platform and create a store
- He can add the items to inventory
- A customer can visit that merchant store
- Customer can purchase items listed by merchant
- Merchant will receive the order and will fulfill it
- Customer will receive notifications regarding the order
- There are 6 microservices (merchant, inventory, customer, order, update, file-upload)
- All servers are based on NodeJS
- The client is based on Angular and Angular Material
- An nginx is used to route request to various microservices as a reverse proxy
- Redis Stack is integrated with the help of Redis OM and Node Redis NodeJS libraries
- Redis Stack is hosted on Redis Cloud itself
- RedisJSON, RedisSearch and Redis Streams has been used
- RedisJSON is used to store JSON documents for various schema such as Merchant, Customer, Product, Order, etc.
- RedisSearch is used alongside RedisJSON to search through different repositories
- Redis Streams is used for publishing and listening to order updates and send email using Mailjet to the customer regarding the update
- Apart from this, Google Cloud Storage is also used to store images of the products uploaded by the merchant
There are many schemas involved in different microservices and each having their own fields
Here's an example of a Order schema:
const orderSchema = new Schema(Order, {
merchantId: { type: "string" },
customerId: { type: "string" },
status: { type: "string" },
price: { type: "number" },
name: { type: "string" },
phoneNumber: { type: "number" },
email: { type: "string" },
address: { type: "string" },
state: { type: "string" },
country: { type: "string" },
createdDate: { type: "date", sortable: true },
modifiedDate: { type: "date" },
});
Here's the save command:
// Create Order
let order = {
merchantId,
customerId,
status: "PLACED",
price: totalPrice,
name,
phoneNumber,
email,
address,
state,
country,
createdDate: new Date(),
modifiedDate: new Date(),
};
order = await orderRepository.createAndSave(order);
Here's a look at RedisInsight:
There are many different types of data access operations happened in the process flow.
Here's an example of fetching orders for a customer on a store:
const orders = await orderRepository
.search()
.where("customerId")
.equals(customerId)
.sortBy("createdDate", "DESC")
.return.all();
For listening to Redis Stream this command is used:
XRANGE orders-update - +
- Install dependencies in both
backend
andclient
usingnpm install
- Create
.env
file and fill necessary variable values - Run all the microservices in
backend
folder bynpm run start
- Run angular client in
client
folder by runningng s
- Node
- Redis Stack
- Google Cloud Storage
- Mailjet API
The project is deployed on Northflank - Visit Here
Here some resources to help you quickly get started using Redis Stack. If you still have questions, feel free to ask them in the Redis Discord or on Twitter.
- Sign up for a free Redis Cloud account using this link and use the Redis Stack database in the cloud.
- Based on the language/framework you want to use, you will find the following client libraries:
- Redis OM .NET (C#)
- Watch this getting started video
- Follow this getting started guide
- Redis OM Node (JS)
- Watch this getting started video
- Follow this getting started guide
- Redis OM Python
- Watch this getting started video
- Follow this getting started guide
- Redis OM Spring (Java)
- Watch this getting started video
- Follow this getting started guide
- Redis OM .NET (C#)
The above videos and guides should be enough to get you started in your desired language/framework. From there you can expand and develop your app. Use the resources below to help guide you further:
- Developer Hub - The main developer page for Redis, where you can find information on building using Redis with sample projects, guides, and tutorials.
- Redis Stack getting started page - Lists all the Redis Stack features. From there you can find relevant docs and tutorials for all the capabilities of Redis Stack.
- Redis Rediscover - Provides use-cases for Redis as well as real-world examples and educational material
- RedisInsight - Desktop GUI tool - Use this to connect to Redis to visually see the data. It also has a CLI inside it that lets you send Redis CLI commands. It also has a profiler so you can see commands that are run on your Redis instance in real-time
- Youtube Videos
- Official Redis Youtube channel
- Redis Stack videos - Help you get started modeling data, using Redis OM, and exploring Redis Stack
- Redis Stack Real-Time Stock App from Ahmad Bazzi
- Build a Fullstack Next.js app with Fireship.io
- Microservices with Redis Course by Scalable Scripts on freeCodeCamp