Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/pradumnasaraf/shortify

Shortify is a fast and reliable URL shortener written in Go, using Redis as a database and built with the Fiber web framework.
https://github.com/pradumnasaraf/shortify

fiber golang redis

Last synced: 3 months ago
JSON representation

Shortify is a fast and reliable URL shortener written in Go, using Redis as a database and built with the Fiber web framework.

Awesome Lists containing this project

README

        

# Shortify

**Shortify** is a fast and reliable URL shortener written in Go, using [Redis](https://redis.io/) as a database and built with the [Fiber](https://github.com/gofiber/fiber) web framework.

![Shortify](https://github.com/Pradumnasaraf/Shortify/assets/51878265/c52de6fa-a638-4ff9-9dfe-2009017ebba3)

## 📦 Installation

Before you begin, make sure you have [Docker](https://www.docker.com/) and [Docker Compose v2](https://docs.docker.com/compose/) installed on your machine. Then, follow these steps to install and run Shortify:

1. Clone this repository to your local machine.

2. Create a `.env` file inside the `api` folder by copying the `.env.example` file. You can do this by running the following command from the root directory of the project:

```bash
cp api/.env.example api/.env
```

3. Start the project by running the following command from the root directory of the project:
```bash
docker compose up
```

## 📝 Usage

To create a short URL, send a `POST` request to the `/api/v1` endpoint with the following JSON body:

```json
{
"url": "https://pradumnasaraf.dev",
"short": "pradumna"
}
```

The `short` field is optional. If you don't provide it, a random string will be generated. In response, you will receive the following JSON body:

```json
{
"url": "https://pradumnasaraf.dev",
"short": "localhost:8080/pradumna",
"expiry": 24,
"rate_limit": 9,
"rate_limit_reset": 30
}
```

You can modify the rate limit in the `.env` file. To test if the short URL works, enter it into your browser's address bar. For example, if the short URL is `http://localhost:8080/pradumna`, you will be redirected to the original URL.

## 📜 License

This project is licensed under the Apache-2.0 license - see the [LICENSE](LICENSE) file for details.

## 🛡 Security

If you discover a security vulnerability within this project, please check the [SECURITY](SECURITY.md) file for more information.