A FastAPI-based backend server built with modern Python tooling and best practices.
- 🚀 FastAPI - Modern, fast web framework for building APIs
- 📦 uv - Ultra-fast Python package manager
- 🧪 pytest - Testing framework with coverage reporting
- 🎨 Code Quality - Black, isort, and Ruff for formatting and linting
- 🔄 Hot Reload - Development server with automatic reloading
- 📊 API Documentation - Automatic OpenAPI/Swagger documentation
- Python 3.12 or higher
- uv package manager
Search in Internet!
Serath in Internet!
git clone <your-repo-url>
cd tech11-beuv sync# Apply database migrations
uv run alembic upgrade headpoe runThe server will start at http://localhost:8000 with hot reload enabled.
GET /- Welcome messageGET /items/{item_id}- Get item by ID with optional query parameter
- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc - OpenAPI Schema:
http://localhost:8000/openapi.json
tech11-be/
├── app/
│ └── main.py # FastAPI application
├── pyproject.toml # Project configuration and dependencies
├── uv.lock # Locked dependency versions
└── README.md # This file
The project uses poethepoet for task management:
# Run the development server
poe run
# Run tests with coverage
poe test
# Run tests in watch mode
poe watch-test
# Format and lint code
poe lintThe project includes several tools for maintaining code quality:
- Black - Code formatting
- isort - Import sorting
- Ruff - Fast Python linter
- pytest - Testing framework
- pytest-cov - Coverage reporting
# Run all tests
poe test
# Run tests in watch mode (reruns on file changes)
uv run poe watch-test
# Run tests manually
uv run pytest# Format and lint all code
poe lintCreate a .env file in the project root with the following configuration:
# Environment Configuration
ENVIRONMENT=development
# Database Configuration
DATABASE_URL=sqlite:///./app.db
# Security
SECRET_KEY=supersecret-change-in-production
# Project
PROJECT_NAME=FastAPI Tech11 Backend
# Azure OpenAI Configuration
AOAI_ENDPOINT=https://your-resource-name.openai.azure.com/
AOAI_API_KEY=your-api-key-here
AOAI_DEPLOY_GPT4O_MINI=gpt-4o-mini
AOAI_DEPLOY_GPT4O=gpt-4o
AOAI_DEPLOY_EMBED_3_LARGE=text-embedding-3-large
AOAI_DEPLOY_EMBED_3_SMALL=text-embedding-3-small
AOAI_DEPLOY_EMBED_ADA=text-embedding-ada-002
# AWS S3 Configuration (Required for PDF downloads)
S3_BUCKET=your-s3-bucket-name
AWS_ACCESS_KEY=your-aws-access-key
AWS_SECRET_KEY=your-aws-secret-keyImportant:
- The S3 configuration is required for the research PDF download functionality (
/research_downloadendpoint). If these variables are not set, you will receive a validation error. - When using Docker Compose, all variables from
.envare automatically loaded into the container via theenv_filedirective.
# Install production dependencies
uv sync --no-dev
# Run production server
uv run uvicorn app.main:app --host 0.0.0.0 --port 8000Create a Dockerfile:
FROM python:3.12-slim
WORKDIR /app
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
# Copy project files
COPY pyproject.toml uv.lock ./
COPY app/ ./app/
# Install dependencies
RUN uv sync --frozen --no-dev
# Expose port
EXPOSE 8000
# Run the application
CMD ["uv", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]- Clone the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests and linting (
uv run poe test && uv run poe lint) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
If you encounter any issues or have questions, please open an issue on GitHub or contact the development team.