# minxa.lol โ€“ Backend This is the **FastAPI-based** backend service for [minxa.lol](https://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 ```bash python3 -m venv venv source venv/bin/activate ``` ### 2. Install dependencies ```bash pip install -r requirements.txt ``` ### 3. Create `.env` file ```bash cp .env.example .env ``` Edit the `.env` file to include your local database connection: ```env DATABASE_URL=postgresql+asyncpg://user:password@localhost:5432/minxadatabase ``` --- ## ๐Ÿš€ Running the Backend ### Development Server ```bash uvicorn backend.main:app --reload --app-dir .. ``` ### Production Server (via Docker Compose) From the root of the project: ```bash 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**.