GithubHelp home page GithubHelp logo

umitanilkilic / advanced-url-shortener Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 14.7 MB

Advanced Url Shortener written in golang

License: MIT License

Go 86.94% Batchfile 0.58% HTML 7.91% JavaScript 4.56%
api go golang postgresql redis-cache url url-shortener

advanced-url-shortener's Introduction

GitHub License GitHub go.mod Go version Go Report Card

⚠️ This project is currently under development. However, the current version is functional.

URL SHORTENER - SPECS

  • A sign up page
  • A sign in page
  • Create a new short URL page
  • A short URL should have a URL that it points to
    • A name
    • An ID
    • A flag that keeps track whether the short URL is active and accessible - if this is set to false by the user it the short url should give 404
  • List URLS page
    • Users should be able to delete individual lists here
    • Users should be able to bulk delete lists here
    • Users should be able to order by creation date, update date, and clicks
  • A detail page
    • Users should be able to delete and edit the URL - AKA where it points to, if it is active, change the name etc. but the id should be read only
    • It should contain stats on the URL
      • How many times it has been clicked
      • IP addresses of the clicks
      • Device info of the clicks
      • Mobile vs Desktop

HOW TO USE API

Auth API

Login

  • POST /api/auth/login
    • Authenticate user.
    • Request Body:
      {
          "email": "[email protected]",
          "password": "pikacu123"
      }

Register

  • POST /api/auth/register
    • Register a new user.
    • Request Body:
      {
          "email": "[email protected]",
          "password": "pikacu123"
      }

URL Management

Get URL Details

  • GET /api/auth/urls/:urlId
    • Retrieve details of a specific URL.

Get URLs (with Pagination)

  • GET /api/auth/urls
    • Retrieve URLs with pagination.
    • Query Parameters:
      • limit: Number of URLs per page (default: 20).
      • page: Page number (default: 1).

Create URL

  • POST /api/auth/urls/
    • Create a new shortened URL.
    • Request Body:
      {
          "name": "example",
          "long": "https://example.com",
          "alias": "example",
          "expires_at": "2022-01-01T00:00:00Z"
      }

Delete URLs (Bulk)

  • DELETE /api/auth/urls/
    • Delete multiple URLs at once.
    • Request Body:
      {
          "urls_ids": ["url_id1", "url_id2"]
      }

Delete URL

  • DELETE /api/auth/urls/:urlId
    • Delete a specific URL.

Update URL

  • PATCH /api/auth/urls/:urlId
    • Update details of a specific URL.
    • Request Body:
      {
          "active": true,
          "alias": "example",
          "name": "example",
          "long": "https://example.com",
          "expires_at": "2022-01-01T00:00:00Z"
      }

Get URL Stats

  • GET /api/auth/urls/stats/:urlId
    • Get statistics of a specific URL.

Environment Variables

This application relies on the following environment variables for proper functioning:

  • APP_ADDRESS: Specifies the address where the application is accessible.
  • DATABASE_URL: Specifies the URL for the database connection. (Postgres)
  • AUTH_SECRET: Specifies the secret key used for authentication and session management.
  • REDIS_URL: Specifies the URL for the Redis database connection.

Please ensure that these environment variables are correctly configured for the successful operation of the application.

TODO

  • Dockerize the application
  • Improve configuration management
  • Add tests
  • Add UI
  • Redis integration for caching

advanced-url-shortener's People

Contributors

umitanilkilic avatar

Watchers

 avatar

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.