Skip to content

Commit 934f30f

Browse files
authored
feat: r2 state store (#33)
1 parent d56114e commit 934f30f

26 files changed

+564
-285
lines changed

.github/workflows/test.yml

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ jobs:
4343
run: bun test --timeout 120000
4444
env:
4545
CI: true
46+
ALCHEMY_STATE_STORE: cloudflare
47+
CLOUDFLARE_BUCKET_NAME: ${{ secrets.CLOUDFLARE_BUCKET_NAME }}
4648
BRANCH_PREFIX: pr-${{ github.ref_name }}
4749
AWS_REGION: us-west-2
4850
CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }}

alchemy-web/bun.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"@radix-ui/react-label": "^2.1.2",
1010
"@radix-ui/react-slot": "^1.1.2",
1111
"@tailwindcss/vite": "^4.1.1",
12-
"astro": "^5.5.6",
12+
"astro": "^5.6.0",
1313
"clsx": "^2.1.1",
1414
"react": "^19.1.0",
1515
"react-dom": "^19.1.0",
@@ -342,7 +342,7 @@
342342

343343
"array-iterate": ["[email protected]", "", {}, "sha512-I1jXZMjAgCMmxT4qxXfPXa6SthSoE8h6gkSI9BGGNv8mP8G/v0blc+qFnZu6K42vTOiuME596QaLO0TP3Lk0xg=="],
344344

345-
"astro": ["[email protected]", "", { "dependencies": { "@astrojs/compiler": "^2.11.0", "@astrojs/internal-helpers": "0.6.1", "@astrojs/markdown-remark": "6.3.1", "@astrojs/telemetry": "3.2.0", "@oslojs/encoding": "^1.1.0", "@rollup/pluginutils": "^5.1.4", "acorn": "^8.14.1", "aria-query": "^5.3.2", "axobject-query": "^4.1.0", "boxen": "8.0.1", "ci-info": "^4.2.0", "clsx": "^2.1.1", "common-ancestor-path": "^1.0.1", "cookie": "^1.0.2", "cssesc": "^3.0.0", "debug": "^4.4.0", "deterministic-object-hash": "^2.0.2", "devalue": "^5.1.1", "diff": "^5.2.0", "dlv": "^1.1.3", "dset": "^3.1.4", "es-module-lexer": "^1.6.0", "esbuild": "^0.25.0", "estree-walker": "^3.0.3", "flattie": "^1.1.1", "github-slugger": "^2.0.0", "html-escaper": "3.0.3", "http-cache-semantics": "^4.1.1", "js-yaml": "^4.1.0", "kleur": "^4.1.5", "magic-string": "^0.30.17", "magicast": "^0.3.5", "mrmime": "^2.0.1", "neotraverse": "^0.6.18", "p-limit": "^6.2.0", "p-queue": "^8.1.0", "package-manager-detector": "^1.1.0", "picomatch": "^4.0.2", "prompts": "^2.4.2", "rehype": "^13.0.2", "semver": "^7.7.1", "shiki": "^3.2.1", "tinyexec": "^0.3.2", "tinyglobby": "^0.2.12", "tsconfck": "^3.1.5", "ultrahtml": "^1.5.3", "unist-util-visit": "^5.0.0", "unstorage": "^1.15.0", "vfile": "^6.0.3", "vite": "^6.2.4", "vitefu": "^1.0.6", "xxhash-wasm": "^1.1.0", "yargs-parser": "^21.1.1", "yocto-spinner": "^0.2.1", "zod": "^3.24.2", "zod-to-json-schema": "^3.24.5", "zod-to-ts": "^1.2.0" }, "optionalDependencies": { "sharp": "^0.33.3" }, "bin": { "astro": "astro.js" } }, "sha512-SjU6zAlRe/gQrZ558Qhm211Yl8XOZBfjMpZig3XtQpG6zlyHJkElbWQIWXAVPzMg17cFVdv/qZPVHfcP2YOGGw=="],
345+
"astro": ["[email protected]", "", { "dependencies": { "@astrojs/compiler": "^2.11.0", "@astrojs/internal-helpers": "0.6.1", "@astrojs/markdown-remark": "6.3.1", "@astrojs/telemetry": "3.2.0", "@oslojs/encoding": "^1.1.0", "@rollup/pluginutils": "^5.1.4", "acorn": "^8.14.1", "aria-query": "^5.3.2", "axobject-query": "^4.1.0", "boxen": "8.0.1", "ci-info": "^4.2.0", "clsx": "^2.1.1", "common-ancestor-path": "^1.0.1", "cookie": "^1.0.2", "cssesc": "^3.0.0", "debug": "^4.4.0", "deterministic-object-hash": "^2.0.2", "devalue": "^5.1.1", "diff": "^5.2.0", "dlv": "^1.1.3", "dset": "^3.1.4", "es-module-lexer": "^1.6.0", "esbuild": "^0.25.0", "estree-walker": "^3.0.3", "flattie": "^1.1.1", "github-slugger": "^2.0.0", "html-escaper": "3.0.3", "http-cache-semantics": "^4.1.1", "js-yaml": "^4.1.0", "kleur": "^4.1.5", "magic-string": "^0.30.17", "magicast": "^0.3.5", "mrmime": "^2.0.1", "neotraverse": "^0.6.18", "p-limit": "^6.2.0", "p-queue": "^8.1.0", "package-manager-detector": "^1.1.0", "picomatch": "^4.0.2", "prompts": "^2.4.2", "rehype": "^13.0.2", "semver": "^7.7.1", "shiki": "^3.2.1", "tinyexec": "^0.3.2", "tinyglobby": "^0.2.12", "tsconfck": "^3.1.5", "ultrahtml": "^1.5.3", "unist-util-visit": "^5.0.0", "unstorage": "^1.15.0", "vfile": "^6.0.3", "vite": "^6.2.4", "vitefu": "^1.0.6", "xxhash-wasm": "^1.1.0", "yargs-parser": "^21.1.1", "yocto-spinner": "^0.2.1", "zod": "^3.24.2", "zod-to-json-schema": "^3.24.5", "zod-to-ts": "^1.2.0" }, "optionalDependencies": { "sharp": "^0.33.3" }, "bin": { "astro": "astro.js" } }, "sha512-ZzHqdTQ4qtCnXzN9bVb75p/F0UweZYubmijjo++frn4E4KxLX8E7fizbX5Wbo2flvA6z/tUsoDwnYASxLHiM1Q=="],
346346

