lnkshrt is a URL shortener API built with FastAPI. It allows you to generate shortened URLs which redirect you to the original URLs.
The official instance of lnkshrt is hosted at lnkshrt.xyz. However, if you prefer, you can also run your own instance by following the steps in the "Getting Started" section.
The lnkshrt API is built using FastAPI, PostgreSQL, and SQLAlchemy.
- Shorten long URLs to compact and easy-to-share shortened URLs.
- Customizable URLs with the option to specify a custom path for the shortened URL.
- Token-based authentication for secure API access.
- Delete shortened URLs when they are no longer needed.
lnkshrt-cli
is a command-line app with which you can easily generate shortened URLs, authenticate with your account, delete links, and perform other actions from the command-line. For detailed usage instructions and installation guide, please refer to the lnkshrt-cli repository.
To run the lnkshrt API yourself:-
-
Clone the repository:
git clone https://github.com/vivekashok1221/lnkshrt.git
-
Navigate to the project directory:
cd lnkshrt
-
Assuming you have Docker and Docker Compose installed on your system, you can simply run:
docker compose up
Once the containers are up and running, you can access the lnkshrt API at http://0.0.0.0:8000.
You can access the API documentation online at lnkshrt.xyz (or locally at http://0.0.0.0:8000/docs provided the server is running).
To set up the development environment for the lnkshrt API, follow the steps outlined in the "Getting Started" section above.
-
Assuming you have poetry installed, install the dependencies by running:
poetry install
To activate the poetry venv:
poetry shell
-
poetry run task precommit
pre-commit
helps ensure code quality and consistency by automatically running various checks and formatting tools on your code before each commit. -
To manually run the linting checks:
poetry run task lint
-
poetry run alembic revision --autogenerate -m "<MESSAGE>"
lnkshrt is released under the MIT License.