Skip to main content

FastAPI WebServer

This is a wrapper of a FAST API application with some additional features that might be useful for quick web development.

It features:

  • Powerful environment and settings handling with dynamic module import like Django;
  • Local Key-Value Cache database, powered by SQLite;
  • Better logging configuration via commons.logging;
  • Powerful database tools:
    • A Database Adapter to connect to any database on-the-fly;
    • A Data Migration Tool, to run .sql files, or migrate json data that runs automagically on server startup;
    • A FastAPI Dependency for the database (webserver.core.ServerDatabase)
    • A SQLite Cache Database + FastAPI dependency (webserver.core.ServerCache)
  • An SMTP service, implemented on top of fastapi-mail;
  • Internationalization (i18n) on top of Babel:
    • A FastAPI Dependency that discovers the locale based on HTTP Header Accept-Language (webserver.core.AvailableLocale)
  • Front-end tools:
    • SASS Compiler (webserver.frontend.css);
    • Server-Side Rendering via Jinja2Template;
  • Static Files provider;
  • CORS Support;
  • TLS Support + mkcert certificates (local/development only)
  • Content Proxies (webserver.extras.proxies):
    • Gravatar
    • GIPHY

Roadmap

The following features are expected to be implemented in the future. Contribution is welcome.

  • OCI-Compliant Image for Docker/Podman
  • Logging and Tracing API (via OpenTelemetry)
  • Authentication and Authorization
  • Traffic Analyzer
    • (AI) Bot detector
    • VPN detector
    • Rate limiter
    • IP-based Access-Control List (ACL)
  • Content Providers (HTTP client and proxy)
    • Google Fonts API> ⚠️ This is under active development and might not be ready for production environments.

Testing

coverage run -m unittest && coverage html -d tests/coverage/html

Build

uv build && twine upload dist/*

Getting Started

Optionally, set up the environment variables. All environment variables can be found on .env file in the root of this repository.

import webserver
from fastapi import APIRouter, FastAPI

router: APIRouter = APIRouter()
app: FastAPI = webserver.app


@router.get("/")
def index():
  return {"Hello World": f"from {webserver.settings.APP_NAME}"}


app.include_router(router)

if __name__ == "__main__":
  webserver.start()

This enables both local execution through main method as well as fastapi (dev|run) commands.

Metadata

Release files for fastapi-webserver 0.4.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastapi-webserver 0.4.14
File Size Uploaded
fastapi_webserver-0.4.14.tar.gz 15.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fastapi-webserver 0.4.14
File Interpreter ABI Platform
fastapi_webserver-0.4.14-py3-none-any.whl Python 3 none any Details

Total release size: 33.1 kB

Release files / fastapi_webserver-0.4.14.tar.gz

Download URL fastapi_webserver-0.4.14.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
32bc660de8f447f70796ca99afc590ef0fbffdc94e66c6a376431ac98b05142e
BLAKE2b-256 checksum
How to use checksums
b56839a47c532ac011b0250425973bc5635ef0b8e2f01692aa991e64b72c8e7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / fastapi_webserver-0.4.14-py3-none-any.whl

Download URL fastapi_webserver-0.4.14-py3-none-any.whl
Size 17.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c3eaeb4f60430bece95410f135234170e03579873e7141bac2324c336de122b
BLAKE2b-256 checksum
How to use checksums
8da1b3d4a31ffe9057871b9979a5285ba85ede9b88baf67a62897ba18ec7f530
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

0.4.14 This release

2 release files

0.4.12

2 release files

0.4.11

2 release files

0.4.10

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page