A fast, reliable, and free URL shortening service built with Rust and Axum. SNDRA Link provides both simple link shortening and advanced campaign URL building with UTM parameters.
- π Fast & Lightweight: Built with Rust and Axum for optimal performance
- π― 100% Free: No hidden costs, no premium tiers
- π Permanent Links: Links remain active as long as the service runs
- π UTM Campaign Builder: Advanced marketing campaign tracking with UTM parameters
- π Bilingual Support: Full Chinese and English interface
- π± Mobile Responsive: Optimized for all device sizes
- π³ Docker Ready: Easy deployment with Docker and Docker Compose
- β‘ Auto-Deploy: GitHub Actions integration for seamless CI/CD
- Docker and Docker Compose
- Git (for cloning the repository)
- Clone the repository:
git clone https://github.com/yourusername/sndra-link.git
cd sndra-link- Create a
.envfile:
DATABASE_URL=sqlite:///data/sndra-link.db
DOMAIN=https://sndra.link- Start the service:
docker compose up -dThe service will be available at http://localhost:7700
| Variable | Description | Default |
|---|---|---|
DATABASE_URL |
SQLite database path | sqlite:///data/sndra-link.db |
DOMAIN |
Your domain name | https://sndra.link |
If using Traefik as a reverse proxy, the service is pre-configured with labels in docker-compose.yml:
labels:
- "traefik.enable=true"
- "traefik.http.routers.sndralink.rule=Host(`sndra.link`)"
- "traefik.http.routers.sndralink.entrypoints=web"
- "traefik.http.services.sndralink.loadbalancer.server.port=7700"Endpoint: POST /
Request Body:
{
"link": "https://example.com/your-long-url"
}Response:
{
"short": "https://sndra.link/r/abc123"
}Status Codes:
200 OK: Link created successfully400 Bad Request: Invalid URL format500 Internal Server Error: Database error
Endpoint: GET /r/{key}
Example: https://sndra.link/r/abc123
Status Codes:
301 Moved Permanently: Redirects to original URL404 Not Found: Short link key not found500 Internal Server Error: Database error
- Rust (1.70+)
- SQLite3
- Install dependencies:
cargo build- Set environment variables:
export DATABASE_URL=sqlite:///data/sndra-link.db
export DOMAIN=http://localhost:7700- Run the server:
cargo run# Build the Docker image
docker build -t sndra-link:latest .
# Run the container
docker run -d \
-e DATABASE_URL=sqlite:///data/sndra-link.db \
-e DOMAIN=https://sndra.link \
-v $(pwd)/data:/data \
-p 7700:7700 \
--name sndra-link-service \
sndra-link:latestThe repository includes automated deployment via GitHub Actions. Configure the following secrets:
| Secret | Description |
|---|---|
SERVER_HOST |
Server IP address |
SERVER_USERNAME |
SSH username |
SERVER_PASSWORD |
SSH password |
On push to main branch, the workflow will:
- SSH into your server
- Pull the latest code
- Rebuild and restart containers
See DEPLOYMENT.md for detailed setup instructions.
sndra-link/
βββ src/
β βββ main.rs # Main application code
βββ public/
β βββ index.html # Main interface
βββ .github/
β βββ workflows/
β βββ deploy.yml # CI/CD pipeline
βββ Dockerfile # Container image definition
βββ docker-compose.yml # Service orchestration
βββ Cargo.toml # Rust dependencies
- Backend: Rust, Axum, SQLx
- Database: SQLite
- Frontend: HTML, TailwindCSS, Vanilla JavaScript
- Deployment: Docker, Docker Compose, GitHub Actions
- Proxy: Traefik (optional)
The advanced Campaign URL Builder supports the following UTM parameters:
| Parameter | Description | Example |
|---|---|---|
utm_source |
Traffic source | google, facebook, newsletter |
utm_medium |
Marketing medium | cpc, email, social |
utm_campaign |
Campaign name | summer_sale_2025 |
utm_term |
Paid keywords | running+shoes |
utm_content |
Ad content variant | banner_a, text_link |
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- All URLs are validated before storage
- SQL injection prevention via parameterized queries
- No authentication required for public short link access
- Rate limiting recommended for production deployment
Q: How long do short links last? A: Links are permanent and will remain active as long as the service is running.
Q: Is there a limit on the number of links I can create? A: No, there are no limits on link creation.
Q: Can I customize the short link key? A: Currently, keys are auto-generated. Custom keys may be added in future versions.
Q: Is my data secure? A: All data is stored locally in SQLite. We don't track clicks or collect user data.
- Custom short link keys
- Click analytics and statistics
- QR code generation
- Link expiration options
- Admin dashboard
- Rate limiting
- API authentication
MIT License - feel free to use this project for any purpose.
For issues, questions, or suggestions:
- Open an issue on GitHub
Built with β€οΈ using Rust