CreepURL / README.md
dipan004's picture
Update README.md
635ba26 verified
|
Raw
History Blame Contribute Delete
7.15 kB
metadata
title: CreepURL
sdk: docker
emoji: πŸ¦€
colorFrom: yellow
colorTo: red

CreepURL

"Destroy trust beautifully."

A full-stack URL shortener that transforms normal URLs into computationally cursed, infrastructure-style slugs. Built with Go + SQLite (zero external dependencies) and React + Framer Motion.

All generated URLs are real working redirects β€” click one and it sends you back to the original URL.


Instant Start (No database setup required)

# Clone
git clone https://github.com/yourname/creepurl.git
cd creepurl

# Backend β€” SQLite file auto-created on first run
cd backend
cp .env.example .env
go mod tidy
go run main.go

# Frontend β€” open a new terminal
cd frontend
npm install
npm run dev

Open http://localhost:3000. Done.

The backend creates backend/creepurl.db automatically on first startup. No Postgres. No pgAdmin. No Docker. No setup.


Tech Stack

Frontend

Tech Purpose
React 18 + TypeScript UI framework
Tailwind CSS Styling
Framer Motion Animations
Vite Build tooling
Axios HTTP client

Backend

Tech Purpose
Go 1.21 Server language
Fiber v2 HTTP framework
SQLite (modernc.org/sqlite) Embedded database β€” zero install
godotenv Env config

Project Structure

creepurl/
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ layout/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Navbar.tsx
β”‚   β”‚   β”‚   β”‚   └── Footer.tsx
β”‚   β”‚   β”‚   └── features/
β”‚   β”‚   β”‚       β”œβ”€β”€ BackgroundEffects.tsx
β”‚   β”‚   β”‚       β”œβ”€β”€ Hero.tsx
β”‚   β”‚   β”‚       β”œβ”€β”€ InputPanel.tsx
β”‚   β”‚   β”‚       β”œβ”€β”€ DestructionSlider.tsx
β”‚   β”‚   β”‚       β”œβ”€β”€ URLCard.tsx
β”‚   β”‚   β”‚       β”œβ”€β”€ ResultsSection.tsx
β”‚   β”‚   β”‚       β”œβ”€β”€ MetricsPanel.tsx
β”‚   β”‚   β”‚       └── ErrorState.tsx
β”‚   β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   β”‚   └── useTransform.ts
β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”‚   └── api.ts
β”‚   β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”‚   └── utils.ts
β”‚   β”‚   β”œβ”€β”€ App.tsx
β”‚   β”‚   β”œβ”€β”€ main.tsx
β”‚   β”‚   └── index.css
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ vite.config.ts
β”‚   β”œβ”€β”€ tailwind.config.js
β”‚   └── tsconfig.json
β”‚
└── backend/
    β”œβ”€β”€ config/
    β”‚   └── config.go          ← DB_PATH env var
    β”œβ”€β”€ database/
    β”‚   β”œβ”€β”€ database.go        ← SQLite connect + migrate
    β”‚   └── migrations.sql     ← Reference schema (auto-runs on startup)
    β”œβ”€β”€ generators/
    β”‚   β”œβ”€β”€ corruption.go      ← Display URL generator
    β”‚   └── slug.go            ← URL-safe slug generator
    β”œβ”€β”€ handlers/
    β”‚   β”œβ”€β”€ transform.go       ← POST /api/transform
    β”‚   └── redirect.go        ← GET /:slug + GET /api/stats/:slug
    β”œβ”€β”€ middleware/
    β”‚   └── middleware.go
    β”œβ”€β”€ models/
    β”‚   └── models.go
    β”œβ”€β”€ routes/
    β”‚   └── routes.go
    β”œβ”€β”€ services/
    β”‚   β”œβ”€β”€ shortener.go       ← DB persistence + lookup + click tracking
    β”‚   └── transform.go       ← Business logic + trust metrics
    β”œβ”€β”€ main.go
    β”œβ”€β”€ go.mod
    β”œβ”€β”€ .env.example
    └── creepurl.db            ← Auto-created on first run (gitignored)

Environment Variables

Backend (backend/.env)

Variable Default Description
PORT 8080 Server port
BASE_URL http://localhost:8080 Used to build full short URLs
DB_PATH ./creepurl.db SQLite file path
ENVIRONMENT development Runtime label

Frontend (frontend/.env)

Variable Default Description
VITE_API_URL /api Backend API base path

API Documentation

POST /api/transform

Generates cursed slugs, persists them, returns real short URLs.

Request:

{
  "url": "https://google.com",
  "destruction_level": 4
}

Response:

{
  "links": [
    {
      "slug": "sh-g00g__relay882--voidxr09",
      "full_short_url": "http://localhost:8080/sh-g00g__relay882--voidxr09",
      "display_url": "http://localhost:8080/sh-g00g__relay882--voidxr09"
    }
  ],
  "metrics": {
    "trust_stability": "14%",
    "packet_integrity": "Corrupted",
    "machine_confidence": "Collapsed",
    "human_readability": "Terminal"
  }
}

GET /:slug

Redirects to the original URL. Increments click count.

GET /sh-g00g__relay882--voidxr09
β†’ 301 https://google.com

GET /api/stats/:slug

Returns analytics for a slug without redirecting.

{
  "slug": "sh-g00g__relay882--voidxr09",
  "original_url": "https://google.com",
  "full_short_url": "http://localhost:8080/sh-g00g__relay882--voidxr09",
  "click_count": 42,
  "created_at": "2025-01-01T00:00:00Z",
  "last_clicked_at": "2025-01-02T12:00:00Z"
}

GET /health

{ "status": "operational", "version": "1.0.0" }

Destruction Levels

Level Name Slug style
1 Slightly Suspicious google-rel-x77
2 Corrupted g00gle-relay-x77
3 Infrastructure Horror g00g__relay-shad-x77
4 Machine Corruption sh-g00g__relay882-void
5 Computational Collapse s-g0__re882__voidxr09

How the Slug Engine Works

Input: https://google.com
  ↓
Extract domain fragment: "google" β†’ "g00g"   (char mutation)
  ↓
Inject infra word: relay, cache, frag, sync...
  ↓
Inject corruption word: shadow, void, echo...
  ↓
Inject machine ID: x77, xr09, 882, v0id...
  ↓
Combine with separator: __, --, -
  ↓
Slug: sh-g00g__relay882--void
  ↓
Store in SQLite β†’ return http://localhost:8080/sh-g00g__relay882--void
  ↓
Click link β†’ 301 β†’ https://google.com

Building for Production

Backend binary

cd backend
go build -o creepurl-server main.go
./creepurl-server

Frontend static build

cd frontend
npm run build
# Output: frontend/dist/

Deployment

Frontend β†’ Vercel

cd frontend
npx vercel --prod

Set VITE_API_URL to your backend URL in Vercel dashboard.

Backend β†’ Fly.io

cd backend
fly launch
fly deploy

Set BASE_URL to your deployed domain in Fly secrets:

fly secrets set BASE_URL=https://your-app.fly.dev

SQLite works great on single-instance deployments. For multi-instance scaling, swap modernc.org/sqlite driver for lib/pq and point DB_PATH at a Postgres connection string β€” the database/sql interface is identical, so only database.go changes.


Gitignore additions

Add to your .gitignore:

backend/creepurl.db
backend/creepurl.db-shm
backend/creepurl.db-wal
backend/.env
frontend/.env

License

MIT


⚠️ All generated slugs and display URLs are for satirical/portfolio purposes. The redirect system is real and functional.