A modern PostgreSQL administration tool built with Rust and minimal JavaScript
pgAdmin-rs is a lightweight, fast, and secure web-based PostgreSQL administration tool inspired by phpMyAdmin and Drizzle Studio. Built entirely in Rust with server-side rendering and HTMX for dynamic interactions, it provides a sleek user experience with minimal JavaScript footprint.
- Backend: Axum (Rust web framework)
- Database: SQLx (PostgreSQL client)
- Templates: Askama (type-safe templating)
- Frontend: HTMX + minimal JavaScript
- Build System: Cargo + npm (automatic frontend builds via
build.rs) - Bundler: esbuild (fast JavaScript bundler)
- Containerization: Docker
pgadmin-rs/
├── src/
│ ├── main.rs # Application entry point
│ ├── config/ # Configuration management
│ ├── routes/ # HTTP route handlers
│ ├── services/ # Business logic
│ ├── models/ # Data models
│ ├── middleware/ # Custom middleware
│ └── templates/ # HTML templates
├── static/ # CSS, JS, images
├── tests/ # Integration tests
├── issues/ # Project planning documents
├── Dockerfile
├── docker-compose.yml
└── Cargo.toml
- Rust 1.91+ (latest stable)
- Docker and Docker Compose (for containerized setup)
- PostgreSQL 12+ (for local development)
-
Clone the repository:
git clone https://github.com/yourusername/pgadmin-rs.git cd pgadmin-rs -
Copy environment configuration:
cp .env.example .env # Edit .env with your PostgreSQL credentials -
Start the application:
docker-compose up -d
-
Access the application at
http://localhost:8080
-
Install dependencies (Node.js 18+ required for frontend builds):
# npm install and npm build happen automatically via build.rs cargo build -
Set up environment variables:
export POSTGRES_URL=postgres://postgres:yourpassword@localhost:5432/postgres -
Run the application:
# Automatically rebuilds frontend assets if needed cargo run -
Visit
http://localhost:3000
All configuration is done via environment variables:
| Variable | Description | Default |
|---|---|---|
SERVER_ADDRESS |
Server bind address and port | 0.0.0.0:3000 |
POSTGRES_URL |
PostgreSQL connection URL | (required) |
SERVER_PASSWORD |
Password to protect the UI (optional) | (disabled) |
RATE_LIMIT_REQUESTS_PER_MINUTE |
Max requests per IP per minute | 100 |
RUST_LOG |
Logging level | info |
pgAdmin-rs is built with security as a top priority:
- Password Protection: Optional
SERVER_PASSWORDenvironment variable enables login-based access control with secure cookie sessions - Rate Limiting: Per-IP request throttling using token bucket algorithm (configurable, default: 100 req/min)
- SQL Injection Prevention: Parameterized queries and input validation
- XSS Protection: Template auto-escaping and CSP headers
- Security Headers: X-Frame-Options, X-Content-Type-Options, X-XSS-Protection
- Audit Logging: Track all security-relevant events
- Query Validation: Dangerous operations (DROP, DELETE, etc.) require explicit confirmation
- Secure Defaults: HttpOnly cookies, SameSite cookies, secure headers
This project follows a phased development approach. See the issues/ directory for detailed planning documents:
- Issue #01: Architecture and Technology Stack
- Issue #02: Backend Foundation
- Issue #03: Database Connectivity
- Issue #04: Security and Authentication (Partial)
- Issue #05: Core Features
- Issue #06: UI/UX Implementation (Mostly Complete)
- Issue #07: Docker Setup
- Issue #08: Testing and Quality Assurance
- Additional features: Data editing, exports, query history
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Write tests for your changes
- Ensure all tests pass (
cargo test) - Format code (
cargo fmt) - Run clippy (
cargo clippy) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Run the test suite:
# Run all tests
cargo test
# Run with coverage
cargo tarpaulin --all-features
# Run benchmarks
cargo bench
# Run clippy
cargo clippy --all-targets --all-features
# Format code
cargo fmtpgAdmin-rs is designed for performance:
- Fast startup: Async/await throughout
- Connection pooling: Efficient database connection management
- Pagination: Handle large datasets efficiently
- Minimal JavaScript: Faster page loads and better performance
- Compiled binary: No runtime overhead
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by phpMyAdmin and pgAdmin
- Built with amazing Rust ecosystem tools
- HTMX for modern UX with minimal JavaScript
- Issues: Report bugs via GitHub Issues
- Documentation: See
issues/directory for detailed documentation - Discussions: Use GitHub Discussions for questions
- Multiple database connections
- Backup/restore functionality
- Query builder UI
- Real-time monitoring
- Multi-language support
- Stored procedure/function editor
- Visual query explain plans
- Schema comparison tools
Built with ❤️ using Rust