Skip to content

Add FastAPI and FastStream examples to Quickstart section #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down