A high-performance, real-time website uptime monitoring platform built entirely in Rust.
Inspired by Better Uptime
Better Uptime is an open-source uptime monitoring platform that continuously checks your websites and tracks their availability, response times, and health status across multiple regions. It's designed as a distributed system of microservices β all written in Rust β communicating through Redis Streams for low-latency, high-throughput event processing.
- Continuous Monitoring β Automatically pings your websites at regular intervals and records response times
- Multi-Region Checks β Supports health checks from multiple geographic regions to detect localized outages
- Real-time Event Pipeline β Redis Streams power the event-driven architecture for instant data flow between services
- Status Tracking β Tracks
Up,Down, andUnknownstates for every monitored endpoint - User Authentication β Secure signup/signin with Argon2 password hashing and JWT-based auth
- REST API β Full CRUD API for managing monitored websites and viewing uptime data
- Structured Logging β JSON-formatted, span-based tracing across all services via
tracing - Dockerized β One-command deployment with Docker Compose
βββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend ββββββββΊβ API Server β
β (Planned) β β (Poem β’ Port 8080) β
βββββββββββββββ βββββββββββββββββββββ¬βββββββββββββββββββββββββββ
β
β Diesel ORM
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββ
β PostgreSQL 17 β
β users β websites β website_ticks β regions β
ββββββββββββββββββββββββββββββββββββββββββββββββ
β²
β
βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββ
β β β
ββββββββββββ΄βββββββββββ ββββββββββββ΄βββββββββββ ββββββββββββ΄βββββββββββ
β Producer β β Worker β β Site Writer β
β (Scheduler/Cron) β β (Health Checker) β β (Persistence) β
ββββββββββββ¬βββββββββββ ββββββββββββ¬βββββββββββ ββββββββββββ¬βββββββββββ
β β β
β publish β consume/publish β consume
βΌ βΌ βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Redis 7 Streams β
β process_queue ββββΊ store_queue β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Producer queries PostgreSQL for all registered websites (cursor-paginated, batches of 50) and publishes check events to the Redis
process_queueevery 3 minutes. - Worker consumes events from the
process_queue, makes HTTP requests to each website, records response time and status (Up/Down), then publishes results to thestore_queue. - Site Writer consumes results from the
store_queueand bulk-inserts them into thewebsite_tickstable in PostgreSQL, then acknowledges the stream entries.
This is a Cargo workspace with 8 crates, each with a clear responsibility:
better-uptime-rust/
βββ api/ # REST API server (Poem framework)
β βββ src/
β βββ modules/
β β βββ auth/ # Signup, signin, JWT auth
β β βββ website/ # Website CRUD & monitoring data
β βββ server.rs # Server setup & request logging middleware
β βββ router.rs # Route mounting
β βββ config.rs # Environment config
β βββ state.rs # Shared application state
β
βββ producer/ # Scheduled job β publishes website check events
β βββ src/
β βββ producer.rs # Cursor-paginated website fetcher β Redis publisher
β
βββ worker/ # Health checker β pings websites, records results
β βββ src/
β βββ worker.rs # HTTP health checks with response time tracking
β
βββ site-writer/ # Persistence layer β writes check results to DB
β βββ src/
β βββ writer.rs # Stream consumer β bulk database inserts
β
βββ store/ # Database layer (Diesel ORM + PostgreSQL)
β βββ migrations/ # 7 Diesel migrations
β βββ src/
β βββ model/ # Diesel models (User, Website, WebsiteTick, Region)
β βββ module/ # Repository pattern (UserRepository, WebsiteRepository)
β βββ schema.rs # Auto-generated Diesel schema
β
βββ stream/ # Redis Streams abstraction layer
β βββ src/
β βββ stream.rs # Redis connection + client setup
β βββ process.rs # process_queue consumer/publisher
β βββ store.rs # store_queue consumer/publisher
β βββ seed.rs # Stream initialization
β
βββ common/ # Shared utilities
β βββ src/
β βββ logging.rs # Structured JSON logging setup (tracing)
β
βββ migrator/ # Database migration runner
βββ seed/ # Database seeder
β
βββ Cargo.toml # Workspace manifest
βββ Dockerfile # Multi-stage build (builder β per-service targets)
βββ docker-compose.yml # Full stack orchestration
βββ README.md
| Layer | Technology |
|---|---|
| Language | Rust 1.90 (Edition 2024) |
| API Framework | Poem |
| Database | PostgreSQL 17 |
| ORM | Diesel (with r2d2 connection pool) |
| Message Broker | Redis 7 (Streams) |
| Auth | Argon2 password hashing + JWT (jsonwebtoken) |
| HTTP Client | reqwest |
| Logging | tracing + tracing-subscriber (JSON format) |
| Containerization | Docker multi-stage builds + Docker Compose |
| Frontend | π§ Coming soon |
- Docker & Docker Compose
- (Optional) Rust 1.90+ β only needed for local development
# Clone the repo
git clone https://github.com/your-username/better-uptime-rust.git
cd better-uptime-rust
# Start the entire stack
docker compose up --buildThis will spin up:
| Service | Description | Port |
|---|---|---|
postgres |
PostgreSQL 17 database | 5432 |
redis |
Redis 7 message broker | 6379 |
migrate |
Runs Diesel migrations, then exits | β |
seed |
Seeds initial data, then exits | β |
api |
REST API server | 8080 |
producer |
Website check scheduler | β |
worker |
HTTP health checker | β |
site-writer |
Results persistence writer | β |
# Start infrastructure
docker compose up postgres redis -d
# Run migrations
cargo run -p migrator
# Seed the database
cargo run -p seed
# Start individual services (in separate terminals)
cargo run -p api
cargo run -p producer
cargo run -p worker
cargo run -p site-writerNote: Each service reads its config from a
.envfile in its own crate directory. See the individual.envfiles for required environment variables.
Base URL: http://localhost:8080/api
| Method | Endpoint | Description |
|---|---|---|
POST |
/auth/signup |
Create a new account |
POST |
/auth/signin |
Sign in and receive JWT |
| Method | Endpoint | Description |
|---|---|---|
POST |
/website/website |
Add a website to monitor |
GET |
/website/website/:website_id |
Get website details & uptime data |
users (id UUID PK, username TEXT, password TEXT, created_at TIMESTAMPTZ)
websites (id UUID PK, url TEXT, user_id UUID FKβusers, created_at TIMESTAMPTZ)
website_ticks (id UUID PK, websites_id UUID FKβwebsites, response_time_ms INT,
region_name TEXT FKβregions, status status_type, created_at TIMESTAMPTZ)
regions (name TEXT PK)The status_type is a PostgreSQL custom enum: up | down | unknown.
- Frontend β Dashboard UI (considering Yew/Rust-based SPA or Next.js)
- Additional API endpoints (list websites, delete website, uptime history)
- Alerting & notifications (email, Slack, webhooks)
- Status pages (public-facing uptime dashboards)
- Multi-region worker deployment
- Incident timeline & reporting
- Rate limiting & API key authentication
This project is open source and available under the MIT License.
Built with π¦ Rust β fast, safe, and reliable.