frontend

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package frontend exposes the production React build as an embedded filesystem. Keeping the build artifact behind this package lets the HTTP server serve the app without knowing how Bun names or lays out generated assets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assets

func Assets() http.Handler

Assets serves immutable files generated by the frontend build.

func Document

func Document(meta Metadata, basePath string) ([]byte, error)

Document returns the embedded entry document with route-specific metadata, externalized for the given base path like Index.

func Index

func Index(basePath string) ([]byte, error)

Index returns the React entry document embedded in the binary, externalized for the path prefix the request resolved ("" for a root deployment).

The build uses Vite's relative base, so chunk-to-chunk resolution inside the bundle rides import.meta.url and needs no rewriting; only this document's own references are document-relative and would break on nested SPA routes (/sessions/123). Index rewrites them to absolute prefixed paths and injects the prefix as window.__AKARI_BASE_PATH__, which the router basename and the API client read back. The prefix arrives validated (config.NormalizePathPrefix), so it is safe to interpolate into markup.

Types

type Metadata

type Metadata struct {
	Title       string
	Description string
	URL         string
	Image       string
}

Metadata describes the crawler-visible identity of a public React route. The browser still owns the rendered page, but link previews need these values in the first HTML response because social crawlers do not reliably execute JavaScript.

Jump to

Keyboard shortcuts

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