minxa.lol – Backend
This is the FastAPI-based backend service for minxa.lol, a modern and lightweight URL shortener.
🧰 Tech Stack
- FastAPI – Async web framework
- SQLAlchemy (async) – Database ORM
- PostgreSQL – Primary data store
- Hashids – Encodes IDs into short strings
- Alembic – Database migrations
- Uvicorn – ASGI server
⚙️ Environment Setup
1. Create a virtual environment
python3 -m venv venv
source venv/bin/activate
2. Install dependencies
pip install -r requirements.txt
3. Create .env file
cp .env.example .env
Edit the .env file to include your local database connection:
DATABASE_URL=postgresql+asyncpg://user:password@localhost:5432/minxadatabase
🚀 Running the Backend
Development Server
uvicorn backend.main:app --reload --app-dir ..
Production Server (via Docker Compose)
From the root of the project:
python generate_configs.py
docker compose -f docker-compose.generated.yml up --build -d
📁 Directory Overview
backend/
├── db/ # DB engine & session
├── models/ # SQLAlchemy models
├── routes/ # FastAPI routers
├── schemas/ # Pydantic request/response schemas
├── services/ # Business logic
├── utils/ # Hashid encoder and other helpers
├── main.py # FastAPI entrypoint
├── config.py # Environment configuration
└── requirements.txt
🧪 Testing (Coming Soon)
Unit and integration tests will be added using pytest.