Skip to content

Aryan-Go/url-shortner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

URL Shortener

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.


Features

  • Shorten long URLs with a unique short code
  • Redirect users to original URLs via short links
  • Validation checks:
    • Ensures URLs start with http or https
    • Verifies the URL host is valid
    • Checks if the URL is "legit" before shortening
  • Frontend feedback for success and errors
  • CORS-enabled for React frontend integration
  • Logs all requests for monitoring and debugging

Tech Stack

Layer Technology
Frontend React, TailwindCSS, Axios
Backend Go, Gin Framework
Database PostgreSQL
Environment dotenv for configuration

Getting Started

Backend Setup

  1. Clone the repo:
git clone https://github.com/Aryan-Go/url-shortner
cd backend
  1. Install dependencies:
go mod tidy
  1. 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
  1. Run PostgreSQL:
psql -U postgres
CREATE TABLE urls (
  id SERIAL PRIMARY KEY,
  long_url TEXT,
  short_code VARCHAR(10)
);
  1. Run the backend server:
go run main.go

Frontend Setup

  1. Navigate to frontend folder:
cd frontend
  1. Install dependencies:
npm i
  1. Run the frontend development server:
npm run dev

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Contact

For questions or support, please open an issue on GitHub.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published