Skip to content

Simple url shortener service written with Starlette framework.

Notifications You must be signed in to change notification settings

Jakub3628800/async-url-shortener

Repository files navigation

Async URL Shortener

CI pre-commit.ci status

A high-performance URL shortener service built with Python's Starlette framework, designed for asynchronous operations.

Features

  • Fast URL shortening using async operations
  • RESTful API endpoints
  • Docker container support
  • PostgreSQL database integration
  • Comprehensive test coverage

Run Locally

Using Docker (Recommended)

  1. Start PostgreSQL container:
docker run -d --name postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres:alpine
  1. Pull and run the application container:
docker run -d \
  --name url-shortener \
  -p 8000:8000 \
  -e DATABASE_URL=postgresql://postgres:postgres@host.docker.internal:5432/postgres \
  ghcr.io/jakub3628800/shortener:latest

Development Setup

  1. Create and activate virtual environment:
python -m venv venv
source venv/bin/activate
  1. Install dependencies:
pip install pip-tools
make install
  1. Set up environment variables:
cp env.example .env
  1. Run the application:
make run

API Documentation

The API documentation will be available at http://localhost:8000/docs when the application is running.

Testing

Run the test suite:

make test

Deployment

The application is containerized and can be deployed using Docker. The latest image is available at: ghcr.io/jakub3628800/shortener:latest