Skip to content

PyGo Architecture

PyGo is a monolithic-but-modular web framework. One process, two languages, one socket.

Concern Language What it does
Web / HTTP layer Go Serves HTTP with the native net/http package (no gin).
Domain / logic Python Implements business logic with the Python standard library (no SQLAlchemy).
Interop both Communicate over a local Unix Domain Socket using MessagePack.

The key idea: Go and Python never speak over the network. They share a Unix Domain Socket (UDS) on the same machine and serialize calls with MessagePack — binary, fast, sub-millisecond.

Browser / client
│ HTTP (net/http, native Go)
▼
┌──────────────────────────────┐
│ Go web layer (entry.go) │
│ - routes, middleware, HTML │
│ - calls domain logic │
└──────────┬───────────────────┘
│ MessagePack request
│ over local UDS (storage/.pygo.sock)
▼
┌──────────────────────────────┐
│ Python domain layer (main.py)│
│ - business rules, models │
│ - Python stdlib only │
│ - returns result │
└──────────┬───────────────────┘
│ MessagePack response over UDS
▼
┌──────────────────────────────┐
│ Go web layer │
│ - builds HTTP response │
└──────────┬───────────────────┘
│ HTTP response
▼
Browser / client

pygo dev starts a Go supervisor. The supervisor:

  1. Boots the Python runtime and connects to it over the UDS.
  2. Serves HTTP requests in Go.
  3. Forwards domain calls to Python over MessagePack and streams the response back.
  4. Watches source files and reloads on change (hot reload).

No separate message broker, no gRPC, no TCP port for interop — just a filesystem socket.

Terminal window
# Single static binary (Go only)
pygo build
# Single static binary with Python bundled in
pygo build --embed-python

pygo build --embed-python embeds the Python runtime into the one executable so you can deploy a single file with no external Python install.

A module is a pair of:

  • Go packages under app/modules/<name>/ (web/HTTP side)
  • Python code under app/modules/<name>/app/ (domain side)

The framework ships internal modules (core, auth, i18n, admin, notifications, ui). Additional modules are registered in pygo.toml under modules.installed and managed with pygo module install.

  1. Native only. Go uses net/http + database/sql; Python uses the stdlib. No heavy frameworks.
  2. Local interop. MessagePack over a UDS — fast, secure, no network exposure.
  3. One process. A Go supervisor owns the Python runtime; deployment is a single binary.
  4. Modular. Features live in app/modules/*, split into a Go side and a Python side.