platform-go

module
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0

README

platform-go

platformgo is a command line tool that creates, generates and maintains Go projects.

Status: early development.

Commands

Command What it does State
platformgo new <module-path> creates a project: wiring, compose, and — following taply — Dockerfile, Makefile, golangci-lint configuration and CI ready
platformgo plan shows what apply would do: modules added and removed, files to create, rewrite and delete ready
platformgo apply brings the project in line with platformgo.yaml: generated files, files a module needs, removal of what a removed module left, platformgo.lock, go mod tidy ready
platformgo generate [--check] apply without go mod tidy, plus sqlc and buf; --check fails when anything is stale ready
platformgo verify the check for CI, same as generate --check ready
platformgo migrate create <name> adds a goose SQL migration to db/migrations ready
platformgo db generate [--dsn] migrates the database and regenerates the jet query builder ready
platformgo lint the checks of taply in one command: format, go mod tidy, build, generation, file length, golangci-lint, proto lint and breaking changes with api, govulncheck ready
platformgo doctor [--fix] checks Go, git, Docker, shell completion and, inside a project, platformgo.yaml, the pinned platform version, generation and .env files; --fix applies generation, copies .env files from their examples and installs completion ready
platformgo upgrade [version] moves a project to a platform version: go get, the version recorded in platformgo.yaml, apply by the new version; codemods are planned ready
platformgo setup [--alias] [--remove] shell completion for zsh, bash and fish and the short pgo alias, as one block in the shell configuration that a second run replaces ready
platformgo completion <shell> prints the completion script ready

Inside a project, the installed platformgo runs project commands with the version the project pins in go.mod (go tool platformgo) when the two differ, so a project is always generated by its own platform version. new, setup, completion, doctor and version always run the installed binary.

A project is described declaratively in platformgo.yaml — see docs/config.md.

Modules

Module State
postgres — pool, health, metrics, transactions, migrations on start, sqlc static and jet dynamic queries, local database in compose ready
settings — business settings from settings.yaml, stored in the database, typed access ready
admin — admin panel: sign in with one time codes, roles, accounts, audit log, settings pages, project pages ready
api — gRPC and REST gateway from proto files, OpenAPI 3.1 with validation rules, interceptors, health, CORS, docs ready
river — background jobs, periodic jobs scheduled from business settings, job options carried by the job as in taply ready
s3 — object storage with taply's storage API: public and private buckets, streaming uploads, signed links, MinIO in compose ready
rbac — access to gRPC and REST methods by role, taply's casbin model and policy, embedded policy file ready
i18n — translated entity fields and error messages by Accept-Language, taply's proto option, table and error translation ready
enums — catalog of enums from taply's go-enum markers, served translated and used for validation ready
web — server rendered pages next to the API: templ with generation pinned, htmx fragments, CSRF, sealed cookies, hashed assets, strict CSP ready
monitoring — own observability stack: OpenTelemetry collector, Prometheus, Alertmanager, Loki, Tempo, Grafana; dashboard and alerts follow the enabled modules, thresholds in taply's monitoring.yml ready
tracing — OpenTelemetry spans for gRPC and REST, trace_id in logs, W3C propagation (core) ready

Layout

  • Modules are declared in platformgo.yaml and applied with platformgo apply at any time. A project holds two kinds of platform files: generated ones (wiring, compose, .env.example, db/sqlc.yaml, buf.gen.yaml, typed settings) are rebuilt by generate and removed with their module; owned ones (main.go, wire.go, Makefile, Dockerfile, CI, settings.yaml) are created once and belong to the project.
  • platformgo.lock records what has been applied — modules, generated files, tools added to go.mod — which is what lets apply clean up after a removed module. The platform version lives in go.mod.
  • Libraries of the platform live in github.com/aidarbn/platform-go/kit/...; modules in a project stay a thin layer on top of them.

Documentation

Installation

go install github.com/aidarbn/platform-go/cmd/platformgo@latest

License

Copyright 2026 Aidar Babanov.

The platform code — the platformgo tool and the kit libraries — is distributed under the Apache 2.0 license.

Code that platformgo creates inside your project (templates, examples, generated files) belongs to your project: use it, change it and distribute it without any conditions, including without keeping license notices.

Directories

