https://github.com/aoamusat/urlshort
A URL Shortening service
https://github.com/aoamusat/urlshort
alembic fastapi javascript postgresql sqlalchemy tailwindcss
Last synced: 4 months ago
JSON representation
A URL Shortening service
- Host: GitHub
- URL: https://github.com/aoamusat/urlshort
- Owner: aoamusat
- Created: 2024-01-12T16:10:19.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-25T09:03:39.000Z (about 2 years ago)
- Last Synced: 2024-04-25T10:26:35.658Z (about 2 years ago)
- Topics: alembic, fastapi, javascript, postgresql, sqlalchemy, tailwindcss
- Language: Python
- Homepage: https://urlshorter-8m42.onrender.com/
- Size: 50.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# URL Shortening Service
 
This is a URL shortening service implemented using FastAPI, Python, PostgreSQL, and Docker.
## Table of Contents
- [URL Shortening Service](#url-shortening-service)
- [Table of Contents](#table-of-contents)
- [Overview](#overview)
- [Features](#features)
- [Prerequisites](#prerequisites)
- [Getting Started](#getting-started)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [API Documentation](#api-documentation)
- [Docker Support](#docker-support)
- [Contributing](#contributing)
- [License](#license)
## Overview
This URL shortening service allows users to shorten long URLs into concise, easy-to-share short links. It is built on the FastAPI framework, uses PostgreSQL as the database, and is containerized with Docker for easy deployment.
## Features
- Shorten long URLs into short links.
- Retrieve original URLs using short links.
- FastAPI-based RESTful API.
- PostgreSQL database for persistent storage.
- Docker support for containerized deployment.
## Prerequisites
Make sure you have the following installed on your system:
- Docker
- Docker Compose
- Python 3.8 or higher
## Getting Started
### Installation
- Clone the repository:
```bash
git clone https://github.com/aoamusat/urlshort.git
cd urlshort
```
- Install the project dependencies:
```bash
pip install -r requirements.txt
```
- Run database migrations:
```bash
alembic upgrade head
```
### Configuration
- Set environment variables:
```bash
export DATABASE_URL=postgresql://user:password@host/db
export BASE_URL=URL # Optional
```
## Run the FastAPI development server
```bash
uvicorn main:app --reload --port 80
```
Visit http://localhost/docs in your browser to access the Swagger documentation.
### Usage
Use the API documentation to interact with the service.
Shorten long URLs and retrieve original URLs using the provided API endpoints.
### API Documentation
The API documentation is available at http://localhost/docs.
# Docker Support
The service can be containerized using Docker. Use the provided Dockerfile for deployment.
```bash
# Build the Docker image
docker build -t url-shortener .
```
Alternatively, you can pull the Docker image from the Docker public repository
```bash
docker pull akeemamusat511/urlshorter:latest
```
# Contributing
Feel free to contribute to the project. Fork the repository, make your changes, and submit a pull request.
# License
This project is licensed under the MIT License.