# answerdotai/faststripe architecture

> Architecture diagram of the GitHub repository answerdotai/faststripe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/answerdotai/faststripe
- Repository: https://github.com/answerdotai/faststripe

## Overview

FastStripe is a lightweight async Python client for Stripe’s API. A developer initializes `StripeApi` with credentials, uses its nested resource methods to make requests, and receives converted Stripe objects; pagination helpers can iterate resource results. The client builds those resources from a pinned OpenAPI snapshot and formats requests through its transport. Separate capabilities support webhook signature verification and Stripe CLI event listening or triggering. The sampled source shows these mechanisms in `core.py`; generated spec contents and other unsampled modules are represented only where documented or indexed.

Main entry points: [`faststripe/core.py`](https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py) (StripeApi), [`faststripe/stripe_spec.py`](https://github.com/answerdotai/faststripe/blob/main/faststripe/stripe_spec.py) (OpenAPI snapshot)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["API client"]
  node_api["StripeApi<br/>[core.py]"]
  node_snapshot["OpenAPI snapshot<br/>[stripe_spec.py]"]
  node_parser["Spec parser<br/>[core.py]"]
  node_resources["Resource groups<br/>[core.py]"]
  node_transport["Stripe transport<br/>[core.py]"]
  node_objects["Object conversion<br/>[core.py]"]
  node_pagination["Pagination helpers<br/>[core.py]"]
  node_errors["Stripe errors<br/>[core.py]"]
end

subgraph group_webhooks["Webhook handling"]
  node_parse_webhook["Webhook parsing<br/>[core.py]"]
  node_verification["Signature verification<br/>[core.py]"]
  node_event_filter["Service event filter<br/>[core.py]"]
end

subgraph group_cli["Stripe CLI tools"]
  node_listener["Webhook listener<br/>[core.py]"]
  node_trigger["Event trigger<br/>[core.py]"]
end

node_developer(("Developer"))
node_stripe["Stripe API"]
node_webhook_sender(("Webhook sender"))
node_stripe_cli["Stripe CLI"]

node_developer -->|"initializes"| node_api
node_api -->|"loads spec"| node_snapshot
node_api -->|"parses spec"| node_parser
node_api -->|"builds groups"| node_resources
node_api -->|"configures"| node_transport
node_resources -->|"dispatches requests"| node_transport
node_transport -->|"sends requests"| node_stripe
node_transport -->|"converts responses"| node_objects
node_transport -->|"maps HTTP errors"| node_errors
node_developer -->|"iterates pages"| node_pagination
node_pagination -->|"calls operation"| node_resources
node_webhook_sender -->|"submits request"| node_parse_webhook
node_parse_webhook -->|"verifies signature"| node_verification
node_parse_webhook -->|"converts event"| node_objects
node_developer -->|"filters events"| node_event_filter
node_developer -->|"starts forwarding"| node_listener
node_listener -->|"runs listen"| node_stripe_cli
node_developer -->|"triggers event"| node_trigger
node_trigger -->|"runs trigger"| node_stripe_cli

click node_api "https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py"
click node_snapshot "https://github.com/answerdotai/faststripe/blob/main/faststripe/stripe_spec.py"
click node_parser "https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py"
click node_resources "https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py"
click node_transport "https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py"
click node_objects "https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py"
click node_pagination "https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py"
click node_errors "https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py"
click node_parse_webhook "https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py"
click node_verification "https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py"
click node_event_filter "https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py"
click node_listener "https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py"
click node_trigger "https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_snapshot,node_parser,node_resources,node_transport,node_objects,node_pagination,node_errors toneBlue
class node_parse_webhook,node_verification,node_event_filter toneAmber
class node_listener,node_trigger,node_stripe,node_webhook_sender toneMint
class node_developer,node_stripe_cli toneIndigo
```

## Components

### API client

- [StripeApi](https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py): `faststripe/core.py`
- [OpenAPI snapshot](https://github.com/answerdotai/faststripe/blob/main/faststripe/stripe_spec.py): `faststripe/stripe_spec.py`
- [Spec parser](https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py): `faststripe/core.py`
- [Resource groups](https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py): `faststripe/core.py`
- [Stripe transport](https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py): `faststripe/core.py`
- [Object conversion](https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py): `faststripe/core.py`
- [Pagination helpers](https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py): `faststripe/core.py`
- [Stripe errors](https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py): `faststripe/core.py`

### Webhook handling

- [Webhook parsing](https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py): `faststripe/core.py`
- [Signature verification](https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py): `faststripe/core.py`
- [Service event filter](https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py): `faststripe/core.py`

### Stripe CLI tools

- [Webhook listener](https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py): `faststripe/core.py`
- [Event trigger](https://github.com/answerdotai/faststripe/blob/main/faststripe/core.py): `faststripe/core.py`

### Other components

- **Developer**
- **Stripe API**
- **Webhook sender**
- **Stripe CLI**

## Connections

- Developer → StripeApi: initializes (evidence: `README.md`)
- StripeApi → OpenAPI snapshot: loads spec (evidence: `faststripe/core.py`)
- StripeApi → Spec parser: parses spec (evidence: `faststripe/core.py`)
- StripeApi → Resource groups: builds groups (evidence: `faststripe/core.py`)
- StripeApi → Stripe transport: configures (evidence: `faststripe/core.py`)
- Resource groups → Stripe transport: dispatches requests (evidence: `README.md`)
- Stripe transport → Stripe API: sends requests (evidence: `README.md`)
- Stripe transport → Object conversion: converts responses (evidence: `faststripe/core.py`)
- Stripe transport → Stripe errors: maps HTTP errors (evidence: `faststripe/core.py`)
- Developer → Pagination helpers: iterates pages (evidence: `README.md`)
- Pagination helpers → Resource groups: calls operation (evidence: `faststripe/core.py`)
- Webhook sender → Webhook parsing: submits request (evidence: `README.md`)
- Webhook parsing → Signature verification: verifies signature (evidence: `faststripe/core.py`)
- Webhook parsing → Object conversion: converts event (evidence: `faststripe/core.py`)
- Developer → Service event filter: filters events (evidence: `faststripe/core.py`)
- Developer → Webhook listener: starts forwarding (evidence: `faststripe/core.py`)
- Webhook listener → Stripe CLI: runs listen (evidence: `faststripe/core.py`)
- Developer → Event trigger: triggers event (evidence: `faststripe/core.py`)
- Event trigger → Stripe CLI: runs trigger (evidence: `faststripe/core.py`)
