A simple Rust-powered API service for managing and retrieving user timezones.
  • Rust 47.7%
  • HTML 29.2%
  • CSS 15%
  • JavaScript 7.1%
  • Dockerfile 1%
Find a file
creations ab603ce437
All checks were successful
ci / fmt (push) Successful in 9s
ci / clippy (push) Successful in 46s
ci / docker-build (push) Successful in 51s
redo the index page and add intagrations page
2026-09-12 18:22:42 -04:00
.forgejo/workflows docs page, add footer instead of buttons, change to forgejo 2026-09-12 16:24:05 -04:00
migrations fix migration 2025-06-08 13:48:21 -04:00
public redo the index page and add intagrations page 2026-09-12 18:22:42 -04:00
src redo the index page and add intagrations page 2026-09-12 18:22:42 -04:00
.dockerignore # Git Commit Message 2025-06-04 07:56:15 -04:00
.env.example # Git Commit Message 2025-06-04 07:56:15 -04:00
.gitignore shouldnt have ingored cargo lock 2025-06-04 08:51:24 -04:00
Cargo.lock cargo update 2026-09-12 13:23:34 -04:00
Cargo.toml Fix errors and improve CORS security 2025-09-20 18:46:32 -04:00
compose.yml # Git Commit Message 2025-06-04 07:56:15 -04:00
Dockerfile docs page, add footer instead of buttons, change to forgejo 2026-09-12 16:24:05 -04:00
LICENSE LICENSE 2025-07-13 03:39:19 -05:00
README.md docs page, add footer instead of buttons, change to forgejo 2026-09-12 16:24:05 -04:00
rustfmt.toml # Git Commit Message 2025-06-04 07:56:15 -04:00

timezone-db

A simple Rust-powered API service for managing and retrieving user timezones.

Features

  • Store user timezones via /set endpoint (requires Discord OAuth)
  • Retrieve timezones by user ID via /get
  • List all saved timezones
  • List every valid IANA timezone via /timezones
  • Cookie-based session handling using Redis connection pooling
  • Built-in CORS support
  • Structured configuration with validation
  • Graceful shutdown support
  • Fully containerized with PostgreSQL and DragonflyDB

Requirements

  • Docker & Docker Compose
  • .env file with required environment variables

Environment Variables

Create a .env file with the following:

# Server Configuration
HOST=0.0.0.0
PORT=3000

# Database Configuration
DATABASE_URL=postgres://postgres:postgres@postgres:5432/postgres
DB_MAX_CONNECTIONS=10
DB_CONNECT_TIMEOUT=30

# Redis Configuration
REDIS_URL=redis://dragonfly:6379
REDIS_POOL_SIZE=5
REDIS_CONNECT_TIMEOUT=10

# Discord OAuth Configuration
CLIENT_ID=your_discord_client_id
CLIENT_SECRET=your_discord_client_secret
REDIRECT_URI=https://your.domain/auth/discord/callback

# Logging (optional)
RUST_LOG=info,timezone_db=debug

Setup

Build and Run with Docker

docker compose up --build

Run Manually

# Make sure PostgreSQL and Redis are running
cargo run

API Endpoints

Every endpoint is documented at /docs on the running service.

Configuration

The application uses structured configuration with validation. All required environment variables must be provided, and the app will exit with helpful error messages if configuration is invalid.

Optional Configuration Variables

  • DB_MAX_CONNECTIONS: Maximum database connections (default: 10)
  • DB_CONNECT_TIMEOUT: Database connection timeout in seconds (default: 30)
  • REDIS_POOL_SIZE: Redis connection pool size (default: 5)
  • REDIS_CONNECT_TIMEOUT: Redis connection timeout in seconds (default: 10)
  • RUST_LOG: Logging level configuration