Skip to content

PPabloMunoz/GoShort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoShort 🚀

GoShort Preview

A minimal, high-performance, self-hosted URL shortener built with Go. It features a modern brutalist web interface and a simple RESTful API.

✨ Features

  • Lightning Fast: Built with Go and Gin for high performance.
  • Brutalist UI: Simple, clean, and functional web interface.
  • REST API: Easy to integrate with other tools and services.
  • SQLite Backend: Lightweight data persistence with WAL mode enabled.
  • Analytics: Basic click tracking for your shortened URLs.
  • Self-Hosted: Designed to be easily deployed on your own infrastructure.

🛠️ Technology Stack

  • Backend: Go (Gin Gonic)
  • Database: SQLite
  • Frontend: HTML, CSS, JavaScript (Vanilla)
  • Task Runner: Just
  • Live Reload: Air

🚀 Getting Started

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/ppablomunoz/GoShort.git
    cd GoShort
  2. Install dependencies:

    go mod tidy
  3. Run the application:

    just run
    # or
    go run cmd/main.go

Running with Docker

You can also run the application using Docker Compose:

docker-compose up -d

The server will start at http://localhost:8000.

Backup & Recovery (Docker)

Since the application uses SQLite, creating a backup is as simple as copying the database file.

Backup from container to host:

docker cp goshort-app:/root/db/GoShort.db ./backup.db

Note: If you are using the default docker-compose.yml, your database is already persisted in the ./db folder on your host machine.

📡 API Endpoints

Method Endpoint Description
POST /api/url Create a new short URL
GET /api/url List all shortened URLs
PUT /api/url/:code Update a short URL
DELETE /api/url/:code Delete a short URL
GET /:code Redirect to original URL

🛠️ Development

For development with live reloading:

just air

📄 License

MIT License. See LICENSE for more information.

About

GoShort: A simple, lightweight, self-hosted URL shortener built with Go and SQLite.

Resources

License

Stars

Watchers

Forks

Contributors