server

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package server wires the HTTP handlers of braid-server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Reindex

func Reindex(ctx context.Context, cfg config.Config, userID string) error

Reindex rebuilds the derived data of one user (userID "" = all users) from the raw data and prints one line per user.

Types

type Option

type Option func(*options)

Option customises New.

func WithAvatarFetch

func WithAvatarFetch(f api.AvatarFetch) Option

WithAvatarFetch replaces the fetcher behind /api/v1/me/avatar (tests serve a picture without a TLS IdP).

func WithLive

func WithLive(o live.Options) Option

WithLive overrides the live hub's limits and timings.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server owns the DB pool and the route table.

func New

func New(ctx context.Context, cfg config.Config, opts ...Option) (*Server, error)

New opens the database (as braid_app) and registers all routes.

func (*Server) Close

func (s *Server) Close()

Close stops the live hub (connections close with 1001) and releases the DB pool.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the mux wrapped in the security headers.

func (*Server) RunWorker

func (s *Server) RunWorker(ctx context.Context) error

RunWorker runs the derivation worker until ctx is done.

Directories

Path Synopsis
Package api serves the /api/v1 endpoints used by the web app.
Package api serves the /api/v1 endpoints used by the web app.
Package config parses the server's BRAID_* environment.
Package config parses the server's BRAID_* environment.
Package db wraps the Postgres pool, per-request user scoping and migrations.
Package db wraps the Postgres pool, per-request user scoping and migrations.
Package derive turns raw transcript rows into the derived tables, exactly once per row.
Package derive turns raw transcript rows into the derived tables, exactly once per row.
derivetest
Package derivetest is test support for the derive engine: it stores raw data as ingest would and inspects the derived tables.
Package derivetest is test support for the derive engine: it stores raw data as ingest would and inspects the derived tables.
parse
Package parse turns raw transcript lines and snapshots into typed events, leniently and without I/O.
Package parse turns raw transcript lines and snapshots into typed events, leniently and without I/O.
Package device implements the RFC 8628 device authorization flow and its /device pages.
Package device implements the RFC 8628 device authorization flow and its /device pages.
Package httpx holds shared HTTP building blocks for the server.
Package httpx holds shared HTTP building blocks for the server.
Package ingest serves the device-authenticated data path: POST /v1/ingest and GET /v1/files.
Package ingest serves the device-authenticated data path: POST /v1/ingest and GET /v1/files.
Package live fans per-user events from Postgres NOTIFY out to WebSocket clients.
Package live fans per-user events from Postgres NOTIFY out to WebSocket clients.
Package servertest starts a complete braid-server against a fresh test database and a mock OIDC provider.
Package servertest starts a complete braid-server against a fresh test database and a mock OIDC provider.
Package spa serves the embedded single-page web app.
Package spa serves the embedded single-page web app.
Package stats serves the /api/v1/stats endpoints: aggregates over the derived tables of the signed-in user.
Package stats serves the /api/v1/stats endpoints: aggregates over the derived tables of the signed-in user.
Package webauth implements OIDC web login (authorization code + PKCE) and DB-backed sessions.
Package webauth implements OIDC web login (authorization code + PKCE) and DB-backed sessions.
oidctest
Package oidctest is a minimal in-process OIDC provider for tests.
Package oidctest is a minimal in-process OIDC provider for tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL