From 271adc8504aad32075d75d06fd42023877a649ec Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Sun, 9 Aug 2026 03:52:58 +0200 Subject: chore: initialize monorepo structure for MeshBay 3-package layout: meshbay-common (shared crypto/protocol), meshbay-hub (FastAPI server), meshbay-node (local daemon). Includes validated POC spikes 1-6 in poc/, architecture drafts v1/v2 in docs/, and CLAUDE.md project conventions. All cryptographic primitives extracted from POC into meshbay_common/crypto.py (GEK wrap/unwrap, chunk key derivation, keystore encryption, chunk signing). Co-Authored-By: Claude Sonnet 4.6 (1M context) --- packages/meshbay-hub/pyproject.toml | 32 ++++++++++++++++++++++ packages/meshbay-hub/src/meshbay_hub/__init__.py | 3 ++ .../meshbay-hub/src/meshbay_hub/api/__init__.py | 0 packages/meshbay-hub/src/meshbay_hub/app.py | 31 +++++++++++++++++++++ packages/meshbay-hub/src/meshbay_hub/daemon.py | 17 ++++++++++++ .../meshbay-hub/src/meshbay_hub/db/__init__.py | 0 packages/meshbay-hub/tests/__init__.py | 0 7 files changed, 83 insertions(+) create mode 100644 packages/meshbay-hub/pyproject.toml create mode 100644 packages/meshbay-hub/src/meshbay_hub/__init__.py create mode 100644 packages/meshbay-hub/src/meshbay_hub/api/__init__.py create mode 100644 packages/meshbay-hub/src/meshbay_hub/app.py create mode 100644 packages/meshbay-hub/src/meshbay_hub/daemon.py create mode 100644 packages/meshbay-hub/src/meshbay_hub/db/__init__.py create mode 100644 packages/meshbay-hub/tests/__init__.py (limited to 'packages/meshbay-hub') diff --git a/packages/meshbay-hub/pyproject.toml b/packages/meshbay-hub/pyproject.toml new file mode 100644 index 0000000..e0a880a --- /dev/null +++ b/packages/meshbay-hub/pyproject.toml @@ -0,0 +1,32 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "meshbay-hub" +version = "0.1.0" +description = "MeshBay Hub — identity authority and group registry server" +requires-python = ">=3.12" +dependencies = [ + "meshbay-common>=0.1.0", + "fastapi>=0.115", + "uvicorn[standard]>=0.30", + "sqlalchemy>=2.0", + "alembic>=1.13", + "asyncpg>=0.30", # PostgreSQL async driver + "httpx>=0.28", +] + +[project.optional-dependencies] +dev = ["pytest>=8", "pytest-asyncio>=0.24", "ruff>=0.6", "httpx>=0.28"] + +[project.scripts] +meshbay-hub = "meshbay_hub.daemon:main" + +[tool.hatch.build.targets.wheel] +packages = ["src/meshbay_hub"] + +# RPM/DEB: meshbay-hub +# Systemd service: meshbay-hub.service +# Config: /etc/meshbay/hub.conf +# Data: /var/lib/meshbay/hub/ diff --git a/packages/meshbay-hub/src/meshbay_hub/__init__.py b/packages/meshbay-hub/src/meshbay_hub/__init__.py new file mode 100644 index 0000000..6372557 --- /dev/null +++ b/packages/meshbay-hub/src/meshbay_hub/__init__.py @@ -0,0 +1,3 @@ +"""MeshBay Hub — identity authority and group registry.""" + +__version__ = "0.1.0" diff --git a/packages/meshbay-hub/src/meshbay_hub/api/__init__.py b/packages/meshbay-hub/src/meshbay_hub/api/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/packages/meshbay-hub/src/meshbay_hub/app.py b/packages/meshbay-hub/src/meshbay_hub/app.py new file mode 100644 index 0000000..3b9ee4f --- /dev/null +++ b/packages/meshbay-hub/src/meshbay_hub/app.py @@ -0,0 +1,31 @@ +""" +MeshBay Hub — FastAPI application. + +POC endpoints are implemented in this file (in-memory storage). +Production implementation will use db/ with SQLAlchemy + PostgreSQL. +""" + +from fastapi import FastAPI +from meshbay_hub import __version__ +from meshbay_common import MNP_VERSION, MHP_VERSION + +app = FastAPI( + title="MeshBay Hub", + version=__version__, + description="MeshBay identity authority and group registry", +) + +# TODO: import and include routers from api/ submodules +# from meshbay_hub.api import users, nodes, groups +# app.include_router(users.router, prefix="/v1") +# app.include_router(nodes.router, prefix="/v1") +# app.include_router(groups.router, prefix="/v1") + + +@app.get("/v1/hub/info") +async def hub_info() -> dict: + return { + "hub_id": "meshbay.org", + "mnp_version": MNP_VERSION, + "mhp_version": MHP_VERSION, + } diff --git a/packages/meshbay-hub/src/meshbay_hub/daemon.py b/packages/meshbay-hub/src/meshbay_hub/daemon.py new file mode 100644 index 0000000..ff8158a --- /dev/null +++ b/packages/meshbay-hub/src/meshbay_hub/daemon.py @@ -0,0 +1,17 @@ +"""Entry point for the meshbay-hub systemd service.""" + +import uvicorn +from meshbay_hub.app import app # noqa: F401 + + +def main() -> None: + uvicorn.run( + "meshbay_hub.app:app", + host="127.0.0.1", + port=8000, + log_level="info", + ) + + +if __name__ == "__main__": + main() diff --git a/packages/meshbay-hub/src/meshbay_hub/db/__init__.py b/packages/meshbay-hub/src/meshbay_hub/db/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/packages/meshbay-hub/tests/__init__.py b/packages/meshbay-hub/tests/__init__.py new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3