Skip to content
georgemandisPublic

About

Made a "go link" toy in Deno

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

20 Commits

Folders and files

Repository files navigation

Go Links Server & CLI Tool

JSR JSR Score

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/golinks

Run golinks

Features

  • 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

Setup

Quick Start (Development)

  1. Add go to your hosts file:

    echo "127.0.0.1 go" | sudo tee -a /etc/hosts
  2. Install and run:

    # Start the server (requires sudo for port 80)
    deno task start

Global Installation

Use Deno's install command with the --global flag to install it globally.

  1. 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.

  2. Add go to 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 go to something else if you like.

  3. Start the server:

    golinks --server

    Or, if you pulled down the source and opted not ot install it locally:

    deno task start

Usage

Web Interface

Visit http://go/_ to:

  • Add new links
  • View existing links
  • Delete links
  • View statistics

Command Line

Development Usage

# 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

Global CLI Usage (after global installation)

# 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 --help

Using Links

Once created, access your links at:

  • http://go/gh → redirects to GitHub
  • http://go/docs → redirects to your documentation
  • etc.

Or manage and use them via the CLI

  • golinks gh → redirects to GitHub
  • golinks docs → redirects to your documentation
  • etc.

API Documentation

This package provides a programmatic API for managing Go Links. View the full API documentation at JSR.io.

Basic Usage

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();

Server Integration

import { handleRequest } from "@georgemandis/golinks";

// Use with Deno.serve
Deno.serve({ port: 80 }, handleRequest);

Database Location

Links are stored in ~/.golinks/db.sqlite

Requirements

  • Deno 1.40+
  • sudo access (for binding to port 80)
  • go added to your hosts file (Optionally)

About

Made a "go link" toy in Deno

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages