Skip to content
This repository has been archived by the owner on Oct 16, 2022. It is now read-only.

Latest commit

 

History

History

api


( अल्प ) — A fast ⚡ self-hosted link 🔗 shortener.

issues commits docker dashboard status


This is the core of the project, it the RESTful API that performs redirection, communicates with the database and provides alpa it's functionality.

⚙️ Configuration

Refer to the config example file for all possible configuration keys, and their detailed explanation. If you still have any doubts, feel free to shoot a tweet at me @vsnthdev.

🔭 API Routes

Method Path Description Protected
POST /api/auth/login Takes username, password and responds with a JWT token.
DELETE /api/auth/logout Blacklists the token until expired to prevent usage.
GET /:code & / Redirects if short code is found or returns 404.
DELETE /api/codes/:code Deletes a short code from the database.
GET /api/codes List out all short codes with pagination.
POST /api/codes Creates a new short code.
POST /api/config Creates, updates an existing, or deletes configuration.

🔮 Tech stack

Name Description
Fastify HTTP server focussed on speed designed to build RESTful APIs.
JSON Web Tokens For user authentication.
Redis Key-value pair database known for it's speed.
RedisJSON Redis database plugin to store JSON documents.
RediSearch Redis database plugin that facilitates full text search.
Docker For easy installation & seamless updates.
Kubernetes For scalable deployments to production.

💻 Building & Dev Setup

You need to be at least on Node.js v17.4.0 or above and follow the below instructions to build this project 👇

  • STEP 1️⃣ Clone this repository & enter into it (cd ./alpa)
  • STEP 2️⃣ Run npm install to get all dependencies & link projects together
  • STEP 3️⃣ Enter in the project directory (cd api)
  • STEP 4️⃣ To build this project run npm run build

Upon building @alpa/api a dist folder is created with the transpiled JavaScript files.

📰 License

The alpa project is released under the AGPL-3.0-only.
Developed & maintained By Vasanth Srivatsa. Copyright 2022 © Vasanth Developer.


vsnth.dev  ·  YouTube @vasanthdeveloper  ·  Twitter @vsnthdev  ·  Discord Vasanth Developer