Shorty
Shorty is a simple and efficient URL shortener written in Go. It provides an easy way to create short, memorable links for long URLs.

Features
- Create short URLs for long links
- Redirect short URLs to their original long URLs
- View statistics for link usage
- Simple web interface
- SQLite database for storing URL mappings
- Configurable via JSON file
Installation
-
Clone the repository:
git clone https://github.com/donuts-are-good/shorty.git
-
Navigate to the project directory:
cd shorty
-
Build the project:
go build
Configuration
Shorty uses a JSON configuration file named shorty.config. You can modify this file to change the database name, server port, routes, and short URL settings.
Example configuration:
{
"database": {
"name": "./url_mapping.db"
},
"server": {
"port": ":9130"
},
"routes": {
"index": "/",
"create": "/create",
"redirect": "/_/"
},
"shortURL": {
"length": 8,
"charset": "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
}
}
Usage
To run Shorty:
./shorty
The server will start on the port specified in the configuration file (default is 9130).
Running with appserve
appserve is a reverse proxy server with automatic HTTPS. To run Shorty with appserve:
-
Install appserve:
git clone https://github.com/donuts-are-good/appserve.git
cd appserve
go build
-
Start appserve:
./appserve
-
In the appserve interactive shell, add a route for Shorty:
add yourdomain.com 9130
Replace yourdomain.com with your actual domain and 9130 with the port Shorty is running on.
-
Start Shorty as described in the Usage section.
Now, appserve will handle HTTPS and route requests to Shorty.
License
Shorty is released under the MIT License. See the LICENSE file for details.
Live Instance
A running instance of Shorty is available at https://goby.lol.