Project groups and templates
Project groups collect related deployable services into one product unit. They let the services share a repository, variables, and routes while keeping each service's own build and environment settings. Templates provide a repeatable way to create one or more such services, and guided imports turn apps found in a group repository into services that follow that repository. See deployment lifecycle, projects and environments, deployment orchestration, domains and networking, and CLI and automation for the surrounding flows.
Project group model
A project group is an optional parent for deployable services. In this area, a service means a deployable project, not a managed database. A service belongs to at most one group, and an ungrouped service remains a valid standalone deployment.
Group membership
Membership gives several services one product context without merging their individual deployment settings. Services can be added, removed, or moved between groups. Removing a service makes it standalone; deleting the group releases its services but does not stop them.
Standalone services can enter a group from the service view or from a group view. The service view also provides the entry point to create a new group with that service, so grouping can start with either an existing product unit or one service.
Moving or removing a service also removes path routes that depended on that membership. This keeps a route from referring to a service that is no longer part of the same group.
References: crates/…/project_groups.rs• L8-39 crates/…/project_group_members.rs• L8-39 crates/…/service.rs• L645-681 crates/…/service.rs• L1070-1114 web/…/ServiceGroupControl.tsx• L38-57 web/…/ServiceGroupControl.tsx• L84-117
Shared repositories
A group can name one repository and branch for a monorepo. A member that follows the group uses that repository and branch while keeping its own directory and build preset. This lets a frontend, API, and worker deploy from different directories of one source tree.
The repository can be selected through a connected Git provider or read from a public GitHub or GitLab repository without a connection. Connected repositories support push-based deploys. Public repositories can be read and deployed manually, but they cannot send push webhooks.
Following is explicit. Changing the group repository updates only members that follow it, and the group view marks members that drifted or could not be updated so they are not silently left on the old source. A service that already uses the group repository can start following it without changing to a different code source; a service with its own repository is not switched by that one-click action.
Disconnecting the group repository does not change member services: they keep their current repository, branch, and directory, then stop following future group repository changes. If the Git connection is removed, the group remains visible but cannot update its followers until the connection is restored.
References: web/…/GroupRepositoryPanel.tsx• L44-65 web/…/GroupRepositoryPanel.tsx• L93-153 web/…/GroupRepositoryPanel.tsx• L218-253 web/…/DisconnectRepositoryDialog.tsx• L17-45 web/…/FollowedRepositoryNotice.tsx• L15-47 web/…/GroupSettingsPanel.tsx• L419-549 crates/…/repository.rs• L471-550 crates/…/repository.rs• L641-675
Shared variables
Group variables provide common deployment input to every member. The effective order is linked-service defaults, group variables, the service's own variables, and platform-owned values. A service-level value therefore wins when both levels use the same key.
Variables can apply to one environment or to all environments. An all-environment variable reaches previews only when preview use is enabled. Values are encrypted at rest, and secret values are not readable through normal list responses. Changes affect the next deployment rather than a deployment that is already running.
The console shows which members override a shared key. If a member's variables cannot be read, the console marks that result as unknown instead of claiming that the group value applies everywhere. A secret can be changed without exposing its stored value; leaving its value field empty keeps the existing secret.
References: crates/…/env_vars.rs• L4-9 crates/…/project_group_env_vars.rs• L8-25 crates/…/project_group_env_vars.rs• L47-71 web/…/GroupVariablesPanel.tsx• L80-124 web/…/GroupVariablesPanel.tsx• L145-160 web/…/GroupVariablesPanel.tsx• L221-270 web/…/GroupVariablesPanel.tsx• L367-445 web/…/GroupVariablesPanel.tsx• L454-467 web/…/GroupVariablesPanel.tsx• L580-599
Path routes
A path route sends a path on one service's hostnames to another service in the same group. For example, a frontend can send /api to an API service while clients keep using one origin. The route can keep the original path or remove the prefix before forwarding.
Environment matching follows the source environment. A non-preview environment uses the target environment with the same slug. A preview uses the target preview for the same branch, and it never falls back to production. If that matching target does not exist, the route does not reach another environment.
The serving service supplies the protections for routed requests. This means access rules, attack mode, and request limits on the source service do not automatically protect the target service. Removing a route changes live traffic, so the console asks for confirmation first.
References: crates/…/project_group_routes.rs• L8-29 crates/…/project_group_routes.rs• L122-158 crates/…/routes.rs• L4-11 web/…/GroupRoutesSettings.tsx• L60-155 web/…/GroupRoutesSettings.tsx• L186-225 web/…/GroupRoutesSettings.tsx• L227-340
Template model
A template describes a product shape rather than a single source folder. It can define several services, their source or image, service variables, shared variables, managed database needs, and paths between services.
Service definitions
Each template service becomes one deployable service. A definition points to a repository and directory when it builds from source, or to an immutable image when it runs a prebuilt release. The template's shared repository is the fallback for services that do not define their own source.
The template also names how its services relate. Service names identify variable ownership, managed-service bindings, and route endpoints. A multi-service template is therefore a ready-made group layout rather than a list of unrelated projects.
Single-service templates can deploy from a forked source repository, directly from the template's public source repository, or from a prebuilt image. Image-based services do not need a Git connection or a build step, and their runtime defaults can be reviewed before creation.
References: crates/…/templates.rs• L155-230 crates/…/templates.rs• L232-243 crates/…/templates.rs• L246-323 crates/…/templates.rs• L84-110 web/…/TemplateConfigurator.tsx• L258-267 web/…/TemplateConfigurator.tsx• L686-719 web/…/TemplateConfigurator.tsx• L769-805 web/…/TemplateConfigurator.tsx• L889-979
Template inputs
Template inputs make creation guided instead of guess-based. Required variables must receive values, while defaults and supported generators can fill other values. Shared variables become group variables when the template targets a group, so every created service receives the same shared configuration.
When a multi-service template targets an existing group, values already defined by that group remain authoritative for shared inputs. Service names and generated URL values still adapt to the chosen group or service names until the operator edits them.
Templates can require managed databases. The operator can create a needed database or select one that already exists, subject to access to that database. The template's bindings then provide the service with the database values it expects.
References: crates/…/templates.rs• L20-101 crates/…/templates.rs• L196-210 crates/…/instantiation.rs• L281-350 crates/…/instantiation.rs• L1182-1243 web/…/MultiServiceTemplateConfigurator.tsx• L235-353 web/…/MultiServiceTemplateConfigurator.tsx• L571-803 web/…/MultiServiceTemplateConfigurator.tsx• L805-869 web/…/multi-service-template.ts• L118-131 web/…/multi-service-template.ts• L337-377
Starter and app templates
Starter templates give the operator source code to take over. They can use a fork or build directly from a public repository, and they do not create a later catalog upgrade relationship.
App templates represent a reviewed release of an upstream application. Each created service keeps the selected release identity and its resolved definition, so a catalog change becomes an explicit upgrade rather than a silent change to a running service. Prebuilt image services use immutable image references.
References: crates/…/templates.rs• L126-139 crates/…/templates.rs• L507-663 crates/…/templates.rs• L256-271 crates/…/template_creation.rs• L819-860
Instantiation flow
Instantiation is the server-side process that creates a template or imports repository apps. It separates planning from side effects, stores progress for each step, and lets the caller observe or retry the work.
Template instantiation
The template creation request can target a new group, an existing group, or a single service when the template has one service. A new-group target creates the group and its services together. An existing-group target adds the new services to that group and applies its shared configuration.
Before work starts, the system checks permissions, template inputs, database choices, service names, and source choices. It then stores a plan and runs the work in the background. The main stages are:
- Create or select the group and repository, or select the prebuilt image path.
- Create or select required managed databases.
- Create each service with its source, variables, and runtime settings.
- Add the services to the group.
- Apply shared variables and path routes.
- Start the services' first deployments.
The following flow shows how a template becomes a group of deployed services.
flowchart LR
A[Template and operator choices] --> B[Validated plan]
B --> C[Group and source]
C --> D[Managed databases]
D --> E[Services]
E --> F[Shared variables and routes]
F --> G[Initial deployments]
References: crates/…/instantiation_handlers.rs• L363-369 crates/…/instantiation_handlers.rs• L437-493 crates/…/instantiation.rs• L1050-1101 web/…/MultiServiceTemplateConfigurator.tsx• L461-530 web/…/MultiServiceTemplateConfigurator.tsx• L872-923 crates/…/template_creation.rs• L880-1043
Guided repository import
Repository import adds apps that already exist in a group's repository. The console scans a connected repository through its synced record or scans a public GitHub or GitLab repository without a connection. It detects app directories from their framework files or Docker-related files.
The operator reviews the scan, selects apps, and can change each service name. Existing service directories are shown so the import does not silently duplicate them. Selected apps become source-built services in their detected directories, join the group, and follow the group's branch.
The import is also useful when the group already has a repository but no services. If the repository has no connection, the operator must connect it first. Public imports do not gain push-based deploys because the public source cannot send webhooks.
The import moves from repository discovery to a user-confirmed selection and then to the same durable background process used by template creation.
sequenceDiagram
participant O as Operator
participant C as Console
participant R as Repository scanner
participant S as Server
O->>C: Open "From the repository"
C->>R: Scan group repository and branch
R-->>C: Detected app directories and presets
O->>C: Select apps and name services
C->>S: Start import with an idempotency key
S-->>C: Instantiation status and steps
C->>S: Poll or stop following
S-->>C: Services added, following, and deployed
References: crates/…/instantiation_handlers.rs• L716-720 crates/…/instantiation_handlers.rs• L760-830 web/…/ImportServicesDialog.tsx• L153-215 web/…/ImportServicesDialog.tsx• L343-415 web/…/repository-import.ts• L56-77
Progress and retry
Each run has an idempotency key. Repeating the same request returns the existing run instead of starting a second one. The server records the plan and each completed step, so a retry continues after the failed step and keeps services that were already created.
The console follows a run for a limited time. If the dialog closes or the follow time ends, the server continues the run and the group overview can show it later. A failed or interrupted run can be retried when its encrypted input values are still available.
References: crates/…/template_instantiations.rs• L8-51 crates/…/instantiation.rs• L4-13 crates/…/instantiation_handlers.rs• L244-313 crates/…/instantiation_handlers.rs• L961-1034 web/…/follow-instantiation.ts• L7-14 web/…/follow-instantiation.ts• L76-117
Operator interfaces
The console and CLI expose the same group concepts for different working styles. The console emphasizes guided selection and progress. The CLI emphasizes repeatable group, repository, route, variable, and import actions.
Console workflow
The projects list presents a group as one product card while keeping links to each service and its latest deployment. The service view shows group membership and lets a standalone service join an existing group or start a new one.
The group detail page is the main visual workspace. Its settings area separates group identity, repository, path routes, and member services. Its variables area manages shared deployment input, while the repository workflow shows directories, followers, drift, public-source limits, and import actions. Removing a service makes it standalone; deleting the group keeps its services running as standalone services.
The add-services flow separates new service creation, repository import, and moving existing services into the group. Template forms can create a new group or add several services to an existing group, then show the resulting run and its destination.
References: web/…/ProjectGroupCard.tsx• L31-100 web/…/ProjectGroupCard.tsx• L102-166 web/…/ServiceGroupControl.tsx• L38-57 web/…/ServiceGroupControl.tsx• L84-183 web/…/GroupSettingsPanel.tsx• L56-65 web/…/GroupSettingsPanel.tsx• L103-171 web/…/GroupSettingsPanel.tsx• L209-287 web/…/GroupRepositoryPanel.tsx• L155-308 web/…/MultiServiceTemplateConfigurator.tsx• L539-553
CLI workflow
The CLI surface in apps/…/group.ts reports which group contains a service and which other services share it. The broader project-groups command family supports group lifecycle, repository following, repository import, path routes, and shared variables. Use it when a change must be scripted or inspected as structured JSON.
References: apps/…/group.ts• L4-61 skills/…/project-groups.md• L7-25 skills/…/project-groups.md• L138-248
Change checklist
When these files or sections are changed, remember to consider these:
- A template service rename changes service names used by variables, managed-service bindings, routes, and the instantiation form.
- A change to shared-variable precedence or preview scope must stay aligned between group deployment input, inherited-variable views, and template shared variables.
- A group repository change must preserve the distinction between members that follow the repository and members that keep their own source settings.
- Repository connection changes must preserve the separate behavior for connected private sources and public GitHub or GitLab sources.
- A route change must keep template route names, group route records, environment matching, proxy behavior, and target-service protections aligned.
- An instantiation step or status change must remain understandable to the console's polling, row-progress, background, and retry flows.
- Public repository support must keep scan access separate from push-webhook deploy behavior.
- Image-template runtime defaults must remain separate from source-template Git and build choices.
- Group membership changes must keep the service view, group overview, repository follower state, shared-variable scope, and dependent routes consistent.
- Repository disconnect and mutation errors must keep the user-visible result distinct from a successful unlink; a failed request must not claim that services stopped following.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A group's connected Git connection is deleted | Followers cannot be updated or imported from that repository | Choose Change and reconnect the repository before changing followers or importing apps |
| A follower cannot switch after a group repository change | That service still uses its previous repository or branch while other followers use the new source | Read the named failure result and retry after fixing the service-specific cause |
| A group repository is disconnected | Services keep their current source and stop receiving future group repository changes | Treat disconnect as an unlink, not as a service source change |
| A disconnect request fails | The group still has its repository and services keep their prior following state | Treat the error as a failed operation; retry only after the reported cause is fixed |
| A service defines a variable with the same key as a group variable | The service receives its own value instead of the shared value | Check the override status before assuming a group value applies |
| An all-environment group variable is not enabled for previews | Preview deployments do not receive that variable | Set the preview inclusion option when the value is safe for previews |
| A route has no matching target environment | Requests under the path do not reach another environment | Create the same named environment or same-branch preview on the target service |
| A routed target lacks the needed protection | Requests receive the target service's policy, which may not match the source service's policy | Configure protection on the service that serves the path |
| Required template input or database access is missing | Instantiation is rejected before the full group is created | Complete the guided input and select a compatible database or create one |
| A source template uses a public repository | Pushes do not trigger deploys | Connect a Git provider and use a fork when push deployment is required |
| An image template is treated as a source build | The operator expects Git or a build step that the service does not use | Review the image and runtime settings before creation |
| An instantiation fails after its secret inputs are purged | The run cannot safely resume with the original values | Start a new run with the inputs instead of retrying the purged run |
| A member leaves a group | Routes involving that member are removed and shared group values no longer apply | Review routes and service variables after moving or removing a member |
Key files
| File | Why to read it |
|---|---|
| crates/…/service.rs | Defines group membership and the lifecycle effects of adding, moving, removing, or deleting services. |
| crates/…/repository.rs | Explains the group repository as the source for followers and monorepo services. |
| crates/…/env_vars.rs | Defines shared variable inheritance and its deployment precedence. |
| crates/…/routes.rs | Defines service-to-service path routing and environment matching. |
| crates/…/templates.rs | Defines the product-level template model, service definitions, routes, inputs, and app releases. |
| crates/…/instantiation_handlers.rs | Shows the public creation and import workflows and their preflight checks. |
| crates/…/instantiation.rs | Shows the durable plan, ordered steps, and resume model for template runs and imports. |
| web/…/GroupRepositoryPanel.tsx | Shows repository followers, directory mappings, drift, public-source limits, and repository import entry points. |
| web/…/DisconnectRepositoryDialog.tsx | Shows that disconnecting the group repository does not alter service source settings. |
| web/…/FollowedRepositoryNotice.tsx | Shows how a service reports inherited repository settings and can stop following them. |
| web/…/GroupSettingsPanel.tsx | Shows the group settings workspace and the consequences of repository, service, and group changes. |
| web/…/GroupVariablesPanel.tsx | Shows shared variable scope, secret handling, and member override status. |
| web/…/GroupRoutesSettings.tsx | Shows path route creation, environment addresses, target protections, and removal. |
| web/…/ProjectGroupCard.tsx | Shows how the projects list presents a group and links its services and deployment state. |
| web/…/ServiceGroupControl.tsx | Shows how a standalone service joins or creates a group from the service view. |
| web/…/MultiServiceTemplateConfigurator.tsx | Shows how multi-service templates target groups, collect databases and variables, and follow instantiation. |
| web/…/TemplateConfigurator.tsx | Shows the single-service template choices for source repositories, public deploys, images, runtime defaults, and managed services. |
| web/…/ImportServicesDialog.tsx | Shows the guided repository scan, selection, naming, progress, background, and retry experience. |
| web/…/ProjectGroupDetail.tsx | Shows how the console presents the group as one workspace for services, repositories, variables, and settings. |
| skills/…/project-groups.md | Summarizes the automation surface for group, repository, import, route, and variable operations. |