A lightweight, modern SQL database administration tool built with Rust. LiteAdmin provides a web-based interface for managing database connections, executing SQL queries, and exploring database structures across multiple database types.
- Multi-Database Support: Connect to PostgreSQL, MySQL, and SQLite databases
- Connection Management: Create, edit, test, and delete database connections
- SQL Query Editor: Execute SQL queries with syntax highlighting
- Table Structure Viewer: Browse table definitions, columns, indexes, and DDL
- Query History: Track and reuse past SQL queries
- Query Bookmarks: Save favorite queries for quick access
- Dark Mode: Full dark theme support
- Database Tools: Import/export data, SQL formatting, data comparison
- Responsive UI: Modern, responsive interface built with TailwindCSS
| Layer | Technology |
|---|---|
| Frontend | Leptos (Rust WASM), TailwindCSS |
| Backend | Axum (Rust), SQLx |
| Database | PostgreSQL, MySQL, SQLite |
| Build Tool | Cargo, Vite |
- Rust 1.95+ - Install Rust
- Node.js 26+ (optional, for frontend development)
- Database Drivers:
- PostgreSQL:
libpqdevelopment libraries - MySQL:
mysql-clientdevelopment libraries - SQLite: Built-in support
- PostgreSQL:
macOS (Homebrew)
brew install postgresql mysql sqliteUbuntu/Debian
sudo apt-get install libpq-dev libmysqlclient-dev libsqlite3-devWindows Install via vcpkg or use pre-built binaries.
- Clone the repository:
git clone https://github.com/RyenLee/sql-admin.git
cd sql-admin
cp .env.example .env- Build the backend:
cargo build --release -p sql-admin-backend- Build the frontend (requires wasm target):
rustup target add wasm32-unknown-unknown
cargo build --target wasm32-unknown-unknown --release -p sql-admin-frontend- Run the application:
# Start the backend server
cargo run -p sql-admin-backend
# The frontend will be served at http://localhost:3000For active development with hot reload:
# Terminal 1: Start the backend
cargo run -p sql-admin-backend
# Terminal 2: Start the frontend dev server
cd crates/frontend
npm install
npm run dev:css
trunk serve --port 8080| Variable | Description | Default |
|---|---|---|
DATABASE_URL |
SQLite database for storing connections | ./data/sql_admin.sqlite3 |
SERVER_HOST |
Backend server host | 0.0.0.0 |
SERVER_PORT |
Backend server port | 3000 |
RUST_LOG |
Logging level | info |
On first startup, create an admin user via the web interface at /connections.
- Navigate to the Connections page
- Click New Connection
- Select database type (PostgreSQL, MySQL, or SQLite)
- Fill in connection details:
- Name: Display name for the connection
- Host: Database server hostname
- Port: Database server port
- Database: Database name
- Username: Database username
- Password: Database password
- Click Test Connection to verify
- Click Save to store the connection
- Select a connection from the sidebar
- Navigate to the Query page
- Select the target database from the dropdown
- Enter your SQL query in the editor
- Click Execute or press
Ctrl+Enter - View results in the table below
- Expand a connection in the sidebar
- Click on a table name
- View the Columns, Indexes, and DDL tabs
| Shortcut | Action |
|---|---|
Ctrl+Enter |
Execute query |
Ctrl+S |
Save query to bookmarks |
Ctrl+H |
Toggle query history |
Ctrl+L |
Clear editor |
Ctrl+D |
Format SQL |
liteadmin/
├── crates/
│ ├── backend/ # Axum backend server
│ │ └── src/
│ │ ├── handlers/ # API route handlers
│ │ ├── db/ # Database operations
│ │ └── state.rs # Application state
│ ├── frontend/ # Leptos WASM frontend
│ │ └── src/
│ │ ├── pages/ # Page components
│ │ ├── components/# Reusable components
│ │ ├── api/ # API client
│ │ └── state/ # Application state
│ └── shared/ # Shared types
└── target/ # Build output
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/connections |
List all connections |
POST |
/api/connections |
Create new connection |
GET |
/api/connections/{id} |
Get connection details |
PUT |
/api/connections/{id} |
Update connection |
DELETE |
/api/connections/{id} |
Delete connection |
POST |
/api/connections/{id}/test |
Test connection |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/connections/{id}/schema |
Get database schema |
GET |
/api/connections/{id}/tables/{table}/def |
Get table definition |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/connections/{id}/query |
Execute SQL query |
GET |
/api/connections/{id}/history |
Get query history |
1. "Function pg_get_tabledef does not exist"
This indicates a PostgreSQL extension issue. The table DDL feature requires the pg_get_tabledef function from the pg_utils extension. For now, table indexes and column information are still available.
2. "Connection refused" errors
- Ensure the database server is running
- Verify firewall settings allow connections
- Check that the port number is correct
3. "Database driver not found"
Install the required database development libraries for your platform. See Prerequisites.
4. Frontend not loading
- Clear browser cache
- Ensure the backend is running on port 3000
- Check browser console for errors
Enable debug logging by setting the RUST_LOG environment variable:
RUST_LOG=debug cargo run -p sql-admin-backend# Run all tests
cargo test --all
# Run backend tests
cargo test -p sql-admin-backend
# Run frontend tests
cargo test -p sql-admin-frontend# Format all code
cargo fmt --all
# Check formatting
cargo fmt --all -- --checkcargo clippy --allContributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Commit your changes:
git commit -am 'Add new feature' - Push to the branch:
git push origin feature/my-feature - Open a Pull Request
- Follow Rust idioms and best practices
- Use
cargo fmtfor code formatting - Run
cargo clippybefore submitting - Write tests for new functionality
- Update documentation as needed
- Added dark mode support
- Performance optimizations
- Database tools collection
- Query history feature
- Query bookmarks
- Data export functionality
- Initial release
- PostgreSQL, MySQL, SQLite support
- SQL query editor
- Table structure viewer
This project is licensed under the MIT License - see the LICENSE file for details.
Built with:
- Leptos - The Rust WASM framework
- Axum - The Rust web framework
- SQLx - The Rust SQL toolkit
- TailwindCSS - The utility-first CSS framework
