A modern URL shortener built with SvelteKit and Turso (libSQL). Features link management, click tracking, and referrer analytics.
The application uses Turso (libSQL) with two main tables:
id
: Unique identifiersource
: Short URL pathdestination
: Target URLposition
: Order positiondescription
: Link descriptionclicks
: Click countervisible
: Visibility flagTURSO_DB_URL=your_database_url
TURSO_DB_AUTH_TOKEN=your_auth_token
TURSO_SYNC_URL=your_sync_url # Optional
INSERT INTO links (source, destination, description, visible, position)
VALUES ('key', 'https://destination.com', 'Description', true, 1);
UPDATE links
SET destination = 'new-url', description = 'new description'
WHERE source = 'key';
DELETE FROM links WHERE source = 'key';
-- All visible links
SELECT * FROM links WHERE visible = true;
-- Most clicked links
SELECT source, destination, clicks
FROM links
ORDER BY clicks DESC
LIMIT 10;
-- Top referrers
SELECT r.referrer, SUM(r.count) as total_referrals
FROM referrers r
GROUP BY r.referrer
ORDER BY total_referrals DESC
LIMIT 10;
# Install dependencies
pnpm install
# Run development server
pnpm dev
# Run tests
pnpm test