Overview
Discover what makes Anchr powerful
Anchr is a lightweight, self‑hosted toolbox that bundles three core web utilities—link shortening, bookmark management, and encrypted image hosting—into a single Express‑based service. At its heart, Anchr exposes a RESTful API that mirrors the UI experience: endpoints for creating short links (`POST /api/shorten`), managing collections of bookmarks (`GET/POST /api/bookmarks`), and uploading images (`POST /api/images`). Each resource is persisted in a PostgreSQL database, accessed through the `knex` query builder. The application’s front‑end is a single‑page React app built with Vite, which communicates with the API via Axios. The server also serves static assets from a `/public` directory and injects an OAuth 2 client configuration that supports Google, Facebook, and generic OpenID Connect providers.
Short Links
Bookmarks
Image Uploads
Safe Browsing
Overview
Anchr is a lightweight, self‑hosted toolbox that bundles three core web utilities—link shortening, bookmark management, and encrypted image hosting—into a single Express‑based service. At its heart, Anchr exposes a RESTful API that mirrors the UI experience: endpoints for creating short links (POST /api/shorten), managing collections of bookmarks (GET/POST /api/bookmarks), and uploading images (POST /api/images). Each resource is persisted in a PostgreSQL database, accessed through the knex query builder. The application’s front‑end is a single‑page React app built with Vite, which communicates with the API via Axios. The server also serves static assets from a /public directory and injects an OAuth 2 client configuration that supports Google, Facebook, and generic OpenID Connect providers.
Technical Stack
| Layer | Technology | Rationale |
|---|---|---|
| Runtime | Node.js 21.x + Express | Mature ecosystem, async I/O suited for HTTP APIs |
| Database | PostgreSQL (via Knex) | ACID compliance, JSONB support for flexible metadata |
| Front‑end | React + Vite | Fast build, modern component model, easy integration with browser extensions |
| Encryption | CryptoJS (client‑side) | Zero‑trust uploads: image data is encrypted before leaving the browser |
| Security | Safe Browsing API, Helmet, CSP headers | Prevent phishing, enforce strict security policies |
| Metrics | Prometheus endpoint (/metrics) | Exposes request latency, error rates for ops teams |
| Extensions | Chrome/Firefox WebExtension (webext) | Seamless “Save to Anchr” or “Shorten link” from the browser context menu |
| CI/CD | GitHub Actions (not shown) | Automated tests, Docker image builds |
Anchr’s codebase is intentionally small—under 5 kB of source after minification—making it trivial to audit and modify. The server follows a classic MVC pattern: routers → controllers → services → repositories, with dependency injection via simple factory functions. All secrets (DB password, OAuth client IDs) are read from environment variables, and the Dockerfile exposes only a single port (3000), ready for deployment behind a reverse proxy.
Core Capabilities & APIs
- Short Links –
POST /api/shortenaccepts a long URL and optional custom slug; returns a short URL that redirects via a catch‑all route. Internally, URLs are stored with ahashfield (generated bycrypto.randomBytes(4).toString('hex')) and avisitscounter. A background job (node‑cron) updates visit statistics and purges stale links. - Bookmarks – CRUD endpoints (
/api/bookmarks) support tagging, description, and categorization into collections. The API returns a full bookmark tree onGET /api/bookmarks, enabling instant UI rendering. - Image Uploads –
POST /api/imagesaccepts multipart form data. The server streams the file to disk, stores metadata (size, MIME type, upload timestamp), and returns a signed URL that the client can use to download. If the client sends an encryption key, the image is stored encrypted; decryption occurs on the fly when the file is served. - Safe Browsing – Every link creation triggers an async lookup against Google’s Safe Browsing API; malicious URLs are rejected with a 400 status code.
- OAuth – The
/authroutes usepassport.jsstrategies for Google, Facebook, and generic OIDC. Tokens are stored in the database and refreshed automatically.
Deployment & Infrastructure
Anchr is container‑first. The official Docker image (muety/anchr) pulls the latest Node.js LTS, installs dependencies, and starts the Express server. The image exposes only port 3000, so a lightweight reverse proxy (NGINX, Caddy) can add TLS termination and HTTP/2. For scaling, the stateless nature of the API means you can run multiple replicas behind a load balancer; PostgreSQL is the only shared state, so standard replication or Patroni setups work out of the box. The Prometheus endpoint allows you to monitor latency, request counts, and error rates; Grafana dashboards can be built from the exported metrics.
Integration & Extensibility
- Browser Extensions – The Chrome/Firefox extension ships as a separate package (
webext) that communicates with the API viachrome.runtime.sendMessage. It can be embedded into any web page as a bookmarklet, providing “Save to Anchr” functionality without leaving the current tab. - ShareX Integration – ShareX’s “Custom Uploaders” can point to the
/api/imagesendpoint, automatically encrypting images client‑side before upload. - Telegram Bot – The
@AnchrBotforwards messages to the API; developers can hook into bot commands (e.g.,/shorten,/bookmark) to automate workflows. - Webhook Support – While not yet fully documented, the API can be extended to emit events (link created, image uploaded) via webhooks. A simple
POST /api/webhookendpoint can be added to trigger downstream services. - Plugin System – Currently minimal, but the architecture allows adding new routes or middleware without touching core code. For example, a custom analytics plugin could hook into the request lifecycle.
Developer Experience
Anchr ships with comprehensive TypeScript type definitions for both client and server, making it easy to integrate
Open SourceReady to get started?
Join the community and start self-hosting Anchr today
Related Apps in other
Immich
Self‑hosted photo and video manager
Syncthing
Peer‑to‑peer file sync, no central server
Strapi
Open-source headless CMS for modern developers
reveal.js
Create stunning web‑based presentations with HTML, CSS and JavaScript
Stirling-PDF
Local web PDF editor with split, merge, convert and more
MinIO
Fast, S3-compatible object storage for AI and analytics
Weekly Views
Repository Health
Information
Explore More Apps
Simple Machines Forum
Open‑source, customizable community forum software
Fider
Collect, vote, and build product features together
ESMira
Self-hosted Experience Sampling research platform
Gogs
Lightweight, self‑hosted Git service for any platform
Linkwarden
Collaborative, self‑hosted bookmark manager with preservation
WikiDocs
Databaseless markdown flat‑file wiki engine