Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

user-registration-fastapi

FastAPI integration for the user-registration Python package.

This package provides FastAPI-specific request/response models, dependency integration, and HTTP exception handling while keeping the core registration business logic framework-independent.

Features

  • FastAPI registration endpoint integration
  • Pydantic request and response models
  • Dependency injection for RegistrationService
  • HTTP 201 Created for successful registration
  • HTTP 409 Conflict for duplicate users
  • HTTP 422 Unprocessable Entity for request/validation errors
  • HTTP 500 Internal Server Error for persistence failures
  • Compatible with the framework-agnostic user-registration package

Installation

Install the core package and FastAPI adapter:

pip install user-registration user-registration-fastapi

Or install the adapter directly:

pip install user-registration-fastapi

The adapter declares user-registration and fastapi as dependencies.

Basic Usage

The adapter exposes a FastAPI router that delegates registration to the core RegistrationService.

A typical application structure can look like:

my_app/
├── main.py
├── dependencies.py
└── ...

Example:

from fastapi import FastAPI

from user_registration_fastapi import router

app = FastAPI()

app.include_router(router)

The registration endpoint is:

POST /users/register

Example request:

{
  "username": "test",
  "email": "test@example.com",
  "password": "SecurePassword123!"
}

Example successful response:

{
  "user_id": "550e8400-e29b-41d4-a716-446655440000"
}

The response contains the ID assigned to the newly registered user.

Dependency Injection

The adapter intentionally does not create a database repository or application-specific RegistrationService automatically.

Instead, the application configures the service and provides it through FastAPI dependency injection.

Conceptually:

from fastapi import Depends


def get_registration_service() -> RegistrationService:
    return registration_service

The adapter then uses the configured service when handling:

POST /users/register

This keeps application infrastructure outside the adapter.

For example:

FastAPI
   │
   ▼
user-registration-fastapi
   │
   ▼
RegistrationService
   │
   ├── PasswordHasher
   ├── PasswordValidator
   ├── UserRepository
   └── ValidationRegistry

HTTP Behavior

The adapter translates domain/application results into HTTP responses.

Condition HTTP Status
Registration successful 201 Created
Invalid request/validation 422 Unprocessable Entity
Duplicate username/email 409 Conflict
Persistence/application failure 500 Internal Server Error

The adapter does not contain the registration business rules themselves. Those remain in user-registration.

Architecture

The package follows an adapter architecture:

                FastAPI Application
                        │
                        ▼
            user-registration-fastapi
                        │
                        ▼
              RegistrationService
                        │
             ┌──────────┼──────────┐
             ▼          ▼          ▼
        Validation   Password    Repository
         Registry     Hasher      Protocol
                                    │
                                    ▼
                            Application Storage

The repository implementation can be supplied by another adapter, such as:

user-registration-sqlalchemy

or by an application's own repository implementation.

Testing

From the repository root:

.venv/bin/python -m pytest tests/integration/test_fastapi_registration.py -v

Run the complete test suite:

.venv/bin/python -m pytest -v

Development

Install the adapter in editable mode:

.venv/bin/python -m pip install -e "./adapters/fastapi[dev]"

Run Ruff:

.venv/bin/python -m ruff check adapters/fastapi

Check formatting:

.venv/bin/python -m ruff format --check adapters/fastapi

Run MyPy:

.venv/bin/python -m mypy adapters/fastapi

Compatibility

The adapter requires:

  • Python 3.12+
  • FastAPI >=0.115,<1.0
  • user-registration >=0.1.0,<1.0.0

Core package:

SQLAlchemy adapter:

License

MIT License.

Visit https://github.com/ShamimurRahmanShuvo/user_registration/tree/main/docs for more detials.

Metadata

Release files for user-registration-fastapi 1.0.0rc1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for user-registration-fastapi 1.0.0rc1
File Size Uploaded
user_registration_fastapi-1.0.0rc1.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for user-registration-fastapi 1.0.0rc1
File Interpreter ABI Platform
user_registration_fastapi-1.0.0rc1-py3-none-any.whl Python 3 none any Details

Total release size: 8.9 kB

Release files / user_registration_fastapi-1.0.0rc1.tar.gz

Download URL user_registration_fastapi-1.0.0rc1.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
84922608d5deacf88ecee6d2613721543f4a445955c7b451efec1feb184fa765
BLAKE2b-256 checksum
How to use checksums
b1975b17f4d7c365d65917e4756bbfbf713ac2d0b65bd1a66ca44f86e8aabadd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release files / user_registration_fastapi-1.0.0rc1-py3-none-any.whl

Download URL user_registration_fastapi-1.0.0rc1-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cae5d621a69f66c78480e3bb456c756347af51f753cb6216d22fa1c18e5980d9
BLAKE2b-256 checksum
How to use checksums
85483806768610769fd84dbb37be9913cfb9e50723f2b69ee87313840c67533f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release history Release notifications | RSS feed

1.0.1

2 release files

1.0.0

2 release files

This release

1.0.0rc1 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page