Skip to content

dipo0x/URL-Shortener

Repository files navigation

Go-fiber URL shortener

Introduction

This is a RESTful API built using Golang, Fiber, Postgresql, RabbitMQ and Reflex. This API provides a simple implementation for scheduling jobs in Go.

Setup

Clone the repository to your local machine.

git clone https://github.com/dipo0x/url-shortener

Ensure that you have Golang, PostgreSQL and RabbitMQ installed on your machine. Alternatively, you can use their cloud service.

Navigate to the root directory of the project in a terminal.

cd url-shortener

Run the following command to install the necessary dependencies

go install

After that, run this command to create a .env file with which you can get started.

bash build/scripts/setup.sh

After that, run this command to install migrate on your cmd so that you can create a migration for your models

go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest

Once the installation is successful, run this command to run the create table migration

make migrate-up

Running Server

Locally

Run the following command to start the server and start up rabbitmq instance:

reflex -c .reflex
go run cmd/worker/main.go

For clarity sake, the first command spins up your development server while the second one spins up the RabbitMQ receiver. When you run the first command, you will see something similar to this: Screenshot 2025-10-08 at 12 39 14 AM

When you run the second command, you will see something similar to this:

Screenshot 2025-10-08 at 12 39 20 AM
The server will run on http://localhost:8080 by default

Test

To test the endpoints, run this command :

go test ./tests/

If all your tests are successful, you will see this:
Screenshot 2025-10-08 at 12 43 32 AM


else, you will see something similar to this:
Screenshot 2025-05-11 at 5 47 01 PM

Available Endpoints

Base URL[dev]: 0.0.0.0:8080/\

When your server is running, call the base endpoint to ensure it is up, and you will receive a response like this:

Screenshot 2025-05-10 at 11 20 43 PM

Conclusion

You can find additional documentation for this API, including request and response signatures, by visiting https://documenter.getpostman.com/view/17975360/2sB2j999pk in your web browser.

About

A URL shorterning API built using Golang, Fiber, PostgreSQL and RabbitMQ.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published