Template
Source:
src/Railway/Template.ts
A Railway.Template deploys a marketplace template into a Project.
Alchemy looks up the template (template / templates), sends
templateDeployV2 with its serializedConfig, and adopts the
project/services the workflow creates.
Pass a Project to deploy into an existing one. Omit project and
Alchemy creates an owned Project first (the workspace project-create
cap is serialized).
Deploy a marketplace template
Section titled “Deploy a marketplace template”templateId is a marketplace UUID or code (postgres). Pass a
Project to deploy into it.
const site = yield* Railway.Project("Site");const db = yield* Railway.Template("Postgres", { templateId: "postgres", project: site,});Create the Project
Section titled “Create the Project”Omit project to let Alchemy create one. The name is stamped so
nuke can reclaim it.
const db = yield* Railway.Template("Postgres", { templateId: "postgres",});Serialized config
Section titled “Serialized config”Omit serializedConfig to use the marketplace default. Pass a
config (from template.serializedConfig, with service variable
values filled in) to override.
const db = yield* Railway.Template("Postgres", { templateId: "postgres", project: site, serializedConfig: config,});Environment
Section titled “Environment”Defaults to the Project’s primary environment.
const staging = yield* Railway.Environment("Staging", { project: site });const db = yield* Railway.Template("StagingPostgres", { templateId: "postgres", project: site, environment: staging,});Module-scope declarations
Section titled “Module-scope declarations”Resource-valued props accept the resource or an Effect producing it.
import * as Railway from "alchemy/Railway";
export const Site = Railway.Project("Site");export const Postgres = Railway.Template("Postgres", { templateId: "postgres", project: Site,});