GithubHelp home page GithubHelp logo

burry's Introduction

Burry URL Shortener

Burry Logo

Burry is a lightweight URL shortener written in Go. It allows you to shorten URLs, store them in a cache and use the short link to be redirected to the original URL. The service has been tested with Redis and Garnet as caching solutions.

Features

  • Shorten URLs: Create shorter versions of long URLs.
  • Cache Storage: Store shortened URLs in a cache for quick retrieval.
  • Redirection: Redirect to the original URL using the shortened link.
  • Deployable: Can be run using Docker Compose or in a Kubernetes cluster.

Endpoints

1. POST /shorten

Create a shortened URL.

Request:

{
  "long_url": "https://example.com"
}

Response:

{
  "short_url": "https://<your-domain>/<shortlink>"
}

2. GET /<short_url>

Redirect to the original URL.

Getting Started

Prerequisites

  • Go 1.15+
  • Docker
  • Docker Compose
  • Kubernetes (optional)

Environment Variables

  • REDIS_ADDR: The address of the cache (e.g. redis or garnet) server (e.g., localhost:6379).

Running with Docker Compose

  1. Clone the repository:

    git clone https://github.com/gerrited/burry.git
    cd burry
  2. Start the services:

    docker-compose up --build

Running in a Kubernetes Cluster

  1. Clone the repository:

    git clone https://github.com/gerrited/burry.git
    cd burry
  2. Set up the environment variable in your Kubernetes configuration:

    env:
      - name: REDIS_ADDR
        value: "redis-service:6379"
  3. Deploy the service:

    kubectl apply -f k8s/

Usage

The app runs on port 8080.

Shorten a URL

curl -X POST -H "Content-Type: application/json" -d '{"long_url": "https://example.com"}' https://<your-domain>/shorten

Use a short link

Navigate to https://<your-domain>/<shortlink> in your browser.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

burry's People

Contributors

gerrited avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.