Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
a77bcfa
add iac sync command
futurepastori May 27, 2026
e837a5b
Add Railway config commands
futurepastori Jun 1, 2026
b98a367
Use current graph for config pull
futurepastori Jun 1, 2026
3a4f6c8
Clarify Railway config commands
futurepastori Jun 2, 2026
adaa3e1
Improve config command description
futurepastori Jun 2, 2026
6b908d9
Prompt for config login and project link
futurepastori Jun 2, 2026
6d44222
Allow config flow to create project
futurepastori Jun 2, 2026
4767101
Polish Railway config output
futurepastori Jun 2, 2026
03c2467
Refine config output spacing
futurepastori Jun 2, 2026
9e0864d
Prompt to initialize Railway config
futurepastori Jun 2, 2026
c580c40
Polish config init prompt
futurepastori Jun 2, 2026
d5c417a
Refine prompt styling
futurepastori Jun 2, 2026
798dbc1
Clarify config initialization flow
futurepastori Jun 2, 2026
c7aa8ec
Tighten config link narrative
futurepastori Jun 2, 2026
cfc5471
Compress config apply output
futurepastori Jun 2, 2026
b224a76
Confirm config apply changes
futurepastori Jun 2, 2026
f45ff98
Hide plan next step during apply confirmation
futurepastori Jun 2, 2026
1b74cf0
Align completed spinner output
futurepastori Jun 2, 2026
6bfae83
Improve config init project detection
futurepastori Jun 2, 2026
61c49ac
Preview config changes before up
futurepastori Jun 2, 2026
acc11d5
Show verbose config preview before up
futurepastori Jun 2, 2026
66e6eb6
Create config support files on pull
futurepastori Jun 2, 2026
843c72c
Update Railway config support files
futurepastori Jun 2, 2026
9a5cdf3
Add Railway config skill metadata
futurepastori Jun 2, 2026
c1ed1bb
Always show config change details
futurepastori Jun 2, 2026
4aeee9f
Remove unused config diff renderer
futurepastori Jun 2, 2026
3a328e2
Preserve imported build details
futurepastori Jun 2, 2026
eef2b8d
Send config runner context
futurepastori Jun 4, 2026
c4b59f2
Improve pulled config rendering
futurepastori Jun 4, 2026
6280f37
Update config support assets for v0 DSL
futurepastori Jun 5, 2026
cb5fca7
Document railway.json migration guard
futurepastori Jun 5, 2026
0a472fd
Stop generating environment declarations
futurepastori Jun 5, 2026
3481072
Generate resources in Railway config
futurepastori Jun 5, 2026
ee7e2ef
Merge master into config commands
futurepastori Jun 5, 2026
d900326
fmt
futurepastori Jun 5, 2026
faaaac6
Keep Railway config scoped to config commands
futurepastori Jun 5, 2026
f414dc2
Resolve Railway config runner from project
futurepastori Jun 5, 2026
b5c2572
Tighten config runner install error
futurepastori Jun 5, 2026
e245f23
Link IaC docs from config init
futurepastori Jun 5, 2026
fd98f6b
Use standard config command module
futurepastori Jun 5, 2026
2a6f141
Nest Railway config runner module
futurepastori Jun 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions assets/railway-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Railway configuration

This project defines its Railway infrastructure in code.

```txt
.railway/railway.ts
```

Use this file to describe the Railway project you want: services, databases, buckets, custom domains, replicas, groups, and environment variables.

## Common commands

Create the configuration files:

```bash
railway config init
```

Import an existing Railway project into code:

```bash
railway config pull
```

Preview what Railway would change:

```bash
railway config plan
```

Apply the planned changes:

```bash
railway config apply
```

Deploy this directory:

```bash
railway up
```

If `.railway/railway.ts` has pending project changes, `railway up` previews them and asks before applying them.

## Notes

- `railway config plan` is safe and does not change Railway.
- `railway config apply` asks before applying unless you pass `--yes`.
- `railway up` deploys this directory when the service has no GitHub or image source.
- Services already managed by `railway.json` / `railway.toml` must be migrated before `.railway/railway.ts` can manage them.
- Use `replicas` for scaling; advanced placement can still specify region names.
- Use `group("Name", [resources])` to keep large projects organized on the Railway canvas.
- Secrets imported from Railway may be omitted or represented with `preserve()` so they are not overwritten.
212 changes: 212 additions & 0 deletions assets/railway-config/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
---
name: railway-config
description: Edit this project's Railway infrastructure-as-code configuration. Use this skill whenever the user asks to create, change, import, review, deploy, or troubleshoot Railway project infrastructure for the current repository, including services, databases, buckets, custom domains, replicas/regions, groups, environment variables, `railway config *`, `.railway/railway.ts`, or `railway up` behavior.
---

