Skip to content

Latest commit

 

History

History
31 lines (26 loc) · 1.14 KB

README.md

File metadata and controls

31 lines (26 loc) · 1.14 KB

URL Shortener

Tech Stack- Go, Air, Postgres(For Live Deploy, probably will use NeonDB), htmx, templ This is my Postman Collection

Tentative Database Schema designed

CREATE TABLE guest_users (
    id SERIAL PRIMARY KEY,
    guest_id VARCHAR(36) UNIQUE NOT NULL,
    created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE urls (
    id SERIAL PRIMARY KEY,
    original_url TEXT NOT NULL,
    short_code VARCHAR(10) UNIQUE NOT NULL,
    created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
    expires_at TIMESTAMP WITH TIME ZONE,
    click_count INTEGER DEFAULT 0,
    guest_user_id INTEGER REFERENCES guest_users(id) ON DELETE SET NULL
);

CREATE INDEX idx_urls_short_code ON urls(short_code);
CREATE INDEX idx_urls_guest_user_id ON urls(guest_user_id);

Reference Links

Why _ is used while importing SQL Drivers HTMX Docs Templ Official Guide