A minimalist URL shortener service built with Go and Redis. https://sorame.danials.space/
Find a file
2025-04-12 13:25:40 +03:30
common feat: enhance logging middleware to minimize sensitive data exposure and improve request/response logging structure; add privacy policy and terms of service pages with footer links 2025-04-12 13:20:11 +03:30
database Implement Sorame service with Redis integration, including Docker configuration, logging middleware, and link management API. Add environment loading and error handling utilities. 2025-04-12 04:27:17 +03:30
dto Implement Sorame service with Redis integration, including Docker configuration, logging middleware, and link management API. Add environment loading and error handling utilities. 2025-04-12 04:27:17 +03:30
handler feat: update link redirection to include original URL as a parameter for sharing functionality 2025-04-12 13:20:55 +03:30
model feat: implement unique link ID generation in Redis with collision handling 2025-04-12 05:23:32 +03:30
static feat: enhance logging middleware to minimize sensitive data exposure and improve request/response logging structure; add privacy policy and terms of service pages with footer links 2025-04-12 13:20:11 +03:30
.dockerignore feat: add .dockerignore file to exclude Redis-related files from Docker builds 2025-04-12 13:25:40 +03:30
.env.template Add Redis database configuration to .env.template and update credential generation script to include REDIS_DB variable 2025-04-12 04:08:48 +03:30
.gitignore init 2025-04-12 02:37:38 +03:30
build_linux.sh feat: add build script for Linux and include GNU General Public License 2025-04-12 05:36:00 +03:30
docker-compose.yml fix: update Redis data volume path in docker-compose file 2025-04-12 05:06:10 +03:30
Dockerfile Add initial setup for Sorame service with Docker and environment configuration 2025-04-12 03:36:26 +03:30
generate_credentials.py Add Redis database configuration to .env.template and update credential generation script to include REDIS_DB variable 2025-04-12 04:08:48 +03:30
generate_credentials.sh Enhance password generation by removing special characters and whitespace; source .env file in the credential generation script 2025-04-12 03:44:55 +03:30
go.mod Implement Sorame service with Redis integration, including Docker configuration, logging middleware, and link management API. Add environment loading and error handling utilities. 2025-04-12 04:27:17 +03:30
go.sum Implement Sorame service with Redis integration, including Docker configuration, logging middleware, and link management API. Add environment loading and error handling utilities. 2025-04-12 04:27:17 +03:30
LICENSE feat: add build script for Linux and include GNU General Public License 2025-04-12 05:36:00 +03:30
main.go Refactor API routes to remove versioning, update link handling to redirect instead of returning JSON, and enhance static file serving with improved path handling. Add custom 404 error page and initial HTML structure for the main application. 2025-04-12 04:56:55 +03:30
README.md feat: add build script for Linux and include GNU General Public License 2025-04-12 05:36:00 +03:30

Sorame

A minimalist URL shortener service built with Go and Redis.

🌐 Live Demo

Features

  • Fast URL shortening
  • 🔗 Clean, shortened URLs
  • 📱 Responsive, minimal design
  • 📋 Automatic clipboard copy
  • 30-day link expiration
  • 🔒 URL validation
  • 🌍 Hosted at sorame.danials.space

Tech Stack

  • Backend: Go - Fast, reliable server implementation
  • Database: Redis - In-memory data store for quick access
  • Frontend: Vanilla JavaScript, HTML, CSS - Lightweight and performant

API Endpoints

  • POST /link - Create a shortened URL

    {
      "data": "https://your-long-url.com"
    }
    

    Returns a shortened URL ID

  • GET /link/{shareID} - Redirect to original URL

    • Fast redirect to the original destination
    • Validates URL before redirect

Prerequisites

  • Go 1.19 or higher
  • Docker
  • Docker Compose

Environment Variables

The project uses environment variables for configuration. To set them up, Run the provided script to generate secure credentials:

bash generate_credentials.sh

This will:

  • Create .env file from template if not exists
  • Generate secure random passwords
  • Set up required Docker network
  • Configure Redis credentials

Installation & Development

  1. Clone the repository

    git clone https://github.com/danial2026/sorame.git
    cd sorame
    
  2. Install dependencies

    export GOPROXY=direct && export GOSUMDB=off  && go mod tidy
    
  3. Start Redis

    docker-compose -f docker-compose.yml up -d redis-service redis-commander
    
  4. Run the application

    go run ./main.go
    

The service will be available at http://localhost:3000

Deployment

# Build for linux production
bash build_linux.sh

# Run with Docker
docker-compose -f docker-compose.yml up -d

Contributing

Contributions are welcome! Feel free to submit issues and pull requests.

License

This project is open source and available under the GNU GENERAL PUBLIC LICENSE.