A fast, secure, and reliable URL shortening service built with Go (Gin framework) for the backend, PostgreSQL as the database, and React + TailwindCSS for the frontend. Generate short, memorable URLs and manage them efficiently.
- Shorten long URLs with a unique short code
- Redirect users to original URLs via short links
- Validation checks:
- Ensures URLs start with
httporhttps - Verifies the URL host is valid
- Checks if the URL is "legit" before shortening
- Ensures URLs start with
- Frontend feedback for success and errors
- CORS-enabled for React frontend integration
- Logs all requests for monitoring and debugging
| Layer | Technology |
|---|---|
| Frontend | React, TailwindCSS, Axios |
| Backend | Go, Gin Framework |
| Database | PostgreSQL |
| Environment | dotenv for configuration |
- Clone the repo:
git clone https://github.com/Aryan-Go/url-shortner
cd backend- Install dependencies:
go mod tidy- Configure environment:
Create a .env file in the backend root:
PORT=3000
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=url_shortner
POSTGRES_HOST=localhost
POSTGRES_PORT=5432- Run PostgreSQL:
psql -U postgres
CREATE TABLE urls (
id SERIAL PRIMARY KEY,
long_url TEXT,
short_code VARCHAR(10)
);- Run the backend server:
go run main.go- Navigate to frontend folder:
cd frontend- Install dependencies:
npm i- Run the frontend development server:
npm run devFor questions or support, please open an issue on GitHub.