A real-time auction system built with Node.js, Express, Socket.io, and React. This platform allows users to engage in live bidding with real-time updates and synchronization.
- Frontend: https://live-bidding-platform-1-frontend.onrender.com
- Backend API: https://live-bidding-platform-j369.onrender.com
- Core: Node.js + Express
- Real-time: Socket.io for live bid updates and clock synchronization.
- Database: PostgreSQL (Durable storage for users, items, and bids).
- Cache: Redis (Authoritative source for active auction states and bid locking).
- Background Jobs: BullMQ for handling auction completion and expirations.
- Authentication: JWT-based auth.
- Framework: React.js with Vite.
- Styling: Tailwind CSS for a responsive and modern UI.
- Icons: Lucide React.
- Networking: Axios + Socket.io-client.
The platform is designed for high concurrency and real-time synchronization using a combination of fast in-memory storage and durable persistence.
graph TD
Client[Browser / Mobile] <--> |Socket.io / HTTP| API[Express + Socket.io Server]
API <--> |Lua Scripts| Redis[(Redis Cache)]
Redis --> |Keyspace Events| API
API --> |Pub/Sub| API
API --> |Add Jobs| Queue[BullMQ / Redis]
Queue --> |Worker Process| API
Queue --> |Persistence| DB[(PostgreSQL)]
API <--> |Durable Storage| DB
- Socket.io: Establishes a permanent bidirectional link between clients and servers.
- Redis Pub/Sub: When a bid is placed on one server instance, it's published to Redis and broadcasted by all other server instances. This allows the platform to scale horizontally.
To prevent race conditions (e.g., two users bidding the same amount simultaneously), the platform uses Redis Lua scripts. The entire validation logic—checking the auction status, validating the bid amount, and updating the state—happens in a single atomic operation inside Redis.
- Redis (Hot State): Stores active auction details, current highest bids, and countdowns. It is the authoritative source for live actions.
- PostgreSQL (Durable State): Stores the long-term history of users, items, and bids. Data is persisted here asynchronously via background workers to keep the hot path fast.
Non-critical operations like updating the permanent database after a bid or processing complex auction-end logic are handled by BullMQ workers. This ensures that the user's connection is never blocked by slow database writes.
The platform utilizes Redis Keyspace Notifications. When an auction's TTL expires in Redis, an event is triggered that the server listens for to automatically finalize the auction and notify the winner.
live-bidding-platform/
├── backend/ # Express server and business logic
│ ├── src/ # Source code
│ ├── database/ # Migrations and seeds
│ └── docs/ # Detailed backend documentation
├── frontend/ # React/Vite application
│ └── src/ # Components, pages, and hooks
└── docker-compose.yml # Docker orchestration for local development
- Docker & Docker Compose
- Node.js (v18+) & npm (if running without Docker)
- PostgreSQL & Redis (if running without Docker)
The easiest way to get started is using Docker Compose:
- Clone the repository.
- Initialize the backend environment variables:
cp backend/.env.example backend/.env
- Run the application:
docker-compose up --build
- Access the frontend at
http://localhost:5173and the backend athttp://localhost:3000.
cd backend
npm install
npm run migrate
npm run devcd frontend
npm install
npm run devYou can use the following credentials to test the platform:
| Role | Password | |
|---|---|---|
| Account 1 | jenil.savalia.cd@gmail.com |
123456 |
| Account 2 | hari@gmail.com |
123456 |
This project is licensed under the MIT License.
