Skip to main content

A service management framework

Project description

Nautica V3

Nautica V3 (also referred to as Nautica API, Nautica3, N3) is a modular application framework built around a service registry. It provides you with a structured way to manage components of your applications, such as HTTP or Socket servers, background workers, etc.

N3 is not just an HTTP framework — the HTTP server is one of many services. It's designed for applications that need to coordinate multiple components at once.

What's Included

  • Service Registry with dependency resolver
  • Lifecycle hooks for install, start and shutdown
  • TOML Config system with key management
  • Logger with file output and memory
  • Shell for interacting with services
  • TUI for live logs, thread and worker inspection (optional)
  • Plugin system for extending projects without modifying core code
  • HTTP API built on Starlette + Uvicorn

I made N3 because I was solving the same problems in my projects, those being: configs, logging, figuring out startup orders, not to mention the validation boilerplate on every route. Because of this I made Nautica V2, which solved many of these issues, and V3 to improve on the idea.

How HTTP API Compares

Benchmark Performance

Library Requests/Second Avg Latency Overall
Nautica3 2271 4.4ms -
FastAPI 2259 4.4ms 0.5% slower
Flask 75 132.6ms 96% slower

Ran with 10 workers, for 10 seconds. Nautica3 matches FastAPI despite running additional middleware, requirement parsing, and logging on every request.

Code Complexity

Similarly to SvelteKit, Nautica defines the route names for you. This helps to reduce boilerplate (see Flask and FastAPI examples), improve readability, and helps with naming conventions

Nautica3

# file: src/http/api/v1/auth.py
from napi.http import HTTP, Context, Reply
from somewhere import username, password

@HTTP.POST()
@HTTP.Require(body = {"username": str, "password": str})
def login(ctx: Context):
    if ctx.body["username"] == username and ctx.body["password"] == password:
        return Reply(ok=True)
    return Reply(ok=False, error="Invalid credentials"), 401

Flask

# file: main.py
from flask import Flask, request
from flask.blueprints import Blueprint
import json
from somewhere import username, password

app = Flask(__name__)
v1auth = Blueprint("v1auth", __name__, url_prefix="/api/v1/auth")

@v1auth.post("/login")
def login():
    data = request.get_json(silent=True) or {}
    if data.get("username") == username and data.get("password") == password:
        return json.dumps({"ok": True})
    return json.dumps({"ok": False, "error": "Invalid credentials"}), 401

app.register_blueprint(v1auth)
app.run(port=8101)

FastAPI

# file: main.py
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
import uvicorn
from somewhere import username, password

app = FastAPI()

class LoginRequest(BaseModel):
    username: str
    password: str

@app.post("/api/v1/auth/login")
def login(body: LoginRequest):
    if body.username == username and body.password == password:
        return {"ok": True}
    raise HTTPException(status_code=401, detail="Invalid credentials")

uvicorn.run(app, port=8101)

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

nautica-3.0.0.tar.gz (35.9 kB view details)

Uploaded Source

Built Distribution

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

nautica-3.0.0-py3-none-any.whl (45.3 kB view details)

Uploaded Python 3

File details

Details for the file nautica-3.0.0.tar.gz.

File metadata

  • Download URL: nautica-3.0.0.tar.gz
  • Upload date:
  • Size: 35.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for nautica-3.0.0.tar.gz
Algorithm Hash digest
SHA256 864900d8b9f1b2a74501bf6b09ce29a391ab014caf63d3b336ba1f1b2a78520d
MD5 c13edb0c40862cbeafa7929e468d9231
BLAKE2b-256 b5ac58bf511c4c289fde7fc386250defd65600f7ab2dfa0b6b24591948443cc3

See more details on using hashes here.

File details

Details for the file nautica-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: nautica-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 45.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for nautica-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f88ff8b7598f92451fe8302ea27fac465186679792e33c67ccedb1d82cc40e93
MD5 927e323dac436707c5d062e91a19057b
BLAKE2b-256 30c860db659344806b038e671f0ea0a544ac5c5327a6b131e551c5c7fa2e7b0d

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