Git Product home page Git Product logo

url-shortener's Introduction

url-shortener

A service for shortening URLs, collecting and displaying statistics on visits
Related services: Bitly, Clck, Tinyurl, Goosu

Demo

Link to demo

url-shortener-preview

Features

  • Registration, authorization
  • Shortening links
  • Custom links
  • Visit statistics
  • Access control

Technology stack

Linux, Nginx, REST API, SSR, JWT, Brypt, PostgreSQL
Golang, Gorilla/mux, Gorm, Godotenv, html/template

Architecture

This application has been developed using the principles of Clean Architecture and Dependency injection. The purpose of this architecture is to create flexible, extensible and easily maintained software by dividing the code into independent layers and layers.

Layers

  • Controllers: handling requests, parsing data, forming response
  • Services: perform bussiness logic
  • Repositories: interact with database, ORM mapping
  • Entities: describe fields

Installation

To install and run this project, follow these steps:

  1. Clone the repository:
git clone https://github.com/ngrink/url-shortener.git
  1. Go to the project directory
cd url-shortener
  1. Install dependencies
go mod tidy
  1. Update env configuration
vim config/.env.local
APP_PORT=7000
APP_HOST=http://localhost:7000

POSTGRES_HOST=<POSTGRES_HOST>
POSTGRES_PORT=<POSTGRES_PORT>
POSTGRES_USER=<POSTGRES_USER>
POSTGRES_PASSWORD=<POSTGRES_PASSWORD>
POSTGRES_DB=<POSTGRES_DB>

JWT_SECRET="jwUjak517ayqnJaBZHu8i9qybzz"
REDIRECT_CACHE_CONTROL_MAX_AGE=600
  1. Build and run application
go build ./cmd/url-shortener
./url-shortener

Using prebuilt binaries

Download prebuilt binaries from the latest release, choose appropriate os/arch version. For example:

wget https://github.com/ngrink/url-shortener/releases/download/v0.2.0/url-shortener_Linux_x86_64.tar.gz
tar -zxf url-shortener_Linux_x86_64.tar.gz
./url-shortener

url-shortener's People

Contributors

ngrink avatar

Watchers

 avatar

url-shortener's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.