Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/pradumnasaraf/shortify
- Owner: Pradumnasaraf
- License: apache-2.0
- Created: 2023-05-13T08:22:57.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-27T18:44:20.000Z (over 1 year ago)
- Last Synced: 2024-10-04T17:26:49.363Z (3 months ago)
- Topics: fiber, golang, redis
- Language: Go
- Homepage:
- Size: 66.4 KB
- Stars: 9
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
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.