Digital technology has propelled us forward to an exciting new era and has transformed almost every aspect of life. We’re more interconnected than ever as communication has become instant. Working from home has now become the norm, helping us pivot to a new way of working during the pandemic. And our ability to reduce carbon emissions by attending work-related events online has meant that we’ve taken greater strides to combat global warming. Continuing this trend is Shamshir Anees and his team, who have created an application that can host digital auctions. By using Redis, data transmission between components was carried out with maximum efficiency, providing users with real-time bidding updates on the dashboard.
Let’s take a look at how this was achieved.
You’ll build an application that will allow users to attend and take part in digital auctions. The application will allow users to create an account, put in bids, and even set up their own auction. Below we’ll uncover the required components, their functionality, and how to deploy them within this architecture.
Ready to get started? Ok, let’s dive straight in.
NodeJS connects to the Redis Cloud database.
The frontend then communicates with the NodeJS backend through API calls.
GET : /api/auctions
fetches all the keys from Auctions Hash.
NodeJS uses the Redis module to work with Redis Cloud. The Redis client is then created using the Redis credentials and hmget(). This is the equivalent of the HMSET command that’s used to push data to the Redis database.
GET : /api/auctions/{auctionId}
fetches each auction item by id.
NodeJS uses the Redis module to work with Redis Cloud. The Redis client is then created using the Redis credentials and hmget(). This is the equivalent of the HMSET command that’s used to push data to the Redis database.
All bidding data of an auction item
GET : /api/bidding/{auctionId}
NodeJS uses the Redis module to work with Redis Cloud. The Redis client is then created using the Redis credentials and hmget(). This is the equivalent of the HMSET command that’s used to push data to the Redis database.
GET : /api/settings
NodeJS uses the Redis module to work with Redis Cloud. The Redis client is then created using the Redis credentials and hmget(). This is the equivalent of the HMSET command that’s used to push data to the Redis database.
GET : /api/users/{email}
NodeJS uses the Redis module to work with Redis Cloud. The Redis client is then created using the Redis credentials and hmget(). This is the equivalent of the HMSET command that’s used to push data to the Redis database.
NodeJS connects to the Redis Cloud database.
The frontend then communicates with the NodeJS backend through API calls.
GET : /api/auctions
fetches all the keys from Auctions Hash.
NodeJS uses the Redis module to work with Redis Cloud. The Redis client is then created using the Redis credentials and hmget(). This is the equivalent of the HMSET command that’s used to push data to the Redis database.
GET : /api/auctions/{auctionId}
fetches each auction item by id.
NodeJS uses the Redis module to work with Redis Cloud. The Redis client is then created using the Redis credentials and hmget(). This is the equivalent of the HMSET command that’s used to push data to the Redis database.
All bidding data of an auction item
GET : /api/bidding/{auctionId}
NodeJS uses the Redis module to work with Redis Cloud. The Redis client is then created using the Redis credentials and hmget(). This is the equivalent of the HMSET command that’s used to push data to the Redis database.
GET : /api/settings
NodeJS uses the Redis module to work with Redis Cloud. The Redis client is then created using the Redis credentials and hmget(). This is the equivalent of the HMSET command that’s used to push data to the Redis database.
GET : /api/users/{email}
NodeJS uses the Redis module to work with Redis Cloud. The Redis client is then created using the Redis credentials and hmget(). This is the equivalent of the HMSET command that’s used to push data to the Redis database.
https://github.com/redis-developer/NR-digital-auction-backend
The 'npm install' is a npm cli-command that does the predefined thing i.e install dependencies specified inside package.json
npm install
export REDIS_END_POINT=XXXX
export REDIS_PASSWORD=XXX
export REDIS_PORT=XXX
npm run build
npm start
git clone https://github.com/redis-developer/NR-digital-auction-frontend
npm run build
npm start
The Redis Cloud database with Redis Stack is what you’ll use to install the data.
Type - Redis Hash
Used for storing the bids placed on each auction item
NodeJS connects to the Redis Cloud database. The Frontend communicates with the NodeJS backend through API calls.
POST : /api/bidding
The request body has JSON data to be inserted into the database.
AuctionId from request body serves as the key
JSON data which includes keys:
The bidding array has all of the bids placed for a particular auction item.
Based on the current BidEndTime and BidTime, the auction end date is extended based on the Dynamic closing concept.
Current dynamic closing logic - If a new bid is placed within the last 5 minutes of the auction end time, the end time is extended by 1 hour.
This will be configurable in the SaaS solution.
NodeJS uses the Redis module to work with Redis Cloud. The Redis client is created using the Redis credentials and hmset(). This is the equivalent of the HMSET command that’s used to push data to the Redis database.
/api/settings
/api/users
When you go onto the Digital Auction’s homepage, you’ll come across a range of items that are to be auctioned (see below). Click on the ‘Welcome’ button to create an account.
You’ll then be taken to the sign-up page. Enter your details and click ‘sign-up.’ Once you’ve completed the sign-up form, you’ll receive a confirmation email to activate your account.
Go to the homepage to have access to view all of the items and their auction details. All of the data here is being populated by Redis Stack and Redis Cloud. Scroll through the page and click on the item that you want to place a bid for.
When you click on an item, you’ll see the details for the bidding process at the top of the page. You’ll also have the option to set a reminder by receiving an email of whenever the bidding process of this item begins.
On the right-hand side of the image, you’ll see the highest bid that’s been placed for this item. Below is a list of previous bids made by different users which are updated in real-time.
Click on the ‘Place Bid’ button to make a bid.
To access the meta-data information or view more images of the item, simply scroll down the page (see below).
Click on ‘My biddings’ at the top of the navigation bar to view your bidding history (see below).
Click on ‘Auctions’ at the top of the navigation bar to view all upcoming auctions.
Digital technology has had a ripple effect across all aspects of modern life. The ability to complete important tasks online instead of in-person has revolutionized the way we live, helping us to reduce carbon emissions, save time from traveling and have instant access to reams worth of data that we never had before.
However, the success of such events hinges on a database’s ability to transmit data in real-time. Any blips in transmission would create a disconnect between users and the auction, impeding auctioneers’ reactions to bids. This would only result in frustration, disengagement, and a complete divorce of users from the application.
But thanks to Redis, the components that made up the architecture system became vastly more interconnected so data was able to be sent, processed, and received in real-time. Achieving this paves the way for a smooth bidding process where users can interact with events in real-time without interruptions, ultimately enhancing the functionality of the app.
NR-Digital-Auction is a fantastic example of how innovations can be brought to life by using Redis. Everyday programmers are experimenting with Redis to build applications that are impacting everyday life from around the world and you can too!
So what can you build with Redis? If you're ready to get started building, quickly spin up a free database Redis Cloud.