Path Synopsis
cmd
platformgo command
Command platformgo creates, generates and maintains Go projects on the platform.
Command platformgo creates, generates and maintains Go projects on the platform.
internal
apply
Package apply brings a project in line with its platformgo.yaml.
Package apply brings a project in line with its platformgo.yaml.
codegen
Package codegen runs the external generators of the postgres module: sqlc for static queries and jet for dynamic ones.
Package codegen runs the external generators of the postgres module: sqlc for static queries and jet for dynamic ones.
codemod
Package codemod rewrites project code when an incompatible change of kit arrives.
Package codemod rewrites project code when an incompatible change of kit arrives.
gen
Package gen generates project files from platformgo.yaml.
Package gen generates project files from platformgo.yaml.
gomod
Package gomod reads and edits the go.mod of a project through the go command.
Package gomod reads and edits the go.mod of a project through the go command.
lint
Package lint runs the checks of a project in one place: the checks of taply, with the ones that depend on a module run only when the module is enabled.
Package lint runs the checks of a project in one place: the checks of taply, with the ones that depend on a module run only when the module is enabled.
lock
Package lock reads and writes platformgo.lock: what platformgo has actually applied to a project.
Package lock reads and writes platformgo.lock: what platformgo has actually applied to a project.
registry
Package registry is the catalogue of modules platformgo knows how to wire in.
Package registry is the catalogue of modules platformgo knows how to wire in.
scaffold
Package scaffold creates a new project on the platform.
Package scaffold creates a new project on the platform.
settingsdef
Package settingsdef reads settings.yaml, the business settings schema of a project.
Package settingsdef reads settings.yaml, the business settings schema of a project.
setup
Package setup prepares the shell of a developer: completion for platformgo and the short pgo alias.
Package setup prepares the shell of a developer: completion for platformgo and the short pgo alias.
spec
Package spec reads and validates platformgo.yaml, the description of a project.
Package spec reads and validates platformgo.yaml, the description of a project.
upgrade
Package upgrade moves a project to another platform version.
Package upgrade moves a project to another platform version.
version
Package version holds the platform version stamped into new projects.
Package version holds the platform version stamped into new projects.
kit
adminx
Package adminx holds the primitives the admin UI is built from: passwords, one time codes, sessions and the audit log.
Package adminx holds the primitives the admin UI is built from: passwords, one time codes, sessions and the audit log.
confx
Package confx reads settings from environment variables.
Package confx reads settings from environment variables.
enumx
Package enumx is the catalog of the enums of a project: every allowed value of a status, a provider or a type with its description, for clients and for validation.
Package enumx is the catalog of the enums of a project: every allowed value of a status, a provider or a type with its description, for clients and for validation.
i18nx
Package i18nx translates the API, ported from taply's i18n package: translations of entity fields stored in the database and substituted into responses by Accept-Language, and static translations of error messages.
Package i18nx translates the API, ported from taply's i18n package: translations of entity fields stored in the database and substituted into responses by Accept-Language, and static translations of error messages.
internal/testapi/platformtest/v1
Package platformtestv1 is a reverse proxy.
Package platformtestv1 is a reverse proxy.
logx
Package logx builds an slog logger configured the same way in every project.
Package logx builds an slog logger configured the same way in every project.
modules/admin
Package admin is a platform module: the admin panel of the project, running inside the same binary as the application.
Package admin is a platform module: the admin panel of the project, running inside the same binary as the application.
modules/api
Package api is a platform module: a gRPC server and a REST gateway in front of it, with the interceptors every service needs and the OpenAPI description of the API.
Package api is a platform module: a gRPC server and a REST gateway in front of it, with the interceptors every service needs and the OpenAPI description of the API.
modules/enums
Package enums is a platform module: the catalog of the enums of the project served to clients, as taply's GetEnums does, with descriptions translated when i18n is enabled.
Package enums is a platform module: the catalog of the enums of the project served to clients, as taply's GetEnums does, with descriptions translated when i18n is enabled.
modules/i18n
Package i18n is a platform module: translations of API responses and error messages, ported from taply.
Package i18n is a platform module: translations of API responses and error messages, ported from taply.
modules/postgres
Package postgres is a platform module: a PostgreSQL connection pool with a health check, pool metrics and a clean shutdown.
Package postgres is a platform module: a PostgreSQL connection pool with a health check, pool metrics and a clean shutdown.
modules/rbac
Package rbac is a platform module: role based access to the gRPC methods of the API, in the model and policy format of taply.
Package rbac is a platform module: role based access to the gRPC methods of the API, in the model and policy format of taply.
modules/riverx
Package riverx is a platform module: background jobs on River, stored in the PostgreSQL database of the postgres module.
Package riverx is a platform module: background jobs on River, stored in the PostgreSQL database of the postgres module.
modules/s3
Package s3 is a platform module: S3 compatible object storage — MinIO locally, any S3 in production — for the files of the project.
Package s3 is a platform module: S3 compatible object storage — MinIO locally, any S3 in production — for the files of the project.
modules/settings
Package settings is a platform module: business settings of the project, stored in the database and editable without a deploy.
Package settings is a platform module: business settings of the project, stored in the database and editable without a deploy.
modules/web
Package web is a platform module: server rendered pages next to the API — templ components, htmx fragments, CSRF protection, sealed cookies and hashed static assets from kit/webx.
Package web is a platform module: server rendered pages next to the API — templ components, htmx fragments, CSRF protection, sealed cookies and hashed static assets from kit/webx.
pgdb
Package pgdb opens a PostgreSQL connection pool and helps with transactions.
Package pgdb opens a PostgreSQL connection pool and helps with transactions.
settingsx
Package settingsx holds the business settings of a project: the schema, the current values and typed access to them.
Package settingsx holds the business settings of a project: the schema, the current values and typed access to them.
webx
Package webx serves server rendered pages: templ components rendered as a whole page or as an htmx fragment, CSRF protection, sealed cookies for the state of multi step forms, static assets with content hashed names and a strict content security policy.
Package webx serves server rendered pages: templ components rendered as a whole page or as an htmx fragment, CSRF protection, sealed cookies for the state of multi step forms, static assets with content hashed names and a strict content security policy.

Jump to

Keyboard shortcuts

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