nx9-url-shortner
A lightweight, self-hosted URL shortener and landing page platform written in Rust.
nx9-url-shortner is designed for individuals, organizations, and homelab operators who want complete control over their short links without relying on third-party services.
Built with Rust, SQLite, Axum, and Askama, it provides URL shortening, landing pages, analytics, audit logging, API access, and a web-based administration interface while maintaining a small deployment footprint.
Features
URL Shortening
Create short links using compact hexadecimal identifiers.
Example:
https://bzo.in/1bb170
Redirects to:
https://github.com/thakares/chronoseal-rs
Landing Pages
Create standalone landing pages using dedicated page identifiers.
Example:
https://bzo.in/p/1a2b
Analytics
Track:
- Total visits
- Country statistics
- Referrers
- User agents
- Daily statistics
- Monthly statistics
- Yearly statistics
Administrative Dashboard
Web-based administration interface featuring:
- URL management
- Landing page management
- API token management
- Audit logs
- Health checks
- Analytics dashboard
- SVG charts
API Support
REST API endpoints for automation and integration.
/api/v1/*
Security
- Password-protected administration interface
- Session management
- CSRF protection
- API token authentication
- Audit logging
Self-Hosted
No external services required.
Dependencies:
- Rust
- SQLite
- Docker (optional)
No:
- React
- Node.js
- Redis
- Kubernetes
- External databases
Architecture
Databases
The application uses four SQLite databases.
| Database | Purpose |
|---|---|
| admin.db | Users, sessions, API keys, audit logs |
| content.db | URLs, landing pages, tags |
| analytics.db | Visits and statistics |
| system.db | Jobs, migrations, backups, health checks |
Default Credentials
Initial login:
Username: admin
Password: admin
Change the password immediately after first login.
Docker Deployment
Build
docker compose build
Start
docker compose up -d
View Logs
docker logs -f bzod
Docker Compose Example
services:
bzod:
build: .
container_name: bzod
restart: unless-stopped
ports:
- "8654:8654"
volumes:
- ./data:/app/data
- ./config:/app/config
environment:
HOST: 0.0.0.0
PORT: 8654
DATA_DIR: /app/data
Development
Build
cargo build
Run
cargo run -- serve
Run Migrations
cargo run -- migrate
Create Admin User
cargo run -- create-admin
Run Tests
cargo test
Project Structure
src/
├── analytics/
├── auth/
├── charts/
├── cli/
├── db/
├── jobs/
├── models/
├── services/
├── templates/
├── utils/
└── web/
Roadmap
Planned features:
- QR code generation
- Link expiration
- Link disabling
- CSV exports
- Bulk URL import
- GeoIP integration
- Multi-user administration
- SSO support
Production Deployment
Recommended stack:
Internet
│
▼
Nginx Proxy Manager
│
▼
nx9-url-shortner
│
▼
SQLite
HTTPS is strongly recommended.
License
Apache License 2.0
Author
Sunil Thakare
Built using Rust, SQLite, Axum, Askama, and a preference for simple, maintainable software.