Skip to content

elmur0d11/LinkyUz

Repository files navigation

LinkyUz - Technical Documentation


1. Overview

LinkyUz is a URL shortening service that allows users to generate short, branded links, QR codes, and barcodes. It supports:

  • URL Shortening (generating short links from long URLs)
  • Branded Links (custom short URLs with brand names)
  • QR Code Generation (converting URLs into QR codes)
  • Barcode Generation (converting URLs into barcodes)
  • Visit Logging (tracking link visits)

The application is built using .NET 6+, ASP.NET Core, Entity Framework Core, and MongoDB for storing branded links.


2. Architecture Overview

Tech Stack

Component Technology/Tool
Backend ASP.NET Core 6+
Database PostgreSQL (EF Core)
NoSQL Storage MongoDB (for branded links)
URL Shortening Custom algorithm (5-character codes)
QR Code QRCoder library
Barcode ZXing library
Task Scheduling Hangfire (for background jobs)
AutoMapper Object-to-object mapping
Logging Built-in ASP.NET Core logging

System Architecture

┌───────────────────────────────────────────────────────────────────────────────┐
│                                Client (Browser)                               │
└───────────────────────────────────┬───────────────────────────────────────────┘
                                    │
                                    ▼
┌───────────────────────────────────────────────────────────────────────────────┐
│                                API Gateway (ASP.NET Core)                     │
│                                                                               │
│  ┌─────────────┐    ┌─────────────┐    ┌─────────────┐    ┌─────────────┐     │
│  │ URL Shorten │    │ Brand Links │    │ QR Code     │    │ Barcode    │      │
│  │ (EF Core)   │    │ (MongoDB)   │    │ Generator   │    │ Generator   │     │
│  └─────────────┘    └─────────────┘    └─────────────┘    └─────────────┘     │
│                                                                               │
│  ┌─────────────┐    ┌─────────────┐    ┌─────────────┐    ┌─────────────┐     │
│  │ Hangfire    │    │ AutoMapper  │    │ Logging     │    │ CORS        │     │
│  │ (Background │    │ (DTO ↔ Model)│    │ (Serilog)   │    │ (Policy)    │    │
│  │ Jobs)       │    └─────────────┘    └─────────────┘    └─────────────┘     │
│                                                                               │
└───────────────────────────────────────────────────────────────────────────────┘
                                    │
                                    ▼
┌───────────────────────────────────────────────────────────────────────────────┐
│                                Databases                                      │
│                                                                               │
│  ┌─────────────┐    ┌─────────────┐    ┌─────────────┐                        │
│  │ PostgreSQL  │    │ MongoDB     │    │ Visit Logs │                         │
│  │ (EF Core)   │    │ (Brand Links)│    │ (EF Core)  │                        │
│  └─────────────┘    └─────────────┘    └─────────────┘                        │
└───────────────────────────────────────────────────────────────────────────────┘

3. API Documentation

Base URL

https://localhost:5001/api

Endpoints

1. URL Shortening

Method Endpoint Description Request Body (JSON)
POST /LinkyUz/ShortenUrl Shorten a long URL { "Url": "https://example.com" }
GET /LinkyUz/Redirect/{code} Redirect to original URL { code: string }

2. Brand Links

Method Endpoint Description Request Body (JSON)
POST /BrandUrl/CrateBrandLink Create a branded short link { "Url": "https://example.com", "BrandName": "mybrand" }
GET /BrandUrl/{brand} Redirect to original URL via brand { brand: string }

3. QR Code Generation

Method Endpoint Description Query Parameters
GET /LinkyUz/LinkToQRCode Generate QR code for a URL ?text=https://example.com

4. Barcode Generation

Method Endpoint Description Query Parameters
GET /LinkyUz/GenerateBarcode Generate barcode for a URL ?url=https://example.com

4. Setup & Installation

Prerequisites

Steps to Run Locally

1. Clone the Repository

git clone https://github.com/ELTNOrg/LinkyUz.git
cd LinkyUz

2. Configure Databases

  • PostgreSQL:
    • Create a database named shortener.
    • Update appsettings.json with your PostgreSQL credentials:
      "ConnectionStrings": {
        "Database": "User ID=postgres;Password=7655;Server=localhost;Port=5432;Database=shortener;"
      }
  • MongoDB:
    • Ensure MongoDB is running locally (mongodb://localhost:27017).
    • Update appsettings.json:
      "MongoDatabase": {
        "ConnectionString": "mongodb://localhost:27017",
        "DatabaseName": "linky",
        "CollectionName": "brandlinks"
      }

3. Run Migrations

dotnet ef migrations add InitialMigration
dotnet ef database update

4. Run the Application

dotnet run
  • The API will start at https://localhost:5001 (or http://localhost:5000 for HTTP).
  • Swagger UI will be available at /swagger.

LinkyUZ ELTNOrg

About

LinkyUz — One tool for all your links.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages