Skip to content

nitzanpap/url-shortener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

URL Shortener

Introduction

This is a simple URL shortener project, made for learning purposes.

It is similar to Bit.ly or TinyURL, and allows users to input a long URL and receive a shortened version of it. This makes sharing links easier and helps in tracking and managing URLs.

View the live application here 👈.

Features

  • Shorten URLs: Convert long URLs into manageable short links.
  • Easy to use: Simple interface for creating and managing URLs.

Technologies

  • Backend: Go, Gin
  • Database: PostgreSQL
  • Frontend: Next.js, TypeScript, SCSS.modules

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

What things you need to install the software and how to install them:

For the server:

For the client:

Installing

A step by step series of examples that tell you how to get a development env running:

  1. Clone the repository:

    git clone github.com/nitzanpap/url-shortener
  2. Change into the project directory:

    cd url-shortener

Server Setup

  • Note: If you are using VS Code, you can use the Go extension to install the necessary tools and dependencies.
  1. Change into the server directory:

    cd server
  2. Create a .env file in the server directory:

    touch .env

    Make sure to populate the .env file according to the .env.example file.

  3. Run the server via make:

    • For development, run with live reload:

      make run/live
    • Or build and run the server:

      1. Manually:

        make build && make run
      2. Via Docker:

        docker compose up

Client Setup

  1. Change into the client directory:

    cd client
  2. Create a .env.local file in the client directory:

    touch .env.local

    Make sure to populate the .env.local file according to the .env.example file.

  3. Install the dependencies:

    npm install
  4. Run the development server:

    • For development:

      npm run dev
    • For production:

      npm run build && npm start

Debugging

If you are using VS Code, you can use the launch.json configurations to debug the server and client code.

Deployment

I am deploying the server to render.com and the client to Vercel. You can deploy the server and client to any platform of your choice.