Documentation
¶
Overview ¶
Command melange is the CLI for managing authorization schemas.
The CLI supports:
- validate: Check .fga schema syntax using the OpenFGA parser
- generate client: Produce type-safe client code for Go or TypeScript
- migrate: Load schema into PostgreSQL (creates tables and functions)
- status: Check current migration state
- doctor: Run health checks on authorization infrastructure
- version: Print version information
- license: Print license and third-party notices
- config show: Display effective configuration
Configuration can be provided via:
- Command-line flags (highest priority)
- Environment variables with MELANGE_ prefix
- melange.yaml config file (auto-discovered)
- Built-in defaults (lowest priority)
This tool is typically run during development and deployment to keep the database schema synchronized with .fga files.
Install:
go install github.com/pthm/melange@latest
Usage:
melange [flags] <command>
Commands that require database access (migrate, status) need -db or MELANGE_DATABASE_URL. Commands that only work with files (validate, generate) do not need database access.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
melange
module
|
|
|
internal
|
|
|
cli
Package cli provides shared configuration and utilities for the melange CLI.
|
Package cli provides shared configuration and utilities for the melange CLI. |
|
cli/render
Package render formats melange.Trace values for terminal display.
|
Package render formats melange.Trace values for terminal display. |
|
cli/style
Package style is the CLI's single terminal palette, expressed as lipgloss colors.
|
Package style is the CLI's single terminal palette, expressed as lipgloss colors. |
|
clientgen
Package clientgen provides a registry of language-specific client code generators.
|
Package clientgen provides a registry of language-specific client code generators. |
|
clientgen/go
Package gogen implements the Go client code generator for melange.
|
Package gogen implements the Go client code generator for melange. |
|
clientgen/typescript
Package typescript implements the TypeScript client code generator for melange.
|
Package typescript implements the TypeScript client code generator for melange. |
|
doctor
Package doctor provides health checks for melange authorization infrastructure.
|
Package doctor provides health checks for melange authorization infrastructure. |
|
sqlgen
Package sqlgen generates specialized SQL functions for OpenFGA authorization checks.
|
Package sqlgen generates specialized SQL functions for OpenFGA authorization checks. |
|
sqlgen/analysis
Package analysis provides relation analysis and strategy selection for SQL code generation.
|
Package analysis provides relation analysis and strategy selection for SQL code generation. |
|
sqlgen/inline
Package inline generates VALUES clauses for inlining metadata into SQL functions.
|
Package inline generates VALUES clauses for inlining metadata into SQL functions. |
|
sqlgen/plpgsql
Package plpgsql provides PL/pgSQL function builder types.
|
Package plpgsql provides PL/pgSQL function builder types. |
|
sqlgen/sqldsl
Package sqldsl provides a type-safe DSL for building PostgreSQL queries.
|
Package sqldsl provides a type-safe DSL for building PostgreSQL queries. |
|
sqlgen/tuples
Package tuples provides tuple-table specific builders and helpers.
|
Package tuples provides tuple-table specific builders and helpers. |
|
studio
Package studio serves melange studio: a local, read-only web console over a melange-managed database.
|
Package studio serves melange studio: a local, read-only web console over a melange-managed database. |
|
melange
module
|
|
|
pkg
|
|
|
clientgen
Package clientgen provides a public API for generating type-safe client code from authorization schemas.
|
Package clientgen provides a public API for generating type-safe client code from authorization schemas. |
|
compiler
Package compiler provides public APIs for compiling OpenFGA schemas to SQL.
|
Package compiler provides public APIs for compiling OpenFGA schemas to SQL. |
|
migrator
Package migrator applies compiled OpenFGA schemas to a PostgreSQL database, installing the generated PL/pgSQL functions and tracking applied migrations.
|
Package migrator applies compiled OpenFGA schemas to a PostgreSQL database, installing the generated PL/pgSQL functions and tracking applied migrations. |
|
parser
Package parser provides OpenFGA schema parsing for melange.
|
Package parser provides OpenFGA schema parsing for melange. |
|
schema
Package schema provides OpenFGA schema types and transformation logic for melange.
|
Package schema provides OpenFGA schema types and transformation logic for melange. |
|
test
module
|
|
|
tooling
module
|
Click to show internal directories.
Click to hide internal directories.