A simple go link redirect server built with Deno that allows you to create short
links accessible via a local hostname (e.g. go/<shortcut>) or CLI interface.
If have Deno installed and you don't want to pull down the code you can install the script like so:
deno install --global --allow-read --allow-write --allow-env --allow-net --allow-run jsr:@georgemandis/golinksRun golinks
- HTTP Server: Binds to port 80 (default)
- Web Management: Accessible at
http://go/_(or whatever hostname you choose) - Command Line Interface: Manage links from the terminal (see below)
- SQLite Storage: Links stored in
~/.golinks/db.sqlite - Click Tracking: Monitor link usage statistics
-
Add
goto your hosts file:echo "127.0.0.1 go" | sudo tee -a /etc/hosts
-
Install and run:
# Start the server (requires sudo for port 80) deno task start
Use
Deno's install command
with the --global flag to install it globally.
-
Install globally:
deno install --global --allow-read --allow-write --allow-env --allow-net --allow-run --config deno.json --name golinks cli.ts
You can rename it to something else if you like.
-
Add
goto your hosts file (if not already done):echo "127.0.0.1 go" | sudo tee -a /etc/hosts
This step is very optional and you can change
goto something else if you like. -
Start the server:
golinks --server
Or, if you pulled down the source and opted not ot install it locally:
deno task start
Visit http://go/_ to:
- Add new links
- View existing links
- Delete links
- View statistics
# Add a new link
deno task cli --shortcut gh --url https://github.com
# List all links
deno task cli --list
# Delete a link
deno task cli --delete --shortcut gh
# Show statistics
deno task cli --stats
# Show help
deno task cli --help# Add a new link
golinks --shortcut gh --url https://github.com
# List all links
golinks --list
# Delete a link
golinks --delete --shortcut gh
# Show statistics
golinks --stats
# Start the server
golinks --server
# Open a shortcut directly in your browser
golinks gh
# Show help
golinks --helpOnce created, access your links at:
http://go/gh→ redirects to GitHubhttp://go/docs→ redirects to your documentation- etc.
Or manage and use them via the CLI
golinks gh→ redirects to GitHubgolinks docs→ redirects to your documentation- etc.
This package provides a programmatic API for managing Go Links. View the full API documentation at JSR.io.
import { GoLinksDB, type GoLink } from "@georgemandis/golinks";
const db = new GoLinksDB();
await db.init();
// Add a new link
db.addLink("gh", "https://github.com", "GitHub homepage");
// Get a link
const link = db.getLink("gh");
console.log(link?.url); // "https://github.com"
// List all links
const allLinks = db.getAllLinks();
// Update a link
db.updateLink("gh", "https://github.com/myusername", "My GitHub profile");
// Delete a link
db.deleteLink("gh");
// Clean up
db.close();import { handleRequest } from "@georgemandis/golinks";
// Use with Deno.serve
Deno.serve({ port: 80 }, handleRequest);Links are stored in ~/.golinks/db.sqlite
- Deno 1.40+
- sudo access (for binding to port 80)
goadded to your hosts file (Optionally)