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: OpenTelemetry support

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.9.15.tar.gz (66.0 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.9.15-py3-none-any.whl (61.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for wellapi-0.9.15.tar.gz
Algorithm Hash digest
SHA256 18aaa4dcf88c66979b0f2b67f09608ac1b3dc7d9b60819bbf0955f5c0ff1b5e2
MD5 1d1f96d0167b2ead46fa307f9f931c44
BLAKE2b-256 c4c7c1eda7d2b0ca3ee862d083797ddf48ea7692f43461e8038e2d30f7d86b77

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for wellapi-0.9.15-py3-none-any.whl
Algorithm Hash digest
SHA256 8a143bdd9dfef59bccdc62f38a79d4ec10d7a8fbe01c6406bff2b9c2e284241f
MD5 f2e11986e63d481d3bab30c0f8499336
BLAKE2b-256 b150997cf2e5d1964e1f4e9b6e850ca5fa37096fbb19812ba8253d1d197ec84e

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