347347
"axobject-query": ["[email protected]", "", {}, "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ=="],
348348

alchemy-web/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@radix-ui/react-label": "^2.1.2",
1616
"@radix-ui/react-slot": "^1.1.2",
1717
"@tailwindcss/vite": "^4.1.1",
18-
"astro": "^5.5.6",
18+
"astro": "^5.6.0",
1919
"clsx": "^2.1.1",
2020
"react": "^19.1.0",
2121
"react-dom": "^19.1.0",

alchemy.run.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import "./alchemy/src/web/vitepress";
1313
import alchemy from "./alchemy/src";
1414
import { Role, getAccountId } from "./alchemy/src/aws";
1515
import { GitHubOIDCProvider } from "./alchemy/src/aws/oidc";
16-
import { DnsRecords, Zone } from "./alchemy/src/cloudflare";
16+
import { DnsRecords, R2Bucket, Zone } from "./alchemy/src/cloudflare";
1717
import { ImportDnsRecords } from "./alchemy/src/dns";
1818
import { GitHubSecret } from "./alchemy/src/github";
1919
import { AstroProject } from "./alchemy/src/web/astro";
@@ -56,12 +56,17 @@ const githubRole = await Role("github-oidc-role", {
5656
managedPolicyArns: ["arn:aws:iam::aws:policy/AdministratorAccess"],
5757
});
5858

59+
const stateStore = await R2Bucket("state-store", {
60+
name: "alchemy-state-store",
61+
});
62+
5963
const githubSecrets = {
6064
AWS_ROLE_ARN: githubRole.arn,
6165
CLOUDFLARE_API_KEY: process.env.CLOUDFLARE_API_KEY,
6266
CLOUDFLARE_EMAIL: process.env.CLOUDFLARE_EMAIL,
6367
STRIPE_API_KEY: process.env.STRIPE_API_KEY,
6468
OPENAI_API_KEY: process.env.OPENAI_API_KEY,
69+
CLOUDFLARE_BUCKET_NAME: stateStore.name,
6570
};
6671

6772
await Promise.all([
@@ -100,7 +105,10 @@ await DnsRecords("transfer-dns-records", {
100105
),
101106
});
102107

103-
console.log("nameservers:", zone.nameservers);
108+
console.log({
109+
bucketName: stateStore.name,
110+
nameservers: zone.nameservers,
111+
});
104112

105113
if (process.argv.includes("--astro")) {
106114
const astro = await AstroProject("astro", {

alchemy/src/cloudflare/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export * from "./bucket";
33
export * from "./dns";
44
export * from "./durable-object-namespace";
55
export * from "./kv-namespace";
6-
export * from "./state";
6+
export * from "./r2-rest-state-store";
77
export * from "./static-site";
88
export * from "./worker";
99
export * from "./wrangler.json";

0 commit comments

Comments
 (0)