Skip to main content

A simple web framework for aws lambda

Project description

WellAPI

pip

WellAPI is a lightweight web framework for building APIs on AWS Lambda and API Gateway.

Documentation

Features

  • Lambda-first route definitions (GET, POST, PUT, PATCH, DELETE)
  • Type-based request parsing and validation with Pydantic
  • Dependency injection via Depends
  • Middleware and custom exception handlers
  • OpenAPI generation compatible with API Gateway integrations
  • SQS handlers and scheduled job handlers
  • Packaging helpers for Lambda app code and dependency layers

Installation

Install the base package:

pip install wellapi

Install with optional extras:

pip install "wellapi[local,deploy,telemetry]"
  • local: local server/test tooling
  • deploy: AWS CDK integration
  • telemetry: native OpenTelemetry support (traces, metrics, logs) — see docs/telemetry.md

Quick Start

main.py:

from wellapi import WellApi

app = WellApi(title="My API", version="1.0.0")

@app.get("/hello")
def hello():
    return {"message": "Hello, World!"}

Create a handlers/ directory for additional endpoints if needed:

handlers/
  __init__.py
  users.py

Local Development

Run with Uvicorn:

uvicorn main:app --reload

If your handlers are not in the default handlers/ directory, configure it in pyproject.toml:

[wellapi]
handlers_dir = "your_handlers_dir"

CLI

Generate OpenAPI:

wellapi openapi main:app handlers --output openapi.json

Enable CORS in OpenAPI output:

wellapi openapi main:app handlers --output openapi.json --cors true --role_name WellApiRole

Build deployment artifacts:

wellapi build app app.zip
wellapi build dep deps.zip

Deploy with AWS CDK

from aws_cdk import Stack
from constructs import Construct
from wellapi.build.cdk import WellApiCDK


class MyStack(Stack):
    def __init__(self, scope: Construct, id_: str, **kwargs) -> None:
        super().__init__(scope, id_, **kwargs)

        WellApiCDK(
            self,
            "WellApiCDK",
            app_srt="main:app",
            handlers_dir="handlers",
            cors=True,
            cache_enable=False,
            log_enable=True,
        )

Notes

  • API Gateway cache support applies to GET endpoints.
  • For full framework usage (routing, DI, middleware, SQS/jobs, testing), see docs/framework-usage.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wellapi-0.10.1.tar.gz (101.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wellapi-0.10.1-py3-none-any.whl (64.8 kB view details)

Uploaded Python 3

File details

Details for the file wellapi-0.10.1.tar.gz.

File metadata

  • Download URL: wellapi-0.10.1.tar.gz
  • Upload date:
  • Size: 101.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.6.14

File hashes

Hashes for wellapi-0.10.1.tar.gz
Algorithm Hash digest
SHA256 8c80654907c55146964c4108fd4b6df4cfdff09471bce2e8260af68b3f2019c0
MD5 287990d6eb35ea259d7fbe6d008abaa0
BLAKE2b-256 8aac535b817bb0e10338c82611c5a1c362f6bc5461f1ffd5a6541cf3c76fa898

See more details on using hashes here.

File details

Details for the file wellapi-0.10.1-py3-none-any.whl.

File metadata

  • Download URL: wellapi-0.10.1-py3-none-any.whl
  • Upload date:
  • Size: 64.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.6.14

File hashes

Hashes for wellapi-0.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d532a7b4f020017aa22032a4d12410f17c676191e957570f99905b4e2fb015cd
MD5 a71a17ad216468351ad7f3e61eb19ed5
BLAKE2b-256 f0e98137a8035d05a088bba08265092117deee6344c19e63b287c2d5e28b5e3f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page