# Railway configuration skill

Use this skill when editing this repository's Railway configuration.

The source of desired Railway project state is:

```txt
.railway/railway.ts
```

## Core rules

1. Express Railway product intent, not internal API details.
2. Do not write Railway UUIDs into `.railway/railway.ts`.
3. Do not write `EnvironmentConfigPatch`, `ServiceInstance`, Backboard internals, or generated Railway domains into source.
4. Prefer Railway configuration helpers like `service()`, `postgres()`, `redis()`, `mysql()`, `mongo()`, `bucket()`, `group()`, `github()`, and `image()`.
5. Use `service.env.VARIABLE` and `database.env.VARIABLE` for references.
6. Keep secrets out of source. Prefer omitting unknown imported secrets; use `preserve()` when an existing Railway-managed value must be explicitly retained.
7. Prefer product DSL names such as `domains`, `replicas`, and `group`; avoid internal names like `customDomains` and `multiRegionConfig`.
8. Do not add platform defaults unless the user explicitly wants them.
9. Do not manage a service from both `.railway/railway.ts` and `railway.json` / `railway.toml`; migrate the repo config first.
10. After editing `.railway/railway.ts`, run `railway config plan`.
11. Do not run `railway config apply` unless the user asks.

## Commands

Initialize configuration files:

```bash
railway config init
```

Import current Railway state:

```bash
railway config pull
```

Preview changes:

```bash
railway config plan
```

Apply changes:

```bash
railway config apply
```

Deploy this directory:

```bash
railway up
```

Machine-readable preview:

```bash
railway config plan --json
```

## Authoring

Use Railway configuration helpers:

```ts
import {
bucket,
defineRailway,
github,
group,
image,
mongo,
mysql,
postgres,
preserve,
project,
redis,
service,
} from "railway/iac";
```

Minimal local service:

```ts
const web = service("web", {
build: "bun run build",
start: "NODE_ENV=production bun src/index.ts",
});
```

GitHub service:

```ts
const web = service("web", {
source: github("owner/repo", { branch: "main" }),
build: "pnpm run build",
start: "pnpm start",
});
```

Docker image service:

```ts
const worker = service("worker", {
source: image("ghcr.io/acme/worker:latest"),
});
```

Database reference:

```ts
const db = postgres("postgres");

const web = service("web", {
env: {
DATABASE_URL: db.env.DATABASE_URL,
},
});
```

Service-to-service reference:

```ts
const api = service("api", {
env: {
INTERNAL_TOKEN: preserve(),
},
});

const web = service("web", {
env: {
API_TOKEN: api.env.INTERNAL_TOKEN,
API_HOST: api.env.RAILWAY_PRIVATE_DOMAIN,
},
});
```

Custom domains:

```ts
const web = service("web", {
domains: ["app.example.com"],
});
```

Replicas:

```ts
const web = service("web", {
replicas: 3,
});
```

Advanced placement:

```ts
const web = service("web", {
replicas: {
"us-west2": 2,
"europe-west4": 1,
},
});
```

Groups:

```ts
const api = service("api");
const worker = service("worker");
const backend = group("Backend", [api, worker]);
```

Bucket:

```ts
const media = bucket("media", { region: "iad" });
```

Project shape:

```ts
export default defineRailway(() => {
const db = postgres("postgres");
const web = service("web", {
env: {
DATABASE_URL: db.env.DATABASE_URL,
},
});

return project("my-app", {
resources: [db, web],
});
});
```

## Review checklist

Before applying changes, confirm:

- `railway config plan` shows only expected changes.
- Secrets are not replaced with literal placeholder values.
- Existing Railway-managed variables are omitted or use `preserve()` when the value should remain untouched.
- Custom domains are declared with `domains`, not networking internals.
- Scaling is declared with `replicas`, not `multiRegionConfig`.
- No generated Railway service domains are committed.
Loading
Loading