A lightweight real-time auction web application written entirely in Go.
Live bids, countdown timers, and auction state changes are streamed instantly to all connected clients using Server-Sent Events (SSE) — no WebSockets, no databases, no external services.
This project demonstrates how to build a production-style real-time system in Go using only the standard library.
All auctions and bids are managed fully in-memory and synchronized across clients in real time.
- Real-time bidding powered by Server-Sent Events (SSE)
- Instant bid propagation to all connected clients
- Live countdown timers with server-side time synchronization
- Automatic auction extension for last-minute bids
- Automatic auction finalization and notifications
- Minimum bid increment enforcement
- Thread-safe auction engine (mutex-protected)
- Modern, responsive Tailwind CSS UI
- Toast notifications and live connection status
- Zero external Go dependencies
- No database, no message broker, no frameworks
- Go 1.21+
- Standard library only (
net/http,sync,time, etc.) - Server-Sent Events (SSE) for real-time updates
- Tailwind CSS (via CDN)
- Vanilla JavaScript frontend
- In-memory application state
Pure Go backend.
Pure browser-native frontend.
go-live-auction/
├── main.go # Go server, auction engine, SSE hub
├── templates/
│ └── index.html # Tailwind UI + vanilla JS
├── render.yaml # Render deployment configuration
├── go.mod
├── .gitignore
└── README.md
Clear separation between backend logic and frontend presentation.
go run .Open your browser:
http://localhost:8080
Multiple browser tabs will stay perfectly synchronized in real time.
Serves the auction UI.
Returns the current state of all auctions.
Places a bid on an auction.
{
"auction_id": "auction-1",
"bidder": "Alice",
"amount": 250
}Server-Sent Events stream broadcasting:
initial— initial auction statenew_bid— new bid placedauction_ended— auction completiontime_sync— server time synchronization
This endpoint keeps the HTTP connection open and continuously streams real-time updates to connected clients using Server-Sent Events (SSE).
When using curl with Server-Sent Events, output is buffered by default.
This means events will not appear immediately and may only be printed after the connection closes.
To receive SSE events in real time, disable output buffering using the -N (--no-buffer) flag:
curl -N http://localhost:8080/eventsWithout disabling buffering, Server-Sent Events will not stream properly in curl.
Browsers handle SSE correctly by default via the native
EventSourceAPI.
- Clients connect via browser-native
EventSource - Each client receives a live event stream from
/events - Auction state is managed centrally in memory
- All updates are broadcast to connected clients instantly
- Slow clients are skipped to avoid blocking
- Automatic cleanup on client disconnect
- Fully thread-safe using
sync.RWMutex
This architecture scales cleanly for read-heavy real-time workloads.
- Minimum bid increment: $5.00
- Bids placed in the final minute extend the auction by 30 seconds
- Auction end is enforced server-side
- All validation happens on the backend
Clients cannot cheat the system.
The project is ready for one-click deployment on Render using the included render.yaml.
services:
- type: web
name: go-live-auction
env: go
plan: free
buildCommand: |
if [ ! -f go.mod ]; then
go mod init live-auction
fi
go mod tidy
go build -o live-auction .
startCommand: ./live-auction- Learning real-time systems in Go
- Understanding SSE as a WebSocket alternative
- Prototyping auction or bidding systems
- MVP foundation for marketplaces
- Teaching concurrency and state management
- Persistent storage (PostgreSQL / Redis)
- User authentication
- Auction creation via API
- Bid history per auction
- Admin dashboard
- WebSocket support (optional)
- Docker support
- Horizontal scaling with pub/sub