MCPSERV.CLUB
Chhoto URL

Chhoto URL

Self-Hosted

Tiny, fast URL shortener for self‑hosted use

Active(97)
583stars
0views
Updated 1 day ago
Chhoto URL screenshot 1
1 / 3

Overview

Discover what makes Chhoto URL powerful

Chhoto URL is a minimalistic, self‑hosted URL shortener written in **Rust** that prioritizes speed and low resource footprint. The core idea is to provide a single, dependable service without the bloat common in many alternatives. With a Docker image that compresses to ~6 MB and RAM usage under 5 MB during normal traffic, it is ideal for lightweight environments such as VPS, cloud‑facing edge nodes, or even Raspberry Pi deployments. The application exposes a RESTful API that handles URL creation, custom aliasing, expiration, hit counting, and editing—all while keeping the codebase intentionally lean.

Runtime

Database

Containerization

Security

Overview

Chhoto URL is a minimalistic, self‑hosted URL shortener written in Rust that prioritizes speed and low resource footprint. The core idea is to provide a single, dependable service without the bloat common in many alternatives. With a Docker image that compresses to ~6 MB and RAM usage under 5 MB during normal traffic, it is ideal for lightweight environments such as VPS, cloud‑facing edge nodes, or even Raspberry Pi deployments. The application exposes a RESTful API that handles URL creation, custom aliasing, expiration, hit counting, and editing—all while keeping the codebase intentionally lean.

Architecture

  • Runtime: Rust 1.70+ with the Actix‑Web framework, chosen for its asynchronous performance and zero‑cost abstractions.
  • Database: SQLite is the default persistence layer, bundled in a single file for zero‑configuration deployments. The schema consists of a simple links table storing the original URL, short code, optional custom alias, expiration timestamp, and a hit counter. For higher‑scale setups, the code can be swapped to PostgreSQL or MySQL by modifying a single configuration flag thanks to Actix’s database pool abstraction.
  • Containerization: Two Docker images are provided—an Alpine base (~10 MB) and a scratch build (~6 MB). Both expose the same HTTP port (8080 by default) and support environment‑variable configuration, making it trivial to run in Kubernetes or Docker Compose.
  • Security: The service runs as an unprivileged user inside the container, with no root privileges. Input validation is strict; URLs are parsed using Rust’s url crate to avoid malformed redirects.

Core Capabilities

  • Randomized Short Codes: By default, the service generates a 6‑character alphanumeric code using rand::distributions::Alphanumeric. The length is configurable via environment variables.
  • Custom Aliases: Clients can supply a desired alias; the API validates uniqueness and length constraints before persisting it.
  • Expiration: Each link can be given a TTL; the background task purges expired entries automatically. The API returns HTTP 410 for expired or non‑existent links.
  • Hit Counting: Every redirect increments a counter stored in the database. The count is exposed via a lightweight /stats/{code} endpoint, ensuring no payload beyond the integer.
  • Editing: The /update/{code} endpoint allows changing the target URL, alias, or expiration without regenerating a new code.
  • QR Generation: A /qr/{code} endpoint streams a PNG QR code generated on‑the‑fly using the qrcode crate, facilitating quick sharing.

Deployment & Infrastructure

Running Chhoto URL requires only a modern Linux host with Docker or Podman. The lightweight image allows it to fit comfortably on low‑end hardware, while the Actix runtime scales horizontally with minimal configuration. For production use, developers typically expose the service behind a reverse proxy (NGINX or Caddy) that handles TLS termination, rate limiting, and optional authentication. The SQLite backend is suitable for small to medium traffic; migrating to a client‑server database (PostgreSQL/MySQL) is straightforward thanks to the abstraction layer.

Integration & Extensibility

The API follows standard REST conventions, making it trivial to integrate with CI/CD pipelines, chatops bots, or custom front‑ends. Webhooks are not built in but can be added via middleware; the code is modular, so developers can hook into request/response cycles. There is no plugin system per se, but the minimal architecture encourages extending functionality by forking or composing the service with external tools (e.g., Grafana for hit metrics). The open‑source license (MIT) allows unrestricted modification and redistribution.

Developer Experience

Configuration is handled via environment variables (CHHOT_URL_DB, CHHOT_URL_PORT, etc.), documented in the README. The codebase is concise—under 3 k lines—and follows Rust’s idiomatic patterns, which makes reading and contributing straightforward. The project maintains a CI pipeline that runs unit tests on every push, ensuring reliability. Community support is modest but responsive; issues are triaged quickly, and the author keeps the repository up‑to‑date with security patches.

Use Cases

  • Internal tooling: Organizations can host a private shortener for internal documentation or ticket links, keeping traffic off public services.
  • Edge deployments: The small footprint makes it perfect for CDN edge nodes that need to generate short links on‑the‑fly.
  • Educational projects: Students learning Rust or web services can study a real, production‑grade application with minimal boilerplate.
  • Rapid prototyping: Developers building a new web app can spin up Chhoto URL locally to test link sharing without external dependencies.

Advantages

  • Performance: Actix‑Web’s async engine delivers sub‑millisecond latency even under concurrent load, and the binary size keeps memory usage low.
  • Simplicity: No admin UI or complex dashboards; everything is API‑driven, reducing attack surface.
  • Licensing: MIT license allows commercial use without attribution requirements or licensing fees.
  • Security posture: Small code surface area, no embedded runtimes, and minimal dependencies lower the risk of vulnerabilities.

In summary, Chhoto URL offers developers a lightweight, high‑performance URL shortener that can be deployed with minimal infrastructure. Its Rust foundation, clean API surface, and emphasis on resource

Open SourceReady to get started?

Join the community and start self-hosting Chhoto URL today

Weekly Views

Loading...
Support Us

Featured Project

$30/month

Get maximum visibility with featured placement and special badges

Repository Health

Loading health data...

Information

Category
apis-services
License
MIT
Stars
583
Technical Specs
Pricing
Open Source
Docker
Official
Min RAM
256MB
Supported OS
LinuxDocker
Author
SinTan1729
SinTan1729
Last Updated
1 day ago