CharlesKWON ce39c6c8e0 feat(napi P2): fnode capi mode — c-shared libfivenode runs real PRG
`fnode capi <entry.prg> -o libfivenode.dylib` generates all PRG as library
funcs + a cgo shim exporting the N-API C ABI, and builds buildmode=c-shared.
hb_bridge_handle_request stashes the request (read by PRG via FN_NAPI_REQ,
registered with HB_FUNC) and runs the PRG FN_HANDLE via capiVM.Run, returning
its JSON. capiEnsure calls RegisterLibModules so HB_FUNC/--rtl symbols install
into the VM (vm.Run drains libModules but not dynamicFuncs).

Verified: node → addon → Go libfivenode → PRG parses the request and runs
string/hash/JSON ops (Upper/Len/HB_ISHASH/hb_jsonDecode/Encode), round-trips a
200 response. Supersedes the P1 hand-written cmd/libfivenode (removed).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 22:54:09 +09:00

fivenode_go

FiveNode for Five — a Harbour-compatible web framework that compiles to a single Go binary. No Node.js, no FFI, no Apache. PRG sources go in, one executable comes out.

Successor to the koffi/N-API based fivenode framework, rebuilt on the Five Pure-Go runtime.

Status

Early bootstrap — Phase 1a in progress.

Architecture

Browser ──── HTTP/HTTPS ──── fivenode_go single binary
                              ├─ Five hbrt VM (PRG interpreter / compiled)
                              ├─ Five hbrtl (483 standard RTL functions)
                              ├─ hbrtl_ext/httpserver  — HTTP server RTL
                              ├─ hbrtl_ext/capi        — bridge_*.prg helpers
                              ├─ hbrtl_ext/pgrtl       — PostgreSQL client RTL
                              ├─ app/                  — bridge_*.prg + app PRG
                              └─ go:embed              — static assets

fnode build api/*.prg --extra-rtl=hbrtl_ext/... -o myapp produces a self-contained binary. No external dependencies beyond what the app code itself opens (e.g. a Postgres connection).

Build

go build -o fnode ./cmd/fnode
./fnode build app/hello.prg -o hello
./hello

License

Copyright (c) 2026 Charles KWON OhJun. All rights reserved.

Description
FiveNode for Five — Harbour PRG web framework as a single Go binary (no Node.js, no FFI)
Readme 208 KiB
Languages
Go 48%
xBase 36.7%
HTML 7.8%
CSS 6.2%
JavaScript 1.3%