From 924804b5d850f4892f84ab7c280ff6c33e5cabdd Mon Sep 17 00:00:00 2001 From: Lev Vereshchagin Date: Mon, 16 Jun 2025 15:19:19 +0300 Subject: [PATCH] Add FastAPI and FastStream examples to Quickstart section --- README.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/README.md b/README.md index d3a3556..cda5b30 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,66 @@ application: litestar.Litestar = LitestarBootstrapper(settings).bootstrap() This approach will provide you with an application that has all the essential instruments already set up for you. +### FastAPI + +```python +import fastapi + +from microbootstrap import FastApiSettings +from microbootstrap.bootstrappers.fastapi import FastApiBootstrapper + + +class YourSettings(FastApiSettings): + # General settings + service_debug: bool = False + service_name: str = "my-awesome-service" + + # Sentry settings + sentry_dsn: str = "your-sentry-dsn" + + # Prometheus settings + prometheus_metrics_path: str = "/my-path" + + # Opentelemetry settings + opentelemetry_container_name: str = "your-container" + opentelemetry_endpoint: str = "/opentelemetry-endpoint" + + +settings = YourSettings() + +application: fastapi.FastAPI = FastApiBootstrapper(settings).bootstrap() +``` + +### FastStream + +```python +from faststream.asgi import AsgiFastStream + +from microbootstrap import FastStreamSettings +from microbootstrap.bootstrappers.faststream import FastStreamBootstrapper + + +class YourSettings(FastStreamSettings): + # General settings + service_debug: bool = False + service_name: str = "my-awesome-service" + + # Sentry settings + sentry_dsn: str = "your-sentry-dsn" + + # Prometheus settings + prometheus_metrics_path: str = "/my-path" + + # Opentelemetry settings + opentelemetry_container_name: str = "your-container" + opentelemetry_endpoint: str = "/opentelemetry-endpoint" + + +settings = YourSettings() + +application: AsgiFastStream = FastStreamBootstrapper(settings).bootstrap() +``` + ## Settings The settings object is the core of microbootstrap.