An open API service indexing awesome lists of open source software.

https://github.com/majdsassi/go-url

Go-Url is a modern, full-stack URL shortener built using Go. It leverages the Gin framework for routing, GORM for ORM/database management, and HTMX for dynamic, responsive frontend behavior. Ideal for developers seeking a practical example of a Go web app with a modern frontend.
https://github.com/majdsassi/go-url

backend gin-framework gin-gonic go go-backend go-htmx go-project golang gorm-orm htmx link-shortener self-hosted url url-shortener

Last synced: 5 months ago
JSON representation

Go-Url is a modern, full-stack URL shortener built using Go. It leverages the Gin framework for routing, GORM for ORM/database management, and HTMX for dynamic, responsive frontend behavior. Ideal for developers seeking a practical example of a Go web app with a modern frontend.

Awesome Lists containing this project

README

          

# Go-Url

A modern, self-hosted URL shortener built with Go, Gin, GORM, and HTMX.
## ๐Ÿ’ปDemo
![image](https://github.com/user-attachments/assets/ae72d36d-6c8c-4cb6-a95d-87838d9d5932)

## โœจ Features

- โœ… Create and manage shortened URLs
- ๐Ÿš€ Fast redirects using Gin
- ๐Ÿ—ƒ๏ธ Persistent storage with GORM and MySQL
- โšก Dynamic frontend updates via HTMX (no page reloads)
- ๐Ÿ” Unique shortcodes generation
- ๐Ÿ“Š Link Visits

## ๐Ÿ—๏ธ Tech Stack

- [Go](https://golang.org/)
- [Gin](https://github.com/gin-gonic/gin) - High-performance web framework
- [GORM](https://gorm.io/) - ORM for Go
- [HTMX](https://htmx.org/) - Modern frontend interaction without full-page reloads

## ๐Ÿงช Getting Started

### 1. Clone the Repository

```bash
git clone https://github.com/majdsassi/go-url.git
cd go-url
```
### 2 . Install Dependencies
```go
go mod tidy
```
### 3. Create your local variables
```env
DBURL="db_user:db_password@tcp(127.0.0.1:3306)/db_name?charset=utf8mb4&parseTime=True&loc=Local"
```
(if your db does require a password leave it empty and if ur db is remote change the tcp values with db_url:port )
### 5. Migrate Your Database
```go
go run migration/migrate.go
```
### 6. Run Your App
```go
go run main.go
```
OR Run it Using [CompileDaemon](https://github.com/githubnemo/CompileDaemon)
```bash
CompileDaemon -command="./go-url"
```
## ๐Ÿ“„ License

MIT License. See [LICENSE](https://medium.com/@avinashvagh/github-licenses-explained-a-quick-guide-46d98ef4ca81)for details.
## ๐Ÿค Contributing
Pull requests welcome. If you want to add features like analytics, expiration, or QR code generationโ€”go for it!