Files
chart/bible-local/architecture/api-surface.md
T

1.7 KiB

API Surface

Primary Integration Style

The package is intended to be embedded by other Go applications.

Current package shape:

  • viewer.RenderHTML(snapshot []byte, title string) ([]byte, error)
  • viewer.RenderHTMLWithOptions(snapshot []byte, title string, opts viewer.RenderOptions) ([]byte, error)
  • viewer.NewHandler(viewer.HandlerOptions{...}) http.Handler
  • viewer.NewStandaloneHandler(viewer.HandlerOptions{...}) http.Handler

Integration model:

  • embedding app provides the JSON
  • chart renders HTML
  • embedded mode does not own snapshot selection UI
  • standalone mode may provide a local upload screen on GET /

Expected Runtime Endpoints

These endpoints are expected for the standalone binary only:

  • GET / - upload page
  • POST /render - accept one Reanimator JSON payload and return rendered HTML
  • GET /healthz - basic process health

Embedded handler endpoints:

  • GET / - empty viewer shell with no upload controls
  • POST /render - accept one Reanimator JSON payload and return rendered HTML
  • GET /healthz - basic process health
  • GET /static/... - embedded static assets

Internal asset and form URLs are relative so the documented http.StripPrefix("/chart", ...) integration works below /chart/ as well as at the server root. Snapshot request bodies are limited to 64 MiB.

UI Route Rules

  • No multi-product navigation
  • No upload wizard with preview/confirm/execute stages
  • No collector/API-connect workflow
  • No background job polling API
  • Embedded mode must not force a file picker into host applications

Response Rules

  • HTML pages are read-only views of one snapshot
  • API responses must not modify or augment the input payload semantics