Files
summercms/docs/architecture/go-modules-and-workspaces.md
Jakub Zych e0640220f2 docs(14.3-03): document summer new and the one-command start
- installation: one-liner first, what the script does and its overrides,
  running the generated app, summer new without the script, then the
  examples/hello walkthrough; the obsolete known-issues callout is gone (D-18)
- go modules and workspaces: what summer new writes (relative replace,
  framework detection order, committed relative go.work, no root go.sum);
  plugin:add adds a relative go.work path
- console scaffolding: Creating an application with --framework, --no-plugin,
  --no-git, the files written, first commit and naming convention (D-01)
- console introduction, llms note in site.yaml, root README quick start
2026-10-08 12:08:35 +02:00

5.1 KiB

title, description, section, order
title description section order
Go modules and workspaces Require the framework module, see what summer new writes, develop plugins in a Go workspace, list them in summer.yaml and fork a plugin. architecture 20

Go modules and workspaces

WinterCMS uses Composer to pull in the framework and plugins. SummerCMS uses Go modules: the framework is one module, each plugin is its own module, and the application module requires them all.

The framework module

The framework is the module git.golem15.com/golem15/summercms. Every framework package is imported from git.golem15.com/golem15/summercms/modules/<name>, for example git.golem15.com/golem15/summercms/modules/party.

An application requires the framework in its go.mod. While you work against a local checkout of the framework, point the requirement at it with a replace directive. For an application module acme in a directory next to the framework checkout:

module git.golem15.com/acme/acme

go 1.27.0

require git.golem15.com/golem15/summercms v0.0.0

replace git.golem15.com/golem15/summercms => ../summercms.go

summer make:plugin copies this framework replace into the new plugin's go.mod, rewritten relative to the plugin directory, so the plugin builds against the same checkout.

Applications created by summer new

summer new acme writes these files for you in sm-acme-app, next to the framework checkout. The application module is git.golem15.com/golem15/sm-acme-app, and its go.mod replaces the framework with a relative path, so the directory pair can move together or be cloned elsewhere:

module git.golem15.com/golem15/sm-acme-app

go 1.27.0

toolchain go1.27.0

require git.golem15.com/golem15/summercms v0.0.0

replace git.golem15.com/golem15/summercms => ../summercms

The starter plugin golem15.acme is added through summer plugin:add, so the same go.mod also gets a require of git.golem15.com/golem15/sm-acme-app/plugins/acme and a replace pointing at ./plugins/acme.

summer new picks the framework checkout in this order:

  1. the path given with --framework, relative to the current directory or absolute; a wrong path is an error, not a reason to keep looking;
  2. a sibling directory named summercms, then summercms.go;
  3. the source tree the summer binary was built from, when it was built from a checkout without -trimpath.

Every candidate counts only when its go.mod declares the module git.golem15.com/golem15/summercms; the directory name alone is not enough. Without a match, summer new stops and asks for --framework.

The application also gets a go.work that is committed with it. It lists the application itself and, unless --no-plugin was given, the starter plugin, both as relative use paths:

go 1.27.0

toolchain go1.27.0

use (
	.
	./plugins/acme
)

There is no go.sum in the application root: builds go through the workspace, and go.work.sum, which Go writes on the first build, is listed in .gitignore. The starter plugin keeps its own go.mod and go.sum like any other plugin module.

The summer.yaml manifest

The manifest in the application root names the application module, the binary summer build writes to bin/, and the plugins in activation order:

module: git.golem15.com/acme/acme
binary: acme
plugins:
  - id: acme.user
    module: git.golem15.com/acme/acme/plugins/user
  - id: acme.blog
    module: git.golem15.com/acme/acme/plugins/blog

summer build turns this list into plugins.gen.go. The order is the manifest order, adjusted so that each plugin comes after the plugins it requires. Plugins with no dependency between them keep the order you wrote.

Local plugins in a workspace

A plugin you develop inside the application lives in plugins/<name> as its own module. summer make:plugin acme.blog creates it there, and summer plugin:add plugins/blog registers it:

  • it adds the plugin to summer.yaml;
  • it adds a require and a replace pointing at the local directory to the application's go.mod;
  • it adds the plugin directory to the nearest go.work as a path relative to that file, such as ./plugins/blog, creating a go.work in the application root when there is none.

With a go.work in place, go build, go test and your editor see every local plugin module together. summer build uses the nearest go.work it finds; without one it builds in module mode.

summer make:plugin acme.blog
summer plugin:add plugins/blog
summer build

Replacing and forking a plugin

WinterCMS lets you replace a plugin by overriding its classes. In SummerCMS you fork the plugin's module and point the application at your fork with a replace directive. The plugin ID and the import path stay the same, so nothing else in the application changes:

replace git.golem15.com/acme/user => ../forks/user

Keep the fork's plugin ID unchanged when it must stand in for the original, since other plugins require it by ID. If you want both to exist side by side, give the fork a new module path and a new ID and list it in summer.yaml instead. To extend a plugin without forking it, see Extending plugins.