Skip to main content
Home

Built and signed on GitHub Actions

CLI tool for managing go links locally on your machine.

This package works with Deno
This package works with Deno
JSR Score
100%
Published
3 months ago (0.1.5)

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

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)
Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@georgemandis/golinks

Import symbol

import * as golinks from "@georgemandis/golinks";
or

Import directly with a jsr specifier

import * as golinks from "jsr:@georgemandis/golinks";