Skip to main content

Nestipy Logo

Version Python License

Description

Nestipy is a Python framework built on top of FastAPI that follows the modular architecture of NestJS

Under the hood, Nestipy makes use of FastAPI, but also provides compatibility with a wide range of other libraries, like Blacksheep, allowing for easy use of the myriad of third-party plugins which are available.

Getting started

    pip install nestipy-cli
    nestipy new my_app
    cd my_app
    nestipy start --dev
    ├── src
    │    ├── __init__.py
    ├── app_module.py
    ├── app_controller.py
    ├── app_service.py
    ├── main.py
    ├── cli.py
    ├── pyproject.yml
    ├── uv.lock
    ├── README.md
    
       

The main.py file contains an instance of the application and bootstraps it with app.listen() (Granian under the hood).

from granian.constants import Interfaces

from nestipy.core import NestipyFactory

from app_module import AppModule

app = NestipyFactory.create(AppModule)

if __name__ == '__main__':
    app.listen(
        "main:app",
        host="0.0.0.0",
        port=8000,
        interface=Interfaces.ASGI,
        reload=True,
    )

Embed mode (no import string, fewer options like reload/workers):

if __name__ == '__main__':
    app.listen(host="0.0.0.0", port=8000)

Inside module, we got,

from app_command import AppCommand
from app_controller import AppController
from app_service import AppService

from nestipy.common import Module


@Module(
    controllers=[AppController],
    providers=[AppService, AppCommand]
)
class AppModule: ...

For controller, we got something like

from typing import Annotated

from nestipy.common import Controller, Get, Post, Put, Delete
from nestipy.ioc import Inject, Body, Param

from app_service import AppService


@Controller()
class AppController:
    service: Annotated[AppService, Inject()]

    @Get()
    async def get(self) -> str:
        return await self.service.get()

    @Post()
    async def post(self, data: Annotated[dict, Body()]) -> str:
        return await self.service.post(data=data)

    @Put("/{app_id}")
    async def put(
        self, app_id: Annotated[int, Param("app_id")], data: Annotated[dict, Body()]
    ) -> str:
        return await self.service.put(id_=app_id, data=data)

    @Delete("/{app_id}")
    async def delete(self, app_id: Annotated[int, Param("app_id")]) -> None:
        await self.service.delete(id_=app_id)

And, for app_service.py

from nestipy.common import Injectable


@Injectable()
class AppService:
    @classmethod
    async def get(cls):
        return "test"

    @classmethod
    async def post(cls, data: dict):
        return "test"

    @classmethod
    async def put(cls, id_: int, data: dict):
        return "test"

    @classmethod
    async def delete(cls, id_: int):
        return "test"

Typed TypeScript Client

Generate a typed TypeScript HTTP client straight from your controllers so any JS/TS frontend can call your API with full typing:

nestipy run client:gen --output clients/api_client.ts --class ApiClient
import { createApiClient } from "./api_client";

const api = createApiClient({ baseUrl: "/api" });
const cat = await api.CatsController.getCat(1); // fully typed, grouped by controller

See Typed Client for the full guide.

Web Frontends with Inertia

For server-driven pages, Nestipy ships a first-class Inertia.js adapter (nestipy-inertia) with full protocol parity — partial reloads, deferred props, merge props, history encryption and SSR. See Inertia.

Documentation

View full documentation from here.

Support

Nestipy is an MIT-licensed open source project. It can grow thanks to the sponsors and support from the amazing backers. If you'd like to join them, please [read more here].

Stay in touch

License

Nestipy is MIT licensed.

Metadata

Release files for nestipy 0.10.1

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

Source distribution (sdist)

Source distribution for nestipy 0.10.1
File Size Uploaded
nestipy-0.10.1.tar.gz 6.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for nestipy 0.10.1
File Interpreter ABI Platform
nestipy-0.10.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.2 MB

Release files / nestipy-0.10.1.tar.gz

Download URL nestipy-0.10.1.tar.gz
Size 6.0 MB
Tags Source
SHA-256 checksum
How to use checksums
7ed1920dcf67e83e38c53a015a9b249cd439427a918316024450ea1620d0c3e5
BLAKE2b-256 checksum
How to use checksums
418a569b8c7b5802bdfb4c095775136f4a8e7dfaedfb4d7e2a5862357aad92da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.21

Release files / nestipy-0.10.1-py3-none-any.whl

Download URL nestipy-0.10.1-py3-none-any.whl
Size 6.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
604ad945ba9802f54cd638799ecf73c6a1765f855a14007ea703be34e5596590
BLAKE2b-256 checksum
How to use checksums
f0853f8e990d32d92e9e8b40125dff715e1516734de61a4c9024517659dfcba3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.21

Release history Release notifications | RSS feed

This release

0.10.1 This release

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.9

2 release files

0.7.8

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.7

2 release files

0.6.6

1 release file

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.19

2 release files

0.5.18

2 release files

0.5.17

2 release files

0.5.16

2 release files

0.5.15

2 release files

0.5.14

2 release files

0.5.13

2 release files

0.5.12

2 release files

0.5.11

2 release files

0.5.10

2 release files

0.5.9

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.4.24

2 release files

0.4.23

2 release files

0.4.22

2 release files

0.4.21

2 release files

0.4.20

2 release files

0.4.19

2 release files

0.4.18

2 release files

0.4.17

2 release files

0.4.16

2 release files

0.4.15

2 release files

0.4.10

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.3.10

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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