Aether

Aether

0.8.1

API framework

Nest-inspired HTTP APIs, written in Nox.

Modules, closure injection, guards, pipes, DTO validation, OpenAPI, WebSocket gateways and a SQLite job queue. Independent of Nyx.

$noxc install github.com/mburakmmm/aether@v0.8.1

Nox ≥ 2.0.7. The language itself is documented at noxlang.com.

nox
import nox.http
from nox.http import HttpRequest, HttpResponse
import aether.application
import aether.server
import aether.config
from aether.application import Application
from aether.config import Config
from aether.module import ModuleBuilder
from aether.context import HttpContext
from aether.response import json_ok

class HealthModule:
    def configure(self: HealthModule, m: ModuleBuilder) -> None:
        m.get("/healthz", self._health())

    def _health(self: HealthModule) -> (HttpContext) -> HttpResponse:
        def health(ctx: HttpContext) -> HttpResponse:
            return json_ok("{\"status\":\"ok\"}")
        return health

def build(app: Application) -> None:
    HealthModule().configure(app.module())

cfg: Config = aether.config.load()
aether.application.boot_for_serve(cfg, build)

def handle(req: HttpRequest) -> HttpResponse:
    return aether.application.dispatch_from_parts(
        req.method, req.target, req.body, req.headers, req.peer_addr, cfg, build
    )

nox.http.serve(cfg.port, handle)

Shape

The same idea, three different jobs.

Aether is the API and backend framework for Nox. Use it for JSON services. Use Nyx when the app is a monolith of HTML pages.

Modules

A class with configure(self, m) owns its routes. Prefixes and imports compose the tree.

Closures, not subclasses

Nox cannot subclass an imported base. Services live in fields and are captured by handlers.

One pipeline

Guard, pipe, interceptor, handler, interceptor, then an exception filter. OpenAPI is built at boot.

Surface

What you actually import.

HTTP

routes, guards, pipes, filters

Contracts

DTOs, OpenAPI and Swagger UI

Realtime

WebSocket rooms and a job queue

Process

worker-local state, graceful drain

Built on Nox, served next to it.

This site is a Nyx application on the same Cloudflare tunnel as noxlang.com. The language reference stays on the Nox site.