https://github.com/fivehanz/qwynk
url shortner made (making) w/ rust (loco.rs)
https://github.com/fivehanz/qwynk
elixir phoenix url urlshortner
Last synced: 6 months ago
JSON representation
url shortner made (making) w/ rust (loco.rs)
- Host: GitHub
- URL: https://github.com/fivehanz/qwynk
- Owner: fivehanz
- Created: 2024-08-01T17:03:23.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-09T08:47:19.000Z (over 1 year ago)
- Last Synced: 2025-01-22T08:37:15.424Z (over 1 year ago)
- Topics: elixir, phoenix, url, urlshortner
- Language: Elixir
- Homepage:
- Size: 117 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Qwynk
**Qwynk** is a high-performance, privacy-centric URL shortener and link manager.
* It separates the redirect engine (ETS-backed) from the analytics engine (Async Batching).
## Tech Stack
* **Core:** Elixir 1.18+ / OTP 26+, Phoenix 1.8, Ash Framework 3.0
* **Data:** PostgreSQL 16+, ETS (Erlang Term Storage)
* **Frontend:** LiveView v1, Tailwind v4 + Daisy UI v5, D3.js
* **Geo:** MaxMind GeoLite2 (Local MMDB)
## Directory Structure
* `lib/qwynk/traffic/` - Link management & Slug logic.
* `lib/qwynk/analytics/` - Hit logging & GeoIP.
* `lib/qwynk/accounts/` - User auth.
## Architecture
[Image of Qwynk Data Flow Diagram]
1. **The Bouncer:** Incoming traffic hits the Phoenix Endpoint.
2. **The Cache:** Lookups happen in RAM (ETS).
3. **The Vault:** Persistent data lives in Postgres, managed by Ash Resources.
4. **The Ledger:** Analytics are hashed (anonymized) and buffered before writing.
## Prerequisites (FreeBSD)
* Elixir 1.18+ & Erlang/OTP 26+ (verified in mise.toml)
* PostgreSQL 16+
* `gmake` and `clang` (Required for `picosat` NIF compilation)
* MaxMind City Database (`GeoLite2-City.mmdb`) placed in `priv/geoip/`
## Configuration
Set the following environment variables in your `sys.rc` or `.env`:
```bash
export SECRET_KEY_BASE="your_secure_key"
export DATABASE_URL="postgres://user:pass@localhost/qwynk_prod"
export PHX_HOST="jsmx.org"
export POOL_SIZE=10