@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
astro 2,553 lines 97.4 KB
Raw
1 ---
2 import Marketing from "../layouts/Marketing.astro";
3 import Button from "../components/marketing/Button.astro";
4 import AlchemicalDivider from "../components/marketing/AlchemicalDivider.astro";
5 import Yantra from "../brand/Yantra.astro";
6 import TestLoop from "../components/compare/TestLoop.astro";
7 import OneLine from "../components/compare/OneLine.astro";
8 import CodeBlock from "../components/marketing/CodeBlock.astro";
9
10 const TOOLS = ["Alchemy", "SST", "Pulumi", "Terraform", "AWS CDK"] as const;
11
12 // ---------- more than IaC: the same app, split vs together ----------
13 const IAC_INFRA_SRC = `export const Uploads = Cloudflare.R2.Bucket("Uploads");
14
15 export const Api = Cloudflare.Worker("Api", {
16 main: "./src/api.ts",
17 env: { Uploads },
18 });`;
19
20 const IAC_HANDLER_SRC = `export default {
21 async fetch(request: Request, env: Env) {
22 const obj = await env.Uploads.get("hello.txt");
23 return obj
24 ? new Response(await obj.text())
25 : new Response("Not found", { status: 404 });
26 },
27 };`;
28
29 const IAE_SRC = `export const Uploads = Cloudflare.R2.Bucket("Uploads");
30
31 export default Cloudflare.Worker(
32 "Api",
33 { main: import.meta.url },
34 Effect.gen(function* () {
35 const bucket = yield* Cloudflare.R2.ReadWriteBucket(Uploads);
36
37 return {
38 fetch: Effect.gen(function* () {
39 const obj = yield* bucket.get("hello.txt");
40 return obj
41 ? HttpServerResponse.text(yield* obj.text())
42 : HttpServerResponse.text("Not found", { status: 404 });
43 }),
44 };
45 }).pipe(Effect.provide(Cloudflare.R2.ReadWriteBucketBinding)),
46 );`;
47
48 // One row per dimension; the first cell is Alchemy.
49 const ROWS: {
50 label: string;
51 cells: [string, string, string, string, string];
52 }[] = [
53 {
54 label: "Language",
55 cells: [
56 "TypeScript + Effect",
57 "TypeScript + Go",
58 "TypeScript, Python, Go, C#, Java",
59 "HCL",
60 "TypeScript, Python, Java, C#, Go",
61 ],
62 },
63 {
64 label: "Built on",
65 cells: [
66 "Pure TypeScript, end to end",
67 "Pulumi, mostly bridged Terraform providers",
68 "A Go engine, many providers bridged from Terraform",
69 "A Go engine and Go provider plugins",
70 "CloudFormation, a managed engine inside AWS",
71 ],
72 },
73 {
74 label: "Infrastructure and app code together",
75 cells: ["Yes, as typed Effects and Layers", "No", "No", "No", "No"],
76 },
77 {
78 label: "Permissions",
79 cells: [
80 "Derived from the bindings your code uses",
81 "Granted by link",
82 "Unenforced",
83 "Unenforced",
84 "Granted by grant\u2060*\u2060() calls",
85 ],
86 },
87 {
88 label: "Runs locally",
89 cells: [
90 "Emulated on your machine",
91 "No, it deploys to the cloud",
92 "No",
93 "No",
94 "No",
95 ],
96 },
97 {
98 label: "Tests against real infrastructure",
99 cells: [
100 "Deploy, assert, destroy from bun test or Vitest",
101 "No",
102 "No",
103 "No",
104 "No",
105 ],
106 },
107 ];
108
109 // ---------- engine: what sits between your code and the cloud ----------
110 type Layer = { name: string; sub: string };
111 const ENGINES: {
112 tool: string;
113 file: string;
114 layers: Layer[];
115 note: string;
116 ours?: boolean;
117 }[] = [
118 {
119 tool: "Alchemy",
120 file: "alchemy.run.ts",
121 ours: true,
122 note: "1 runtime · TypeScript",
123 layers: [{ name: "Alchemy", sub: "TypeScript + Effect" }],
124 },
125 {
126 tool: "SST",
127 file: "sst.config.ts",
128 note: "3 layers · TypeScript → Go",
129 layers: [
130 { name: "SST", sub: "Go CLI" },
131 { name: "Pulumi engine", sub: "Go" },
132 { name: "Terraform provider", sub: "Go, through a bridge" },
133 ],
134 },
135 {
136 tool: "Pulumi",
137 file: "index.ts",
138 note: "2 layers · gRPC between them",
139 layers: [
140 { name: "Pulumi engine", sub: "Go" },
141 {
142 name: "Provider plugin",
143 sub: "often a bridged Terraform provider",
144 },
145 ],
146 },
147 {
148 tool: "Terraform",
149 file: "main.tf",
150 note: "2 layers · HCL → Go",
151 layers: [
152 { name: "Terraform core", sub: "Go" },
153 { name: "Provider plugin", sub: "Go" },
154 ],
155 },
156 ];
157 // Nested boxes, outermost first (built as HTML because Astro templates
158 // can't recurse inline). All strings are constants above.
159 const nest = (layers: Layer[]): string =>
160 layers.reduceRight(
161 (inner, l, i) =>
162 `<div class="dg-layer" style="--depth:${i}"><span class="dg-layer__name">${l.name}<small>${l.sub}</small></span>${inner}</div>`,
163 "",
164 );
165
166 // ---------- local dev: where one request goes ----------
167 // Each trace is a request's path, one hop per node, on one of two lanes.
168 // Every hop across the network line is marked; Alchemy's never leaves the
169 // machine.
170 // `hold` pauses the dot on that hop for that many seconds and shows a
171 // progress bar on its box (e.g. a deploy the request has to wait for).
172 // Lanes: "m" your machine, "c" cloud, "b" on the network boundary (a step
173 // that runs locally but pushes to the cloud, like a deploy).
174 // `key` identifies the same box across Alchemy's dev modes so it can animate.
175 type Hop = {
176 label: string;
177 lane: "m" | "c" | "b";
178 hold?: number;
179 key?: string;
180 };
181 const TRACE_H = 170;
182 const NET_Y_ = 85;
183 const LANE_Y = { m: 46, c: 124, b: NET_Y_ };
184 const NET_Y = NET_Y_;
185 const STEP = 128;
186 const X0 = 70;
187 type DevMode = {
188 id: string;
189 headline: string;
190 sub: string;
191 hops: Hop[];
192 };
193 // Alchemy's row is interactive: drag Lambda or DynamoDB across the network
194 // line (`remote()` in `alchemy dev`). Both in the cloud means every edit is a
195 // deploy. Boxes are matched across modes by `key`.
196 const ALCHEMY_MODES: DevMode[] = [
197 {
198 id: "local",
199 headline: "0 round trips",
200 sub: "Runs offline. Edits reload in place.",
201 hops: [
202 { label: "browser", lane: "m", key: "src" },
203 { label: "Lambda · Docker", lane: "m", key: "fn" },
204 { label: "DynamoDB · floci", lane: "m", key: "db" },
205 ],
206 },
207 {
208 id: "remote-data",
209 headline: "1 round trip",
210 sub: "remote() puts DynamoDB in the real cloud. Your Lambda still runs locally.",
211 hops: [
212 { label: "browser", lane: "m", key: "src" },
213 { label: "Lambda · Docker", lane: "m", key: "fn" },
214 { label: "DynamoDB", lane: "c", key: "db" },
215 ],
216 },
217 {
218 id: "remote-fn",
219 headline: "2 round trips",
220 sub: "remote() deploys the Lambda for real. It still reads and writes your local DynamoDB.",
221 hops: [
222 { label: "browser", lane: "m", key: "src" },
223 { label: "Lambda", lane: "c", key: "fn" },
224 { label: "DynamoDB · floci", lane: "m", key: "db" },
225 ],
226 },
227 {
228 id: "deploy",
229 headline: "Deploy each edit",
230 sub: "With the whole stack in remote(), dev redeploys it for real as you edit.",
231 hops: [
232 { label: "edit", lane: "m", key: "src" },
233 // Half the Terraform row's hold: no engine or provider plugins to start.
234 { label: "deploy", lane: "b", hold: 2.4, key: "deploy" },
235 { label: "Lambda", lane: "c", key: "fn" },
236 { label: "DynamoDB", lane: "c", key: "db" },
237 ],
238 },
239 ];
240 const TRACES: {
241 tool: string;
242 ours?: boolean;
243 headline: string;
244 sub: string;
245 hops: Hop[];
246 modes?: DevMode[];
247 }[] = [
248 { tool: "Alchemy", ours: true, ...ALCHEMY_MODES[0]!, modes: ALCHEMY_MODES },
249 {
250 tool: "SST",
251 headline: "3 round trips",
252 sub: "Per request, through a deployed stage. Needs a connection.",
253 hops: [
254 { label: "browser", lane: "m" },
255 { label: "API Gateway", lane: "c" },
256 { label: "Lambda stub", lane: "c" },
257 { label: "your code", lane: "m" },
258 { label: "DynamoDB", lane: "c" },
259 ],
260 },
261 {
262 tool: "Pulumi & Terraform",
263 headline: "Deploy first",
264 sub: "No local runtime. Every change is a redeploy.",
265 hops: [
266 { label: "edit", lane: "m" },
267 { label: "deploy", lane: "b", hold: 4.8 },
268 { label: "Lambda", lane: "c" },
269 { label: "DynamoDB", lane: "c" },
270 ],
271 },
272 ];
273 const SPAN = 520;
274 const traceGeom = (hops: Hop[], opts: { fullSpan?: boolean } = {}) => {
275 // Short traces spread out; long ones use the default step. Alchemy's
276 // modes always span the full width so their paths share start and end.
277 const step = opts.fullSpan
278 ? SPAN / Math.max(1, hops.length - 1)
279 : Math.max(STEP, Math.min(190, SPAN / Math.max(1, hops.length - 1)));
280 const pts = hops.map((h, i) => ({
281 ...h,
282 x: X0 + i * step,
283 y: LANE_Y[h.lane],
284 w: Math.max(h.label.length * 6.9 + 24, h.hold ? 96 : 0),
285 }));
286 const segs = pts.slice(1).map((b, i) => {
287 const a = pts[i]!;
288 return a.lane === b.lane
289 ? `M ${a.x} ${a.y} L ${b.x} ${b.y}`
290 : `M ${a.x} ${a.y} C ${a.x + step / 2} ${a.y}, ${b.x - step / 2} ${b.y}, ${b.x} ${b.y}`;
291 });
292 const crosses = (a: Hop, b: Hop) =>
293 a.lane !== b.lane && a.lane !== "b" && b.lane !== "b";
294 const crossings = pts
295 .slice(1)
296 .flatMap((b, i) =>
297 crosses(pts[i]!, b) ? [{ x: (pts[i]!.x + b.x) / 2, y: NET_Y }] : [],
298 );
299
300 // Motion timing for the traveling dot: constant speed, except it slows
301 // to a crawl for CROSS_WINDOW px either side of each network crossing.
302 const bezierLength = (a: (typeof pts)[number], b: (typeof pts)[number]) => {
303 const p = [
304 [a.x, a.y],
305 [a.x + step / 2, a.y],
306 [b.x - step / 2, b.y],
307 [b.x, b.y],
308 ] as const;
309 let len = 0;
310 let prev = p[0];
311 for (let k = 1; k <= 32; k++) {
312 const t = k / 32,
313 u = 1 - t;
314 const q = [0, 1].map(
315 (d) =>
316 u * u * u * p[0][d]! +
317 3 * u * u * t * p[1][d]! +
318 3 * u * t * t * p[2][d]! +
319 t * t * t * p[3][d]!,
320 ) as [number, number];
321 len += Math.hypot(q[0] - prev[0], q[1] - prev[1]);
322 prev = q;
323 }
324 return len;
325 };
326 let total = 0;
327 const crossAt: number[] = [];
328 const nodeAt = [0];
329 pts.slice(1).forEach((b, i) => {
330 const a = pts[i]!;
331 const len =
332 a.lane === b.lane
333 ? Math.hypot(b.x - a.x, b.y - a.y)
334 : bezierLength(a, b);
335 // Lane changes are symmetric, so the crossing is at half their length.
336 if (crosses(a, b)) crossAt.push(total + len / 2);
337 total += len;
338 nodeAt.push(total);
339 });
340 const CROSS_WINDOW = 16;
341 const SLOW = 6;
342 const SPEED = 170; // px/s away from crossings
343 // Breakpoints along the path, each with how the dot covers the span that
344 // ends there: "slow" through a crossing, "hold" (zero distance) at a hop.
345 type Mark = { at: number; kind: "move" | "slow" | "hold"; secs?: number };
346 const marks: Mark[] = [
347 ...crossAt.flatMap((d): Mark[] => [
348 { at: d - CROSS_WINDOW, kind: "move" },
349 { at: d + CROSS_WINDOW, kind: "slow" },
350 ]),
351 ...pts.flatMap((p, i): Mark[] =>
352 p.hold
353 ? [
354 { at: nodeAt[i]!, kind: "move" },
355 { at: nodeAt[i]!, kind: "hold", secs: p.hold },
356 ]
357 : [],
358 ),
359 { at: total, kind: "move" },
360 ].sort((a, b) => a.at - b.at || (a.kind === "hold" ? 1 : -1));
361 const points = [0];
362 const times = [0];
363 const holds: { hop: number; start: number; secs: number }[] = [];
364 for (const m of marks) {
365 const prevAt = points[points.length - 1]!;
366 const prevT = times[times.length - 1]!;
367 const dt =
368 m.kind === "hold"
369 ? m.secs!
370 : ((m.at - prevAt) / SPEED) * (m.kind === "slow" ? SLOW : 1);
371 if (m.kind === "hold") {
372 holds.push({
373 hop: nodeAt.indexOf(m.at),
374 start: prevT,
375 secs: m.secs!,
376 });
377 }
378 points.push(m.at);
379 times.push(prevT + dt);
380 }
381 const dur = times[times.length - 1]!;
382 const motion = {
383 dur: `${dur.toFixed(2)}s`,
384 keyPoints: points.map((m) => (m / total).toFixed(4)).join(";"),
385 keyTimes: times.map((t) => (t / dur).toFixed(4)).join(";"),
386 };
387 // A progress bar on each held hop fills while the dot waits there, stays
388 // full until the loop restarts, then resets.
389 const bars = holds.map((h) => ({
390 hop: h.hop,
391 values: "0;0;1;1",
392 keyTimes: [0, h.start / dur, (h.start + h.secs) / dur, 1]
393 .map((t) => t.toFixed(4))
394 .join(";"),
395 }));
396 return { pts, path: segs.join(" "), crossings, motion, bars };
397 };
398 const laneName = (l: Hop["lane"]) =>
399 l === "m"
400 ? "your machine"
401 : l === "c"
402 ? "cloud"
403 : "on the network boundary";
404 const traceLabel = (tool: string, hops: Hop[], crossings: number) =>
405 `${tool}: ${hops.map((h) => `${h.label} (${laneName(h.lane)})`).join(", then ")}. ${crossings} crossings of the network.`;
406 // Everything the client script needs to redraw Alchemy's row per mode.
407 // Every mode has a box for every slot; a slot a mode doesn't use becomes a
408 // hidden "ghost" sitting on that mode's path, so it can grow out of it.
409 const ALCHEMY_SLOTS = ["src", "deploy", "fn", "db"];
410 type Slot = {
411 x: number;
412 y: number;
413 w: number;
414 label: string;
415 shown: boolean;
416 bar: string | null;
417 };
418 const ALCHEMY_MODE_DATA = ALCHEMY_MODES.map((m) => {
419 const g = traceGeom(m.hops, { fullSpan: true });
420 const shown = ALCHEMY_SLOTS.map((key) => {
421 const i = m.hops.findIndex((h) => h.key === key);
422 if (i < 0) return null;
423 const p = g.pts[i]!;
424 const bar = g.bars.find((b) => b.hop === i);
425 return {
426 x: p.x,
427 y: p.y,
428 w: p.w,
429 label: p.label,
430 shown: true,
431 bar: bar?.keyTimes ?? null,
432 };
433 });
434 const slots: Slot[] = shown.map((s, i) => {
435 if (s) return s;
436 const prev = shown.slice(0, i).reverse().find(Boolean)!;
437 const next = shown.slice(i + 1).find(Boolean)!;
438 // The midpoint of a symmetric curve between its neighbors.
439 return {
440 x: (prev.x + next.x) / 2,
441 y: (prev.y + next.y) / 2,
442 w: 24,
443 label: "",
444 shown: false,
445 bar: null,
446 };
447 });
448 // The route as one cubic per slot gap (same count in every mode), so a
449 // mode switch can morph control points instead of re-deriving curves. A
450 // hidden slot splits its neighbors' curve exactly at t = 0.5, which keeps
451 // the drawn shape identical to the mode's real path.
452 type Cubic = number[]; // x0 y0 c1x c1y c2x c2y x1 y1
453 const cubic = (a: Slot, b: Slot): Cubic => {
454 const h = (b.x - a.x) / 2;
455 return [a.x, a.y, a.x + h, a.y, b.x - h, b.y, b.x, b.y];
456 };
457 const split = ([x0, y0, ax, ay, bx, by, x1, y1]: Cubic): [Cubic, Cubic] => {
458 const mid = (p: number, q: number) => (p + q) / 2;
459 const [m1x, m1y] = [mid(x0, ax), mid(y0, ay)];
460 const [m2x, m2y] = [mid(ax, bx), mid(ay, by)];
461 const [m3x, m3y] = [mid(bx, x1), mid(by, y1)];
462 const [n1x, n1y] = [mid(m1x, m2x), mid(m1y, m2y)];
463 const [n2x, n2y] = [mid(m2x, m3x), mid(m2y, m3y)];
464 const [px, py] = [mid(n1x, n2x), mid(n1y, n2y)];
465 return [
466 [x0, y0, m1x, m1y, n1x, n1y, px, py],
467 [px, py, n2x, n2y, m3x, m3y, x1, y1],
468 ];
469 };
470 const segs: Cubic[] = [];
471 for (let i = 0; i < slots.length - 1;) {
472 const a = slots[i]!;
473 const b = slots[i + 1]!;
474 if (b.shown) {
475 segs.push(cubic(a, b));
476 i += 1;
477 } else {
478 segs.push(...split(cubic(a, slots[i + 2]!)));
479 i += 2;
480 }
481 }
482 return {
483 headline: m.headline,
484 sub: m.sub,
485 local: m.hops.every((h) => h.lane === "m"),
486 lanes: Object.fromEntries(
487 m.hops.flatMap((h) => (h.key ? [[h.key, h.lane]] : [])),
488 ),
489 aria: traceLabel("Alchemy", m.hops, g.crossings.length),
490 path: g.path,
491 segs: segs.map((c) => c.map((n) => +n.toFixed(2))),
492 crossings: g.crossings,
493 motion: g.motion,
494 slots,
495 };
496 });
497
498 ---
499
500 <Marketing
501 title="Alchemy vs SST, Pulumi & Terraform"
502 description="How Alchemy compares to SST, Pulumi, and Terraform: pure TypeScript and Effect instead of wrapped Go engines, infrastructure and app code built together with Effects and Layers, true local emulation, and deploy-test-destroy loops built for agents."
503 >
504 <!-- ───────────────── HERO ───────────────── -->
505 <section class="cmp-hero cmp-pat-1">
506 <div class="cmp-container">
507 <Yantra class="cmp-hero__mark" size={40} />
508 <p class="cmp-eyebrow">Compare</p>
509 <h1 class="cmp-hero__title" data-copy>
510 More than just Infrastructure as Code
511 </h1>
512 <p class="cmp-hero__lede" data-copy>
513 Terraform, Pulumi, SST, and the CDK deploy your infrastructure and stop there. Alchemy is built on its own Infrastructure as Code engine in TypeScript, and builds your application on top of it with Effects and Layers. That opens the door to fully integrated features: <a href="#app-code">app code</a>, <a href="#testing">testing</a>, <a href="#engine">engine</a>, <a href="#bindings">bindings</a>, <a href="#permissions">permissions</a>, and <a href="#local">local dev</a>.
514 </p>
515 </div>
516 </section>
517
518 <!-- ───────────────── AT A GLANCE ───────────────── -->
519 <section class="cmp-section cmp-pat-2" aria-labelledby="glance">
520 <div class="cmp-container">
521 <h2 class="cmp-h2" id="glance" data-copy>
522 At a glance
523 </h2>
524 <div
525 class="cmp-table-wrap"
526 tabindex="0"
527 role="region"
528 aria-label="Comparison table"
529 >
530 <table class="cmp-table">
531 <thead>
532 <tr>
533 <td></td>
534 {TOOLS.map((t, i) => (
535 <th
536 scope="col"
537 class:list={[i === 0 && "is-ours"]}
538 >
539 {i === 0 ? <Yantra size={18} /> : null}
540 {t}
541 </th>
542 ))}
543 </tr>
544 </thead>
545 <tbody>
546 {ROWS.map((row) => (
547 <tr>
548 <th scope="row">{row.label}</th>
549 {row.cells.map((c, i) => (
550 <td
551 class:list={[
552 i === 0 && "is-ours",
553 (c.startsWith("No") ||
554 c === "Unenforced") &&
555 "is-no",
556 ]}
557 >
558 {c}
559 </td>
560 ))}
561 </tr>
562 ))}
563 </tbody>
564 </table>
565 </div>
566 </div>
567 </section>
568
569 <AlchemicalDivider variant="dot" class="cmp-divider" />
570
571 <!-- ───────────────── APP CODE ───────────────── -->
572 <section
573 class="cmp-section cmp-pat-3"
574 id="app-code"
575 aria-labelledby="app-code-h"
576 >
577 <div class="cmp-container">
578 <h2 class="cmp-h2" id="app-code-h" data-copy>
579 Infrastructure and app code, together
580 </h2>
581 <p class="cmp-lede" data-copy>
582 Other IaC tools only cover your infrastructure. The code that runs on it is a separate program that finds the Bucket through an environment variable, so the two halves meet at one name and every feature has to change in both. In Alchemy the Worker is an Effect that asks for the Bucket itself: one line gives it access when you deploy and a typed client while it runs. Layers then let a service bring its own infrastructure. <a href="/what-is-alchemy">What is Alchemy?</a>
583 </p>
584 <div class="cmp-vs">
585 <div class="cmp-vs__side">
586 <h3 class="cmp-vs__label" data-copy>Other IaC tools: two programs</h3>
587 <CodeBlock filename="infra.ts" code={IAC_INFRA_SRC} compact />
588 <CodeBlock filename="src/api.ts" code={IAC_HANDLER_SRC} compact />
589 </div>
590 <div class="cmp-vs__side is-ours">
591 <h3 class="cmp-vs__label" data-copy>Alchemy: Effects and Layers</h3>
592 <CodeBlock filename="src/api.ts" code={IAE_SRC} compact highlight={[[7, 7]]} />
593 </div>
594 </div>
595 </div>
596 </section>
597
598 <AlchemicalDivider variant="triangle" class="cmp-divider" />
599
600 <!-- ───────────────── TESTING ───────────────── -->
601 <section
602 class="cmp-section cmp-pat-1"
603 id="testing"
604 aria-labelledby="testing-h"
605 >
606 <div class="cmp-container">
607 <h2 class="cmp-h2" id="testing-h" data-copy>
608 A complete iteration loop for agents
609 </h2>
610 <p class="cmp-lede" data-copy>
611 Alchemy Test deploys a real stack, runs tests on that deployment, then tears it down all from the test runner you already use. All agent's have to do to test against real infrastructure is make a code change, then run a test file; this keeps the loop extremely tight and lets ai agents move fast without breaking. Our <a href="https://github.com/alchemy-run/alchemy/tree/main/examples/cloudflare-preview-benchmark"> preview benchmark </a> takes 17 seconds for 1 full loop, <strong>no competitor even has a full loop</strong>.
612 </p>
613 <TestLoop />
614 </div>
615 </section>
616
617 <AlchemicalDivider variant="square" class="cmp-divider" />
618
619 <!-- ───────────────── ENGINE ───────────────── -->
620 <section
621 class="cmp-section cmp-pat-3"
622 id="engine"
623 aria-labelledby="engine-h"
624 >
625 <div class="cmp-container">
626 <h2 class="cmp-h2" id="engine-h" data-copy>
627 Its own engine, not a wrapper
628 </h2>
629 <p class="cmp-lede" data-copy>
630 Every competitor has a core and providers have to talk to that
631 core over a bridge, in some cases even 2. Alchemy just imports
632 providers as typescript and runs them directly, this means
633 alchemy can just deploy resources instead of waiting on events.
634 </p>
635 <div class="dg-engine">
636 {ENGINES.map((e) => (
637 <figure
638 class:list={["dg-engine__tool", e.ours && "is-ours"]}
639 >
640 <figcaption>{e.tool}</figcaption>
641 <span class="dg-pill">{e.file}</span>
642 <span class="dg-down" aria-hidden="true" />
643 <div class="dg-nest" set:html={nest(e.layers)} />
644 <span class="dg-down" aria-hidden="true" />
645 <span class="dg-pill dg-pill--cloud">Cloud API</span>
646 <p class="dg-note">{e.note}</p>
647 </figure>
648 ))}
649 </div>
650 </div>
651 </section>
652
653 <AlchemicalDivider variant="pentagon" class="cmp-divider" />
654
655 <!-- ───────────────── BINDINGS ───────────────── -->
656 <section
657 class="cmp-section cmp-pat-4"
658 id="bindings"
659 aria-labelledby="bindings-h"
660 >
661 <div class="cmp-container">
662 <h2 class="cmp-h2" id="bindings-h" data-copy>
663 One line does three jobs
664 </h2>
665 <p class="cmp-lede" data-copy>
666 To read a table, a function needs three things that usually
667 live in three different places: a permission, the table's
668 name, and a client. In Alchemy the function's code asks for
669 the capability, and that one line produces all three: its
670 statement in the IAM policy, the table's name, and a typed
671 client.
672 </p>
673 <OneLine />
674 </div>
675 </section>
676
677 <AlchemicalDivider variant="hexagon" class="cmp-divider" />
678
679 <!-- ───────────────── PERMISSIONS ───────────────── -->
680 <section
681 class="cmp-section cmp-pat-5"
682 id="permissions"
683 aria-labelledby="permissions-h"
684 >
685 <div class="cmp-container">
686 <h2 class="cmp-h2" id="permissions-h" data-copy>
687 Principle of least privilege
688 </h2>
689 <p class="cmp-lede" data-copy>
690 In Alchemy permission policies are created from your code. This allows least privilege security policies to be inferred on the type level. SST provides link to automate common policy usecases, but are one size fits all, not lease privilege. Pulumi &amp; terraform offer no enforcement, so you have to manually maintain permission policies yourself.
691 </p>
692 <div class="dg-perm">
693 {[
694 {
695 tool: "Alchemy",
696 ours: true,
697 needed: 42,
698 granted: 42,
699 dashed: false,
700 code: "DynamoDB.GetItem(table)",
701 grant: "dynamodb:GetItem on table",
702 verdict: "Exact",
703 },
704 {
705 tool: "SST",
706 needed: 42,
707 granted: 60,
708 dashed: false,
709 code: "link: [table]",
710 grant: "dynamodb:* on table",
711 verdict: "Close",
712 },
713 {
714 tool: "Pulumi & Terraform",
715 needed: 42,
716 granted: 78,
717 dashed: true,
718 code: "a policy you write",
719 grant: "often dynamodb:* on *",
720 verdict: "Unenforced",
721 },
722 ].map((d) => (
723 <figure class:list={["dg-perm__tool", d.ours && "is-ours"]}>
724 <figcaption>{d.tool}</figcaption>
725 <svg
726 viewBox="0 0 180 180"
727 class="dg-perm__rings"
728 role="img"
729 aria-label={`${d.tool}: grants ${d.grant}`}
730 >
731 <circle
732 class:list={[
733 "dg-perm__granted",
734 d.dashed && "is-dashed",
735 ]}
736 cx="90"
737 cy="90"
738 r={d.granted}
739 />
740 <circle
741 class="dg-perm__needed"
742 cx="90"
743 cy="90"
744 r={d.needed}
745 />
746 <text
747 x="90"
748 y="94"
749 text-anchor="middle"
750 class="dg-perm__label"
751 >
752 needed
753 </text>
754 </svg>
755 <code class="dg-perm__code">{d.code}</code>
756 <p class="dg-perm__grant">
757 grants <code>{d.grant}</code>
758 </p>
759 <p
760 class:list={[
761 "dg-verdict",
762 d.ours && "dg-verdict--yes",
763 ]}
764 >
765 {d.verdict}
766 </p>
767 </figure>
768 ))}
769 </div>
770 <ul class="dg-legend" aria-label="Legend">
771 <li><span class="dg-legend__needed" aria-hidden="true"></span>what the code needs</li>
772 <li><span class="dg-legend__granted" aria-hidden="true"></span>granted, scoped by the tool</li>
773 <li><span class="dg-legend__manual" aria-hidden="true"></span>granted by a policy you maintain</li>
774 </ul>
775 </div>
776 </section>
777
778 <AlchemicalDivider variant="heptagon" class="cmp-divider" />
779
780 <!-- ───────────────── LOCAL DEV ───────────────── -->
781 <section class="cmp-section cmp-pat-6" id="local" aria-labelledby="local-h">
782 <div class="cmp-container">
783 <h2 class="cmp-h2" id="local-h" data-copy>
784 True emulation for faster dev loops
785 </h2>
786 <p class="cmp-lede" data-copy>
787 <code>alchemy dev</code> runs your stack on your machine, in
788 the cloud, or a mix of both, and you choose. Other tools pick
789 one model for you, and some have no dev mode at all, so every
790 change waits on a deploy.
791 </p>
792 <div class="dg-traces">
793 {TRACES.map((t, ti) => {
794 const g = traceGeom(t.hops, { fullSpan: !!t.modes });
795 const mode0 = t.modes ? ALCHEMY_MODE_DATA[0]! : null;
796 const last = g.pts[g.pts.length - 1]!;
797 return (
798 <figure
799 class:list={["dg-trace", t.ours && "is-ours"]}
800 data-modes={
801 t.modes
802 ? JSON.stringify(ALCHEMY_MODE_DATA)
803 : undefined
804 }
805 >
806 <figcaption class="dg-trace__meta">
807 <span class="dg-trace__tool">{t.tool}</span>
808 {/* Alchemy's text changes with the drag: every variant sits
809 in the same grid cell (hidden) so the column is always
810 sized to the longest and never shifts. */}
811 <span class="dg-trace__headline dg-stack">
812 <span data-headline>{t.headline}</span>
813 {t.modes?.map((m) => (
814 <span class="dg-sizer" aria-hidden="true">
815 {m.headline}
816 </span>
817 ))}
818 </span>
819 <span class="dg-trace__sub dg-stack">
820 <span data-sub aria-live="polite">
821 {t.sub}
822 </span>
823 {t.modes?.map((m) => (
824 <span class="dg-sizer" aria-hidden="true">
825 {m.sub}
826 </span>
827 ))}
828 </span>
829 </figcaption>
830 <div
831 class="dg-trace__scroll"
832 tabindex="0"
833 role="region"
834 aria-label={`${t.tool} request path`}
835 >
836 <svg
837 viewBox={`0 0 660 ${TRACE_H}`}
838 role={t.modes ? "group" : "img"}
839 aria-label={traceLabel(
840 t.tool,
841 t.hops,
842 g.crossings.length,
843 )}
844 >
845 <rect
846 class="dg-lane dg-lane--m"
847 x="0"
848 y="0"
849 width="660"
850 height={NET_Y}
851 />
852 <rect
853 class="dg-lane dg-lane--c"
854 x="0"
855 y={NET_Y}
856 width="660"
857 height={TRACE_H - NET_Y}
858 />
859 <line
860 class="dg-net"
861 x1="0"
862 y1={NET_Y}
863 x2="660"
864 y2={NET_Y}
865 />
866 <text
867 class="dg-lane__label"
868 x="10"
869 y={NET_Y - 7}
870 >
871 YOUR MACHINE
872 </text>
873 <text
874 class="dg-lane__label"
875 x="10"
876 y={NET_Y + 15}
877 >
878 CLOUD
879 </text>
880 <text
881 class="dg-net__label"
882 x="650"
883 y={NET_Y - 6}
884 text-anchor="end"
885 >
886 network
887 </text>
888 <path
889 class="dg-trace__path"
890 d={g.path}
891 id={`dg-trace-${ti}`}
892 />
893 {t.modes && (
894 <circle
895 class="dg-trace__cross"
896 data-cross-template
897 r="6"
898 cx="-20"
899 cy="-20"
900 hidden
901 />
902 )}
903 <g data-crosses>
904 {g.crossings.map((c) => (
905 <circle
906 class="dg-trace__cross"
907 cx={c.x}
908 cy={c.y}
909 r="6"
910 />
911 ))}
912 </g>
913 {mode0
914 ? mode0.slots.map((p, si) => (
915 <g
916 class:list={[
917 "dg-hop",
918 "is-slot",
919 ALCHEMY_SLOTS[si] ===
920 "deploy" &&
921 "is-boundary",
922 !p.shown && "is-ghost",
923 ]}
924 data-hop={si}
925 {...(ALCHEMY_SLOTS[si] === "fn" ||
926 ALCHEMY_SLOTS[si] === "db"
927 ? {
928 "data-drag":
929 ALCHEMY_SLOTS[si],
930 tabindex: "0",
931 role: "button",
932 }
933 : {})}
934 style={`transform: translate(${p.x}px, ${p.y}px)`}
935 >
936 <rect
937 x={-p.w / 2}
938 y={
939 ALCHEMY_SLOTS[si] ===
940 "deploy"
941 ? -24
942 : -15
943 }
944 width={p.w}
945 height={
946 ALCHEMY_SLOTS[si] ===
947 "deploy"
948 ? 40
949 : 30
950 }
951 rx="8"
952 />
953 <text
954 y={
955 ALCHEMY_SLOTS[si] ===
956 "deploy"
957 ? -8
958 : 4.5
959 }
960 text-anchor="middle"
961 >
962 {p.label}
963 </text>
964 {ALCHEMY_SLOTS[si] ===
965 "deploy" && (
966 <g
967 class="dg-hop__bar"
968 transform="translate(-38 -2)"
969 >
970 <rect
971 class="dg-hop__track"
972 width="76"
973 height="4"
974 rx="2"
975 />
976 <rect
977 class="dg-hop__fill"
978 width="76"
979 height="4"
980 rx="2"
981 >
982 <animateTransform
983 attributeName="transform"
984 type="scale"
985 dur={
986 g.motion
987 .dur
988 }
989 repeatCount="indefinite"
990 calcMode="linear"
991 values="0 1;0 1;1 1;1 1"
992 keyTimes={
993 ALCHEMY_MODE_DATA.find(
994 (m) =>
995 m
996 .slots[
997 si
998 ]!
999 .bar,
1000 )?.slots[
1001 si
1002 ]!.bar ??
1003 "0;0;1;1"
1004 }
1005 data-bar
1006 />
1007 </rect>
1008 </g>
1009 )}
1010 </g>
1011 ))
1012 : g.pts.map((p, pi) => {
1013 const bar = g.bars.find(
1014 (b) => b.hop === pi,
1015 );
1016 return (
1017 <g
1018 class:list={[
1019 "dg-hop",
1020 p.lane === "b" &&
1021 "is-boundary",
1022 ]}
1023 data-hop={pi}
1024 style={`transform: translate(${p.x}px, ${p.y}px)`}
1025 >
1026 <rect
1027 x={-p.w / 2}
1028 y={bar ? -24 : -15}
1029 width={p.w}
1030 height={bar ? 40 : 30}
1031 rx="8"
1032 />
1033 <text
1034 y={bar ? -8 : 4.5}
1035 text-anchor="middle"
1036 >
1037 {p.label}
1038 </text>
1039 {bar && (
1040 <g
1041 class="dg-hop__bar"
1042 transform={`translate(${-p.w / 2 + 10} -2)`}
1043 >
1044 <rect
1045 class="dg-hop__track"
1046 width={
1047 p.w - 20
1048 }
1049 height="4"
1050 rx="2"
1051 />
1052 <rect
1053 class="dg-hop__fill"
1054 width={
1055 p.w - 20
1056 }
1057 height="4"
1058 rx="2"
1059 >
1060 <animateTransform
1061 attributeName="transform"
1062 type="scale"
1063 dur={
1064 g
1065 .motion
1066 .dur
1067 }
1068 repeatCount="indefinite"
1069 calcMode="linear"
1070 values={bar.values
1071 .split(
1072 ";",
1073 )
1074 .map(
1075 (
1076 v,
1077 ) =>
1078 `${v} 1`,
1079 )
1080 .join(
1081 ";",
1082 )}
1083 keyTimes={
1084 bar.keyTimes
1085 }
1086 />
1087 </rect>
1088 </g>
1089 )}
1090 </g>
1091 );
1092 })}
1093 {/* Drawn after the nodes so it passes over them, never behind. */}
1094 <circle
1095 class="dg-trace__dot"
1096 r="4.5"
1097 data-dot
1098 >
1099 <animateMotion
1100 dur={g.motion.dur}
1101 repeatCount="indefinite"
1102 calcMode="linear"
1103 keyPoints={g.motion.keyPoints}
1104 keyTimes={g.motion.keyTimes}
1105 >
1106 <mpath href={`#dg-trace-${ti}`} />
1107 </animateMotion>
1108 </circle>
1109 {t.ours && (
1110 <text
1111 class="dg-trace__done"
1112 data-done
1113 x="652"
1114 y={LANE_Y.m - 26}
1115 text-anchor="end"
1116 >
1117 stays on your machine
1118 </text>
1119 )}
1120 {t.modes && (
1121 <g
1122 class="dg-hint"
1123 data-hint
1124 aria-hidden="true"
1125 >
1126 <defs>
1127 <marker
1128 id="dg-hint-head"
1129 viewBox="0 0 10 10"
1130 refX="6"
1131 refY="5"
1132 markerWidth="9"
1133 markerHeight="9"
1134 orient="auto"
1135 >
1136 <path
1137 class="dg-hint__head"
1138 d="M1 1.5 L7 5 L1.5 8.5"
1139 />
1140 </marker>
1141 </defs>
1142 <path
1143 class="dg-hint__arrow"
1144 d="M 398 131 C 376 124, 344 112, 334 70"
1145 marker-end="url(#dg-hint-head)"
1146 />
1147 <text
1148 x="406"
1149 y="146"
1150 transform="rotate(-3 406 146)"
1151 >
1152 drag me to the cloud!
1153 </text>
1154 {/* A cursor that acts out the drag on Lambda, on a loop,
1155 until the reader moves something. */}
1156 {mode0 && (
1157 <g
1158 style={`transform: translate(${mode0.slots[2]!.x}px, ${mode0.slots[2]!.y}px)`}
1159 >
1160 <g class="dg-hint__demo">
1161 <rect
1162 class="dg-hint__ghost"
1163 x={-mode0.slots[2]!.w / 2}
1164 y="-15"
1165 width={mode0.slots[2]!.w}
1166 height="30"
1167 rx="8"
1168 />
1169 <path
1170 class="dg-hint__cursor"
1171 transform="translate(2 -2)"
1172 d="M0 0 L0 17 L4.6 12.8 L7.6 19.6 L10.4 18.4 L7.4 11.6 L13 11.6 Z"
1173 />
1174 </g>
1175 </g>
1176 )}
1177 </g>
1178 )}
1179 {/* Shown once Lambda has moved: the same cursor on
1180 DynamoDB. The script places it on the box. */}
1181 {t.modes && (
1182 <g
1183 class="dg-hint is-hidden"
1184 data-hint-next
1185 aria-hidden="true"
1186 >
1187 <g data-hint-at>
1188 <text data-hint-text text-anchor="end">
1189 now me!
1190 </text>
1191 <g class="dg-hint__demo">
1192 <rect
1193 class="dg-hint__ghost"
1194 y="-15"
1195 height="30"
1196 rx="8"
1197 />
1198 <path
1199 class="dg-hint__cursor"
1200 transform="translate(2 -2)"
1201 d="M0 0 L0 17 L4.6 12.8 L7.6 19.6 L10.4 18.4 L7.4 11.6 L13 11.6 Z"
1202 />
1203 </g>
1204 </g>
1205 </g>
1206 )}
1207 </svg>
1208 </div>
1209 </figure>
1210 );
1211 })}
1212 </div>
1213 <ul class="dg-legend" aria-label="Legend">
1214 <li><span class="dg-legend__cross" aria-hidden="true"></span>a trip across the network</li>
1215 </ul>
1216 </div>
1217 </section>
1218
1219 <AlchemicalDivider variant="circle" class="cmp-divider" />
1220
1221 <!-- ───────────────── MORE ───────────────── -->
1222 <section class="cmp-section cmp-pat-2" aria-labelledby="more">
1223 <div class="cmp-container">
1224 <h2 class="cmp-h2" id="more" data-copy>
1225 And a few more things
1226 </h2>
1227 <ul class="cmp-cards cmp-cards--3">
1228 <li class="cmp-card">
1229 <h3 data-copy>Providers built from the spec</h3>
1230 <p data-copy>
1231 Cloudflare, AWS, Fly, PlanetScale, Prisma, Axiom, Stripe, GitHub, Docker, and more. We are constantly adding more providers.
1232 </p>
1233 </li>
1234 <li class="cmp-card">
1235 <h3 data-copy>Runs anywhere TypeScript runs</h3>
1236 <p data-copy>
1237 Alchemy is just typescript, it can run on your machine, inside a cloudflare worker, or even in a browser.
1238 </p>
1239 </li>
1240 <li class="cmp-card">
1241 <h3 data-copy>Bring your own provider</h3>
1242 <p data-copy>
1243 A provider is just TypeScript: declare the resource's
1244 props, then write its create, update, and delete as
1245 plain functions. No Go plugin or bridge to build.{" "}
1246 <a href="/infrastructure-as-code/custom-provider">Write one</a>.
1247 </p>
1248 </li>
1249 </ul>
1250
1251 <div class="cmp-cta">
1252 <Button variant="primary" icon="arrow" href="/getting-started">
1253 <span data-copy>Start your project</span>
1254 </Button>
1255 <Button variant="secondary" href="/what-is-alchemy">
1256 <span data-copy>What is Alchemy?</span>
1257 </Button>
1258 </div>
1259 </div>
1260 </section>
1261 </Marketing>
1262
1263 <script>
1264 // SVG (SMIL) animations don't follow CSS, so reduced motion has to stop
1265 // them here: every diagram freezes on its first frame. Also re-applied
1266 // if the setting changes while the page is open.
1267 const motion = matchMedia("(prefers-reduced-motion: reduce)");
1268 const syncSvgMotion = () => {
1269 for (const svg of document.querySelectorAll<SVGSVGElement>("svg")) {
1270 if (!svg.querySelector("animate, animateMotion, animateTransform")) continue;
1271 if (motion.matches) {
1272 svg.pauseAnimations();
1273 svg.setCurrentTime(0);
1274 } else {
1275 svg.unpauseAnimations();
1276 }
1277 }
1278 };
1279 syncSvgMotion();
1280 motion.addEventListener("change", syncSvgMotion);
1281 </script>
1282
1283 <script>
1284 // Alchemy's draggable row in "True emulation". On a switch the
1285 // boxes glide to their new spots and the dotted route bends with them
1286 // (redrawn every frame from the live box positions); boxes a mode doesn't
1287 // use shrink into the line. Then the new route, crossings, and dot land.
1288 type Slot = {
1289 x: number;
1290 y: number;
1291 w: number;
1292 label: string;
1293 shown: boolean;
1294 bar: string | null;
1295 };
1296 type ModeData = {
1297 headline: string;
1298 sub: string;
1299 local: boolean;
1300 lanes: Record<string, "m" | "c" | "b">;
1301 aria: string;
1302 path: string;
1303 segs: number[][];
1304 crossings: { x: number; y: number }[];
1305 motion: { dur: string; keyPoints: string; keyTimes: string };
1306 slots: Slot[];
1307 };
1308 const MOVE_MS = 520;
1309 const ease = (t: number) => 1 - Math.pow(1 - t, 3);
1310 const draw = (segs: number[][]) =>
1311 segs
1312 .map(
1313 ([x0, y0, ax, ay, bx, by, x1, y1]) =>
1314 `M ${x0} ${y0} C ${ax} ${ay}, ${bx} ${by}, ${x1} ${y1}`,
1315 )
1316 .join(" ");
1317
1318 for (const fig of document.querySelectorAll<HTMLElement>(
1319 "figure[data-modes]",
1320 )) {
1321 const modes = JSON.parse(fig.dataset.modes!) as ModeData[];
1322 const svg = fig.querySelector("svg")!;
1323 const path = svg.querySelector<SVGPathElement>(".dg-trace__path")!;
1324 const crosses = svg.querySelector<SVGGElement>("[data-crosses]")!;
1325 const dotAnim = svg.querySelector<SVGAnimationElement>(
1326 "[data-dot] animateMotion",
1327 )!;
1328 const barAnim = svg.querySelector<SVGAnimationElement>("[data-bar]");
1329 const done = svg.querySelector<SVGTextElement>("[data-done]");
1330 const headline = fig.querySelector<HTMLElement>("[data-headline]")!;
1331 const sub = fig.querySelector<HTMLElement>("[data-sub]")!;
1332 const boxes = [...svg.querySelectorAll<SVGGElement>("[data-hop]")];
1333 // Cloned so new crossings keep the page's scoped styles.
1334 const crossTemplate = svg.querySelector<SVGCircleElement>(
1335 "[data-cross-template]",
1336 )!;
1337 const reduced = matchMedia("(prefers-reduced-motion: reduce)").matches;
1338 let current = modes[0]!;
1339 let frame = 0;
1340
1341 const place = (g: SVGGElement, s: Slot, x = s.x, y = s.y) => {
1342 g.style.transform = `translate(${x}px, ${y}px)`;
1343 const rect = g.querySelector("rect")!;
1344 rect.setAttribute("x", String(-s.w / 2));
1345 rect.setAttribute("width", String(s.w));
1346 };
1347
1348 const land = (m: ModeData) => {
1349 path.setAttribute("d", m.path);
1350 crosses.replaceChildren(
1351 ...m.crossings.map((c) => {
1352 const el = crossTemplate.cloneNode() as SVGCircleElement;
1353 el.removeAttribute("data-cross-template");
1354 el.removeAttribute("hidden");
1355 el.setAttribute("cx", String(c.x));
1356 el.setAttribute("cy", String(c.y));
1357 return el;
1358 }),
1359 );
1360 dotAnim.setAttribute("dur", m.motion.dur);
1361 dotAnim.setAttribute("keyPoints", m.motion.keyPoints);
1362 dotAnim.setAttribute("keyTimes", m.motion.keyTimes);
1363 const bar = m.slots.find((s) => s.bar)?.bar;
1364 if (barAnim && bar) {
1365 barAnim.setAttribute("dur", m.motion.dur);
1366 barAnim.setAttribute("keyTimes", bar);
1367 }
1368 dotAnim.beginElement();
1369 barAnim?.beginElement();
1370 fig.classList.remove("is-switching");
1371 };
1372
1373 // The route between the current box positions: one cubic per slot gap,
1374 // split in half across a hidden slot (mirrors the server-side build).
1375 type Cubic = number[];
1376 const cubic = (a: Slot, b: Slot): Cubic => {
1377 const h = (b.x - a.x) / 2;
1378 return [a.x, a.y, a.x + h, a.y, b.x - h, b.y, b.x, b.y];
1379 };
1380 const split = ([x0, y0, ax, ay, bx, by, x1, y1]: Cubic): Cubic[] => {
1381 const mid = (p: number, q: number) => (p + q) / 2;
1382 const [m1x, m1y, m2x, m2y, m3x, m3y] = [
1383 mid(x0!, ax!), mid(y0!, ay!), mid(ax!, bx!),
1384 mid(ay!, by!), mid(bx!, x1!), mid(by!, y1!),
1385 ];
1386 const [n1x, n1y, n2x, n2y] = [
1387 mid(m1x, m2x), mid(m1y, m2y), mid(m2x, m3x), mid(m2y, m3y),
1388 ];
1389 const [px, py] = [mid(n1x, n2x), mid(n1y, n2y)];
1390 return [
1391 [x0!, y0!, m1x, m1y, n1x, n1y, px, py],
1392 [px, py, n2x, n2y, m3x, m3y, x1!, y1!],
1393 ];
1394 };
1395 const segsFor = (slots: Slot[]) => {
1396 const segs: Cubic[] = [];
1397 for (let i = 0; i < slots.length - 1; ) {
1398 if (slots[i + 1]!.shown) {
1399 segs.push(cubic(slots[i]!, slots[i + 1]!));
1400 i += 1;
1401 } else {
1402 segs.push(...split(cubic(slots[i]!, slots[i + 2]!)));
1403 i += 2;
1404 }
1405 }
1406 return segs;
1407 };
1408
1409 const hint = svg.querySelector<SVGGElement>("[data-hint]");
1410 const hintNext = svg.querySelector<SVGGElement>("[data-hint-next]");
1411 const NET_Y = 85;
1412 const NAMES: Record<string, string> = {
1413 fn: "Lambda",
1414 db: "DynamoDB",
1415 };
1416 const laneOf = (key: string, m = current) =>
1417 m.lanes[key] === "c" ? "c" : "m";
1418 const describe = () =>
1419 boxes.forEach((g) => {
1420 const key = g.dataset.drag;
1421 if (!key) return;
1422 const inCloud = laneOf(key) === "c";
1423 g.setAttribute(
1424 "aria-label",
1425 `${NAMES[key]}, ${inCloud ? "in the cloud" : "on your machine"}. Press Enter to move it ${inCloud ? "to your machine" : "to the cloud"}.`,
1426 );
1427 });
1428 const target = (key: string, lane: "m" | "c") => {
1429 const fn = key === "fn" ? lane : laneOf("fn");
1430 const db = key === "db" ? lane : laneOf("db");
1431 return modes.find(
1432 (m) => laneOf("fn", m) === fn && laneOf("db", m) === db,
1433 )!;
1434 };
1435
1436 // Once Lambda has moved, act out the same drag on DynamoDB, up or
1437 // down depending on its lane. Gone for good once DynamoDB moves.
1438 let nextState: "waiting" | "shown" | "done" = "waiting";
1439 let nextTimer = 0;
1440 const placeNext = () => {
1441 if (!hintNext) return;
1442 const i = boxes.findIndex((g) => g.dataset.drag === "db");
1443 const s = current.slots[i]!;
1444 const up = laneOf("db") === "c";
1445 hintNext.querySelector<SVGGElement>("[data-hint-at]")!.style.transform =
1446 `translate(${s.x}px, ${s.y}px)`;
1447 const ghost = hintNext.querySelector("rect")!;
1448 ghost.setAttribute("x", String(-s.w / 2));
1449 ghost.setAttribute("width", String(s.w));
1450 const text = hintNext.querySelector("[data-hint-text]")!;
1451 text.setAttribute("x", String(-s.w / 2 - 14));
1452 text.setAttribute("y", up ? "-66" : "76");
1453 hintNext.classList.toggle("is-up", up);
1454 };
1455 const afterMove = (key: string) => {
1456 if (!hintNext || nextState === "done") return;
1457 clearTimeout(nextTimer);
1458 if (key === "db") {
1459 nextState = "done";
1460 hintNext.classList.add("is-hidden");
1461 return;
1462 }
1463 // Wait for the boxes to land, then show it on DynamoDB's new spot.
1464 hintNext.classList.add("is-hidden");
1465 nextTimer = window.setTimeout(() => {
1466 placeNext();
1467 nextState = "shown";
1468 hintNext.classList.remove("is-hidden");
1469 }, reduced ? 0 : MOVE_MS + 150);
1470 };
1471
1472 const switchTo = (next: ModeData, from: ModeData) => {
1473 cancelAnimationFrame(frame);
1474 if (next !== current) {
1475 hint?.classList.add("is-hidden");
1476 headline.textContent = next.headline;
1477 sub.textContent = next.sub;
1478 done?.classList.toggle("is-hidden", !next.local);
1479 svg.setAttribute("aria-label", next.aria);
1480 }
1481 current = next;
1482 describe();
1483 fig.classList.add("is-switching");
1484 boxes.forEach((g, i) => {
1485 const s = next.slots[i]!;
1486 g.classList.toggle("is-ghost", !s.shown);
1487 if (s.label) g.querySelector("text")!.textContent = s.label;
1488 const rect = g.querySelector("rect")!;
1489 rect.setAttribute("x", String(-s.w / 2));
1490 rect.setAttribute("width", String(s.w));
1491 });
1492 if (reduced) {
1493 boxes.forEach((g, i) => place(g, next.slots[i]!));
1494 land(next);
1495 return;
1496 }
1497 // Glide: interpolate every slot and every route control point, so the
1498 // line bends with the boxes and lands exactly on the new route.
1499 const t0 = performance.now();
1500 const tick = (now: number) => {
1501 const k = ease(Math.min(1, (now - t0) / MOVE_MS));
1502 boxes.forEach((g, i) => {
1503 const f = from.slots[i]!;
1504 const s = next.slots[i]!;
1505 place(g, s, f.x + (s.x - f.x) * k, f.y + (s.y - f.y) * k);
1506 });
1507 path.setAttribute(
1508 "d",
1509 draw(
1510 from.segs.map((seg, si) =>
1511 seg.map(
1512 (n, ni) => n + (next.segs[si]![ni]! - n) * k,
1513 ),
1514 ),
1515 ),
1516 );
1517 if (k < 1) frame = requestAnimationFrame(tick);
1518 else land(next);
1519 };
1520 frame = requestAnimationFrame(tick);
1521 };
1522
1523 // Drag Lambda or DynamoDB across the network line. While dragging, the
1524 // box follows the pointer and the route bends to it; on release the
1525 // row settles into whichever setup the boxes now describe.
1526 const toSvg = (e: PointerEvent) => {
1527 const pt = new DOMPoint(e.clientX, e.clientY).matrixTransform(
1528 svg.getScreenCTM()!.inverse(),
1529 );
1530 return { x: pt.x, y: pt.y };
1531 };
1532 let drag: {
1533 g: SVGGElement;
1534 i: number;
1535 key: string;
1536 dx: number;
1537 dy: number;
1538 slots: Slot[];
1539 } | null = null;
1540 for (const g of boxes) {
1541 const key = g.dataset.drag;
1542 if (!key) continue;
1543 const i = boxes.indexOf(g);
1544 g.addEventListener("pointerdown", (e) => {
1545 if (e.button !== 0) return;
1546 cancelAnimationFrame(frame);
1547 const s = current.slots[i]!;
1548 const p = toSvg(e);
1549 drag = {
1550 g, i, key,
1551 dx: p.x - s.x,
1552 dy: p.y - s.y,
1553 slots: current.slots.map((x) => ({ ...x })),
1554 };
1555 g.setPointerCapture(e.pointerId);
1556 fig.classList.add("is-switching", "is-dragging");
1557 hint?.classList.add("is-hidden");
1558 if (key === "db") hintNext?.classList.add("is-hidden");
1559 e.preventDefault();
1560 });
1561 g.addEventListener("pointermove", (e) => {
1562 if (!drag || drag.g !== g) return;
1563 const p = toSvg(e);
1564 const s = drag.slots[i]!;
1565 const home = current.slots[i]!;
1566 // Free vertically between the lanes, a little give sideways.
1567 s.y = Math.max(40, Math.min(130, p.y - drag.dy));
1568 s.x = home.x + Math.max(-24, Math.min(24, p.x - drag.dx - home.x));
1569 place(g, s);
1570 path.setAttribute("d", draw(segsFor(drag.slots)));
1571 g.classList.toggle("is-over", (s.y > NET_Y) !== (laneOf(key) === "c"));
1572 });
1573 const drop = () => {
1574 if (!drag || drag.g !== g) return;
1575 const s = drag.slots[i]!;
1576 const from = { ...current, slots: drag.slots, segs: segsFor(drag.slots) };
1577 drag = null;
1578 g.classList.remove("is-over");
1579 fig.classList.remove("is-dragging");
1580 const before = current;
1581 switchTo(target(key, s.y > NET_Y ? "c" : "m"), from);
1582 if (current !== before) afterMove(key);
1583 else if (key === "db" && nextState === "shown")
1584 hintNext?.classList.remove("is-hidden");
1585 };
1586 g.addEventListener("pointerup", drop);
1587 g.addEventListener("pointercancel", drop);
1588 g.addEventListener("keydown", (e) => {
1589 if (e.key !== "Enter" && e.key !== " ") return;
1590 e.preventDefault();
1591 switchTo(target(key, laneOf(key) === "c" ? "m" : "c"), current);
1592 afterMove(key);
1593 });
1594 }
1595 describe();
1596 }
1597 </script>
1598
1599 <script>
1600 import { play } from "cuelume";
1601
1602 // Resources you can't move (anything but Alchemy's Lambda and DynamoDB)
1603 // give a little under the pointer, then snap back with a red flash and
1604 // cuelume's error sound. The first node (browser / edit) and deploy steps
1605 // aren't resources, so they're left alone.
1606 const GIVE = 7; // max offset in SVG units
1607 const reduced = matchMedia("(prefers-reduced-motion: reduce)").matches;
1608 for (const svg of document.querySelectorAll<SVGSVGElement>(".dg-trace svg")) {
1609 svg.addEventListener("pointerdown", (e) => {
1610 const g = (e.target as Element).closest<SVGGElement>(
1611 ".dg-hop:not([data-drag]):not(.is-ghost):not(.is-boundary):not([data-hop='0'])",
1612 );
1613 if (!g || e.button !== 0) return;
1614 const toSvg = (ev: PointerEvent) =>
1615 new DOMPoint(ev.clientX, ev.clientY).matrixTransform(
1616 svg.getScreenCTM()!.inverse(),
1617 );
1618 const start = toSvg(e);
1619 const base = g.style.transform;
1620 let moved = false;
1621 g.classList.remove("is-snapping");
1622 g.setPointerCapture(e.pointerId);
1623 // Resists harder the further you pull, never past GIVE.
1624 const give = (d: number) => GIVE * Math.tanh(d / (GIVE * 3));
1625 const move = (ev: PointerEvent) => {
1626 const p = toSvg(ev);
1627 const dx = p.x - start.x;
1628 const dy = p.y - start.y;
1629 if (Math.hypot(dx, dy) > 3) moved = true;
1630 if (!reduced) {
1631 g.style.transform = `${base} translate(${give(dx)}px, ${give(dy)}px)`;
1632 }
1633 };
1634 const end = (ev: PointerEvent) => {
1635 g.removeEventListener("pointermove", move);
1636 g.removeEventListener("pointerup", end);
1637 g.removeEventListener("pointercancel", end);
1638 g.classList.add("is-snapping");
1639 g.style.transform = base;
1640 if (moved && ev.type === "pointerup") {
1641 g.classList.remove("is-refused");
1642 void g.getBoundingClientRect(); // restart the flash
1643 g.classList.add("is-refused");
1644 play("error");
1645 }
1646 };
1647 g.addEventListener("pointermove", move);
1648 g.addEventListener("pointerup", end);
1649 g.addEventListener("pointercancel", end);
1650 e.preventDefault();
1651 });
1652 svg.addEventListener("animationend", (e) => {
1653 (e.target as Element).closest(".dg-hop")?.classList.remove("is-refused");
1654 });
1655 svg.addEventListener("transitionend", (e) => {
1656 if (e.propertyName === "transform") {
1657 (e.target as Element).classList.remove("is-snapping");
1658 }
1659 });
1660 }
1661 </script>
1662
1663 <style>
1664 .cmp-container {
1665 max-width: 1080px;
1666 margin: 0 auto;
1667 }
1668 .cmp-hero,
1669 .cmp-section {
1670 position: relative;
1671 isolation: isolate;
1672 overflow: hidden;
1673 padding: 80px 32px;
1674 }
1675 .cmp-hero {
1676 padding-top: 96px;
1677 padding-bottom: 64px;
1678 }
1679 /* Faint Sri Yantra motifs, as on the landing page. */
1680 .cmp-hero::before,
1681 .cmp-section::before {
1682 content: "";
1683 position: absolute;
1684 top: 50%;
1685 right: -240px;
1686 z-index: -1;
1687 /* Smaller than the landing page's 1000px: these sections are shorter. */
1688 width: 640px;
1689 height: 640px;
1690 translate: 0 -50%;
1691 pointer-events: none;
1692 background: var(--alc-fg-1);
1693 opacity: 0.045;
1694 mask: var(--pattern) center / contain no-repeat;
1695 -webkit-mask: var(--pattern) center / contain no-repeat;
1696 }
1697 .cmp-hero::before {
1698 opacity: 0.07;
1699 }
1700 .cmp-pat-1 {
1701 --pattern: url("/patterns/yantra-1.svg");
1702 }
1703 .cmp-pat-2 {
1704 --pattern: url("/patterns/yantra-2.svg");
1705 }
1706 .cmp-pat-3 {
1707 --pattern: url("/patterns/yantra-3.svg");
1708 }
1709 .cmp-pat-4 {
1710 --pattern: url("/patterns/yantra-4.svg");
1711 }
1712 .cmp-pat-5 {
1713 --pattern: url("/patterns/yantra-5.svg");
1714 }
1715 .cmp-pat-6 {
1716 --pattern: url("/patterns/yantra-6.svg");
1717 }
1718 .cmp-pat-2::before,
1719 .cmp-pat-4::before,
1720 .cmp-pat-6::before {
1721 right: auto;
1722 left: -240px;
1723 }
1724 :global(.cmp-divider) {
1725 margin: 0 auto;
1726 }
1727
1728 /* ---------- hero ---------- */
1729 :global(.cmp-hero__mark) {
1730 display: block;
1731 margin-bottom: 20px;
1732 }
1733 .cmp-eyebrow {
1734 margin: 0 0 12px;
1735 font-family: var(--alc-font-mono);
1736 font-size: 12px;
1737 letter-spacing: 0.16em;
1738 text-transform: uppercase;
1739 color: var(--alc-accent-deep);
1740 }
1741 .cmp-hero__title {
1742 margin: 0 0 18px;
1743 max-width: 820px;
1744 font-family: var(--alc-font-serif);
1745 font-weight: 500;
1746 font-size: clamp(38px, 6vw, 60px);
1747 line-height: 1.05;
1748 letter-spacing: -0.015em;
1749 color: var(--alc-fg-1);
1750 }
1751 .cmp-hero__lede {
1752 margin: 0;
1753 max-width: 640px;
1754 font-family: var(--alc-font-serif);
1755 font-size: clamp(18px, 2.2vw, 22px);
1756 line-height: 1.4;
1757 color: var(--alc-fg-2);
1758 }
1759
1760 /* ---------- type ---------- */
1761 .cmp-h2 {
1762 margin: 0 0 14px;
1763 font-family: var(--alc-font-serif);
1764 font-weight: 500;
1765 font-size: clamp(30px, 4.5vw, 40px);
1766 line-height: 1.1;
1767 letter-spacing: -0.01em;
1768 color: var(--alc-fg-1);
1769 }
1770 .cmp-lede {
1771 margin: 0 0 28px;
1772 max-width: 680px;
1773 font-size: 16px;
1774 line-height: 1.65;
1775 color: var(--alc-fg-2);
1776 }
1777 .cmp-hero__lede a,
1778 .cmp-lede a,
1779 .cmp-card a {
1780 color: var(--alc-accent-deep);
1781 text-decoration: underline;
1782 text-underline-offset: 3px;
1783 }
1784
1785 /* ---------- comparison table ---------- */
1786 .cmp-table-wrap {
1787 overflow-x: auto;
1788 border: 1px solid var(--alc-hairline-2);
1789 border-radius: 14px;
1790 background: color-mix(in srgb, var(--alc-bg-elev-1) 70%, transparent);
1791 }
1792 .cmp-table-wrap:focus-visible {
1793 outline: 2px solid var(--alc-accent);
1794 outline-offset: 2px;
1795 }
1796 .cmp-table {
1797 width: 100%;
1798 table-layout: fixed;
1799 min-width: 960px;
1800 border-collapse: collapse;
1801 font-size: 16px;
1802 line-height: 1.5;
1803 }
1804 .cmp-table th,
1805 .cmp-table td {
1806 padding: 16px 18px;
1807 text-align: left;
1808 vertical-align: top;
1809 border-bottom: 1px solid var(--alc-hairline);
1810 color: var(--alc-fg-2);
1811 }
1812 .cmp-table tbody tr:last-child > * {
1813 border-bottom: 0;
1814 }
1815 .cmp-table thead th {
1816 font-family: var(--alc-font-serif);
1817 font-size: 21px;
1818 font-weight: 500;
1819 color: var(--alc-fg-1);
1820 vertical-align: bottom;
1821 }
1822 .cmp-table thead th :global(svg) {
1823 vertical-align: -3px;
1824 margin-right: 6px;
1825 }
1826 .cmp-table thead td,
1827 .cmp-table tbody th {
1828 width: 150px;
1829 font-weight: 600;
1830 color: var(--alc-fg-1);
1831 }
1832 /* Row labels stay in view while the table scrolls sideways. */
1833 .cmp-table tbody th,
1834 .cmp-table thead td {
1835 position: sticky;
1836 left: 0;
1837 z-index: 1;
1838 background: var(--alc-bg-elev-1);
1839 }
1840 .cmp-table .is-no {
1841 color: var(--alc-fg-3);
1842 }
1843 /* Alchemy's column is highlighted. */
1844 .cmp-table .is-ours {
1845 background: color-mix(in srgb, var(--alc-accent) 11%, transparent);
1846 color: var(--alc-fg-1);
1847 }
1848 .cmp-table thead .is-ours {
1849 border-top-left-radius: 0;
1850 }
1851
1852 /* ---------- split + cards ---------- */
1853 .cmp-split {
1854 display: grid;
1855 grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
1856 gap: 24px;
1857 align-items: start;
1858 }
1859 .cmp-vs {
1860 display: grid;
1861 grid-template-columns: repeat(2, minmax(0, 1fr));
1862 gap: 24px;
1863 align-items: start;
1864 }
1865 .cmp-vs__side {
1866 display: grid;
1867 gap: 12px;
1868 min-width: 0;
1869 }
1870 .cmp-vs__label {
1871 margin: 0;
1872 font-family: var(--alc-font-serif);
1873 font-weight: 500;
1874 font-size: 20px;
1875 line-height: 1.25;
1876 color: var(--alc-fg-2);
1877 }
1878 .cmp-vs__side.is-ours .cmp-vs__label {
1879 color: var(--alc-fg-1);
1880 }
1881 .cmp-cards {
1882 list-style: none;
1883 margin: 0;
1884 padding: 0;
1885 display: grid;
1886 gap: 16px;
1887 }
1888 .cmp-cards--2 {
1889 grid-template-columns: repeat(2, minmax(0, 1fr));
1890 }
1891 .cmp-cards--3 {
1892 grid-template-columns: repeat(3, minmax(0, 1fr));
1893 }
1894 .cmp-card {
1895 padding: 20px 22px;
1896 border: 1px solid var(--alc-hairline-2);
1897 border-radius: 14px;
1898 background: color-mix(in srgb, var(--alc-bg-elev-1) 70%, transparent);
1899 }
1900 .cmp-card h3 {
1901 margin: 0 0 8px;
1902 font-family: var(--alc-font-serif);
1903 font-weight: 500;
1904 font-size: 20px;
1905 line-height: 1.25;
1906 color: var(--alc-fg-1);
1907 }
1908 .cmp-card p {
1909 margin: 0;
1910 font-size: 14.5px;
1911 line-height: 1.6;
1912 color: var(--alc-fg-2);
1913 }
1914 .cmp-cards--stack .cmp-card {
1915 border-left: 3px solid var(--alc-accent);
1916 }
1917
1918 /* ---------- diagrams: shared ---------- */
1919 figure {
1920 margin: 0;
1921 }
1922 figcaption {
1923 font-family: var(--alc-font-serif);
1924 font-size: 20px;
1925 font-weight: 500;
1926 color: var(--alc-fg-1);
1927 }
1928 .dg-pill {
1929 display: inline-block;
1930 padding: 5px 10px;
1931 border: 1px dashed var(--alc-hairline-3);
1932 border-radius: 999px;
1933 font-family: var(--alc-font-mono);
1934 font-size: 12px;
1935 color: var(--alc-fg-2);
1936 background: var(--alc-bg);
1937 white-space: nowrap;
1938 }
1939 .dg-pill--cloud {
1940 border-style: dashed;
1941 color: var(--alc-fg-3);
1942 }
1943 .dg-note,
1944 .dg-verdict {
1945 margin: 12px 0 0;
1946 font-size: 13px;
1947 color: var(--alc-fg-3);
1948 }
1949 .dg-verdict {
1950 font-weight: 600;
1951 color: var(--alc-fg-2);
1952 }
1953 .dg-verdict--yes {
1954 color: var(--alc-accent-deep);
1955 }
1956 .dg-perm code,
1957 .cmp-lede code {
1958 font-family: var(--alc-font-mono);
1959 font-size: 0.92em;
1960 color: var(--alc-fg-1);
1961 }
1962
1963 /* ---------- engine: nested wrappers ---------- */
1964 .dg-engine {
1965 display: grid;
1966 grid-template-columns: repeat(4, minmax(0, 1fr));
1967 gap: 20px;
1968 align-items: start;
1969 }
1970 .dg-engine__tool {
1971 display: flex;
1972 flex-direction: column;
1973 align-items: center;
1974 text-align: center;
1975 }
1976 .dg-engine__tool figcaption {
1977 margin-bottom: 12px;
1978 }
1979 .dg-down {
1980 width: 0;
1981 height: 22px;
1982 border-left: 1.5px dashed var(--alc-hairline-3);
1983 }
1984 .is-ours .dg-down {
1985 border-left-color: var(--alc-accent);
1986 }
1987 .dg-nest {
1988 align-self: stretch;
1989 }
1990 .dg-nest :global(.dg-layer) {
1991 padding: 10px 10px 12px;
1992 border: 1.5px dashed var(--alc-hairline-3);
1993 border-radius: 14px;
1994 background: color-mix(
1995 in srgb,
1996 var(--alc-fg-1) calc(var(--depth) * 2%),
1997 transparent
1998 );
1999 }
2000 .dg-nest :global(.dg-layer .dg-layer) {
2001 margin-top: 10px;
2002 }
2003 .dg-nest :global(.dg-layer__name) {
2004 display: block;
2005 font-size: 13px;
2006 font-weight: 600;
2007 color: var(--alc-fg-1);
2008 }
2009 .dg-nest :global(.dg-layer__name small) {
2010 display: block;
2011 font-weight: 400;
2012 font-size: 11.5px;
2013 color: var(--alc-fg-3);
2014 }
2015 .is-ours .dg-nest :global(.dg-layer) {
2016 padding: 22px 10px;
2017 border-style: solid;
2018 border-color: var(--alc-accent);
2019 background: color-mix(in srgb, var(--alc-accent) 8%, transparent);
2020 }
2021
2022 /* ---------- permissions: needed vs granted ---------- */
2023 .dg-perm {
2024 display: grid;
2025 grid-template-columns: repeat(3, minmax(0, 1fr));
2026 gap: 20px;
2027 }
2028 .dg-perm__tool {
2029 display: flex;
2030 flex-direction: column;
2031 align-items: center;
2032 text-align: center;
2033 padding: 4px 0;
2034 }
2035 .dg-perm__rings {
2036 width: 180px;
2037 max-width: 100%;
2038 margin: 8px 0 10px;
2039 }
2040 .dg-perm__granted {
2041 fill: color-mix(in srgb, var(--alc-warn) 6%, transparent);
2042 stroke: var(--alc-warn);
2043 stroke-width: 1.5;
2044 }
2045 .dg-perm__granted.is-dashed {
2046 fill: color-mix(in srgb, var(--alc-danger) 10%, transparent);
2047 stroke: var(--alc-danger);
2048 stroke-dasharray: 5 5;
2049 }
2050 .dg-perm__needed {
2051 fill: color-mix(in srgb, var(--alc-accent) 14%, transparent);
2052 stroke: var(--alc-accent);
2053 stroke-width: 2;
2054 }
2055 .dg-perm__label {
2056 font: 600 12px var(--alc-font-sans);
2057 fill: var(--alc-fg-1);
2058 }
2059 .dg-perm__code {
2060 font-size: 12.5px;
2061 }
2062 .dg-perm__grant {
2063 margin: 6px 0 0;
2064 font-size: 13px;
2065 color: var(--alc-fg-3);
2066 }
2067 .dg-legend {
2068 display: flex;
2069 flex-wrap: wrap;
2070 align-items: center;
2071 gap: 8px 18px;
2072 margin: 16px 0 0;
2073 padding: 0;
2074 list-style: none;
2075 font-size: 13px;
2076 color: var(--alc-fg-3);
2077 }
2078 /* Each swatch stays on the same line as its label. */
2079 .dg-legend li {
2080 display: inline-flex;
2081 align-items: center;
2082 gap: 8px;
2083 }
2084 .dg-legend span {
2085 flex: none;
2086 display: inline-block;
2087 width: 12px;
2088 height: 12px;
2089 border-radius: 50%;
2090 }
2091 .dg-legend__needed {
2092 background: color-mix(in srgb, var(--alc-accent) 45%, transparent);
2093 border: 1.5px solid var(--alc-accent);
2094 }
2095 .dg-legend__granted {
2096 border: 1.5px solid var(--alc-warn);
2097 }
2098 #permissions .dg-legend__manual {
2099 border: 1.5px dashed var(--alc-danger);
2100 }
2101
2102 /* ---------- local dev: request traces ---------- */
2103 .dg-kicker {
2104 margin: 0 0 12px;
2105 font-family: var(--alc-font-mono);
2106 font-size: 11px;
2107 letter-spacing: 0.14em;
2108 text-transform: uppercase;
2109 color: var(--alc-fg-3);
2110 }
2111 .dg-traces {
2112 display: grid;
2113 gap: 14px;
2114 }
2115 .dg-trace {
2116 display: grid;
2117 grid-template-columns: 220px minmax(0, 1fr);
2118 align-items: center;
2119 gap: 20px;
2120 padding: 6px 0;
2121 }
2122 .dg-trace__meta {
2123 display: grid;
2124 gap: 4px;
2125 font: inherit;
2126 }
2127 .dg-trace__tool {
2128 font-family: var(--alc-font-serif);
2129 font-size: 17px;
2130 color: var(--alc-fg-2);
2131 }
2132 .dg-trace__headline {
2133 font-family: var(--alc-font-serif);
2134 font-size: 28px;
2135 line-height: 1.1;
2136 color: var(--alc-fg-1);
2137 }
2138 .is-ours .dg-trace__headline {
2139 color: var(--alc-accent-deep);
2140 }
2141 .dg-trace__sub {
2142 font-size: 13px;
2143 line-height: 1.45;
2144 color: var(--alc-fg-3);
2145 }
2146 .dg-stack {
2147 display: grid;
2148 }
2149 .dg-stack > * {
2150 grid-area: 1 / 1;
2151 }
2152 .dg-sizer {
2153 visibility: hidden;
2154 }
2155 .dg-sr {
2156 position: absolute;
2157 width: 1px;
2158 height: 1px;
2159 overflow: hidden;
2160 clip-path: inset(50%);
2161 white-space: nowrap;
2162 }
2163 /* Other resources can be grabbed, but refuse to move. The first node
2164 and deploy steps can't be grabbed at all. */
2165 .dg-hop:not(.is-ghost):not(.is-boundary):not([data-hop="0"]) {
2166 cursor: grab;
2167 }
2168 .dg-hop.is-snapping {
2169 transition: transform 260ms cubic-bezier(0.3, 1.6, 0.5, 1);
2170 }
2171 .dg-hop.is-refused > rect {
2172 animation: dg-refuse 650ms ease-out;
2173 }
2174 @keyframes dg-refuse {
2175 0%,
2176 45% {
2177 stroke: var(--alc-danger);
2178 stroke-width: 2.5;
2179 fill: color-mix(in srgb, var(--alc-danger) 14%, var(--alc-bg));
2180 }
2181 }
2182 /* Alchemy's Lambda and DynamoDB can be dragged across the network. */
2183 .dg-hop[data-drag] {
2184 cursor: grab;
2185 touch-action: none;
2186 outline: none;
2187 }
2188 .is-dragging,
2189 .is-dragging .dg-hop[data-drag] {
2190 cursor: grabbing;
2191 }
2192 .dg-hop[data-drag] > rect {
2193 transition:
2194 opacity 300ms ease,
2195 width 300ms ease,
2196 stroke 200ms ease,
2197 stroke-width 200ms ease;
2198 }
2199 .dg-hop[data-drag]:hover > rect,
2200 .dg-hop[data-drag]:focus-visible > rect {
2201 stroke: var(--alc-accent);
2202 stroke-width: 2;
2203 }
2204 .dg-hop[data-drag]:focus-visible > rect {
2205 stroke-dasharray: 3 3;
2206 }
2207 /* Past the line: the drop will move it. */
2208 .dg-hop.is-over > rect {
2209 stroke: var(--alc-accent);
2210 stroke-width: 2;
2211 fill: color-mix(in srgb, var(--alc-accent) 14%, var(--alc-bg));
2212 }
2213 .dg-hint {
2214 transition: opacity 300ms ease;
2215 pointer-events: none;
2216 }
2217 .dg-hint.is-hidden {
2218 opacity: 0;
2219 }
2220 .dg-hint text {
2221 font: 600 19px var(--alc-font-hand);
2222 fill: var(--alc-accent-deep);
2223 }
2224 /* The cursor presses on Lambda, pulls a ghost of it down into the
2225 cloud lane, lets go, and repeats. */
2226 .dg-hint__demo {
2227 animation: dg-hint-drag 3.2s ease-in-out 1s infinite both;
2228 }
2229 .dg-hint__ghost {
2230 fill: color-mix(in srgb, var(--alc-accent) 14%, transparent);
2231 stroke: var(--alc-accent);
2232 stroke-width: 1.5;
2233 stroke-dasharray: 4 3;
2234 animation: dg-hint-ghost 3.2s ease-in-out 1s infinite both;
2235 }
2236 .dg-hint__cursor {
2237 fill: var(--alc-fg-1);
2238 stroke: var(--alc-bg);
2239 stroke-width: 1.4;
2240 stroke-linejoin: round;
2241 }
2242 .dg-hint.is-up .dg-hint__demo {
2243 animation-name: dg-hint-drag-up;
2244 }
2245 .dg-hint.is-hidden .dg-hint__demo,
2246 .dg-hint.is-hidden .dg-hint__ghost {
2247 animation: none;
2248 }
2249 @keyframes dg-hint-drag {
2250 0% {
2251 opacity: 0;
2252 transform: translate(14px, 10px);
2253 }
2254 12% {
2255 opacity: 1;
2256 transform: translate(0, 0) scale(1);
2257 }
2258 20% {
2259 transform: translate(0, 0) scale(0.88);
2260 }
2261 58% {
2262 opacity: 1;
2263 transform: translate(0, 70px) scale(0.88);
2264 }
2265 66% {
2266 opacity: 1;
2267 transform: translate(0, 70px) scale(1);
2268 }
2269 80%,
2270 100% {
2271 opacity: 0;
2272 transform: translate(0, 70px) scale(1);
2273 }
2274 }
2275 @keyframes dg-hint-drag-up {
2276 0% {
2277 opacity: 0;
2278 transform: translate(14px, 10px);
2279 }
2280 12% {
2281 opacity: 1;
2282 transform: translate(0, 0) scale(1);
2283 }
2284 20% {
2285 transform: translate(0, 0) scale(0.88);
2286 }
2287 58% {
2288 opacity: 1;
2289 transform: translate(0, -70px) scale(0.88);
2290 }
2291 66% {
2292 opacity: 1;
2293 transform: translate(0, -70px) scale(1);
2294 }
2295 80%,
2296 100% {
2297 opacity: 0;
2298 transform: translate(0, -70px) scale(1);
2299 }
2300 }
2301 @keyframes dg-hint-ghost {
2302 0%,
2303 18% {
2304 opacity: 0;
2305 }
2306 24%,
2307 62% {
2308 opacity: 1;
2309 }
2310 72%,
2311 100% {
2312 opacity: 0;
2313 }
2314 }
2315 @media (prefers-reduced-motion: reduce) {
2316 .dg-hint__demo,
2317 .dg-hint__ghost {
2318 animation: none;
2319 }
2320 .dg-hint__ghost {
2321 opacity: 0;
2322 }
2323 }
2324 .dg-hint__arrow,
2325 .dg-hint__head {
2326 fill: none;
2327 stroke: var(--alc-accent-deep);
2328 stroke-width: 1.6;
2329 stroke-linecap: round;
2330 stroke-linejoin: round;
2331 }
2332 /* Mode switch: nodes glide between lanes; path, crossings, and dot fade
2333 out while the new route is drawn. */
2334 .dg-hop.is-slot > rect,
2335 .dg-hop.is-slot > text,
2336 .dg-hop.is-slot > .dg-hop__bar {
2337 transition:
2338 opacity 300ms ease,
2339 width 300ms ease;
2340 }
2341 .dg-hop.is-ghost > rect,
2342 .dg-hop.is-ghost > text,
2343 .dg-hop.is-ghost > .dg-hop__bar {
2344 opacity: 0;
2345 }
2346 .dg-trace__path,
2347 [data-crosses],
2348 .dg-trace__dot,
2349 .dg-trace__done,
2350 .dg-trace__headline,
2351 .dg-trace__sub {
2352 transition: opacity 220ms ease;
2353 }
2354 .is-switching [data-crosses],
2355 .is-switching .dg-trace__dot,
2356 .dg-trace__done.is-hidden {
2357 opacity: 0;
2358 }
2359 .dg-trace__scroll {
2360 overflow-x: auto;
2361 border-radius: 10px;
2362 }
2363 .dg-trace__scroll:focus-visible {
2364 outline: 2px solid var(--alc-accent);
2365 outline-offset: 2px;
2366 }
2367 .dg-trace svg {
2368 display: block;
2369 width: 100%;
2370 min-width: 520px;
2371 border-radius: 10px;
2372 }
2373 .dg-lane {
2374 fill: none;
2375 }
2376 .dg-lane__label,
2377 .dg-net__label {
2378 font: 600 9.5px var(--alc-font-mono);
2379 letter-spacing: 0.12em;
2380 fill: var(--alc-fg-3);
2381 }
2382 .dg-net__label {
2383 font-weight: 400;
2384 letter-spacing: 0.04em;
2385 }
2386 .dg-net {
2387 stroke: var(--alc-hairline-3);
2388 stroke-width: 1;
2389 stroke-dasharray: 4 4;
2390 }
2391 .dg-trace__path {
2392 fill: none;
2393 stroke: var(--alc-fg-3);
2394 stroke-width: 1.75;
2395 stroke-dasharray: 5 6;
2396 }
2397 .is-ours .dg-trace__path {
2398 stroke: var(--alc-accent);
2399 }
2400 .dg-trace__cross {
2401 fill: var(--alc-danger);
2402 stroke: var(--alc-bg);
2403 stroke-width: 2;
2404 }
2405 .dg-hop > rect {
2406 fill: var(--alc-bg);
2407 stroke: var(--alc-hairline-3);
2408 }
2409 .is-ours .dg-hop > rect {
2410 stroke: color-mix(in srgb, var(--alc-accent) 70%, transparent);
2411 }
2412 .dg-hop text {
2413 font: 11.5px var(--alc-font-mono);
2414 fill: var(--alc-fg-1);
2415 }
2416 /* Straddles the network line: runs on your machine, lands in the cloud. */
2417 .dg-hop.is-boundary > rect {
2418 stroke: var(--alc-danger);
2419 stroke-dasharray: 4 3;
2420 }
2421 .dg-hop__track {
2422 fill: var(--alc-hairline-3);
2423 }
2424 .dg-hop__fill {
2425 fill: var(--alc-warn);
2426 }
2427 @media (prefers-reduced-motion: reduce) {
2428 .dg-hop__bar {
2429 display: none;
2430 }
2431 }
2432 .dg-trace__dot {
2433 fill: var(--alc-fg-1);
2434 /* A ring in the page color keeps it readable over node borders. */
2435 stroke: var(--alc-bg);
2436 stroke-width: 2;
2437 paint-order: stroke;
2438 }
2439 .is-ours .dg-trace__dot {
2440 fill: var(--alc-accent-deep);
2441 }
2442 .dg-trace__done {
2443 font: italic 12px var(--alc-font-sans);
2444 fill: var(--alc-accent-deep);
2445 }
2446 .dg-legend__cross {
2447 background: var(--alc-danger);
2448 }
2449 @media (prefers-reduced-motion: reduce) {
2450 .dg-trace__dot {
2451 display: none;
2452 }
2453 }
2454
2455 /* ---------- fit + cta ---------- */
2456 .cmp-cta {
2457 margin-top: 40px;
2458 display: flex;
2459 flex-wrap: wrap;
2460 gap: 12px;
2461 }
2462
2463 /* ---------- responsive ---------- */
2464 @media (max-width: 900px) {
2465 .cmp-split,
2466 .cmp-vs,
2467 .cmp-cards--2,
2468 .cmp-cards--3,
2469 .dg-trace {
2470 grid-template-columns: minmax(0, 1fr);
2471 }
2472 }
2473 @media (max-width: 640px) {
2474 .cmp-hero,
2475 .cmp-section {
2476 padding: 56px 20px;
2477 }
2478 /* Keep the comparisons side by side on phones, just smaller:
2479 seeing them together is the point. */
2480 .dg-engine {
2481 grid-template-columns: repeat(2, minmax(0, 1fr));
2482 gap: 24px 12px;
2483 }
2484 .dg-engine__tool figcaption {
2485 font-size: 16px;
2486 margin-bottom: 8px;
2487 }
2488 .dg-engine .dg-pill {
2489 padding: 3px 7px;
2490 font-size: 10px;
2491 }
2492 .dg-engine .dg-down {
2493 height: 14px;
2494 }
2495 .dg-nest :global(.dg-layer) {
2496 padding: 7px 5px 8px;
2497 border-radius: 10px;
2498 }
2499 .dg-nest :global(.dg-layer .dg-layer) {
2500 margin-top: 7px;
2501 }
2502 .dg-nest :global(.dg-layer__name) {
2503 font-size: 11px;
2504 }
2505 .dg-nest :global(.dg-layer__name small) {
2506 font-size: 9.5px;
2507 }
2508 .is-ours .dg-nest :global(.dg-layer) {
2509 padding: 14px 5px;
2510 }
2511 .dg-engine .dg-note {
2512 font-size: 11px;
2513 }
2514 .dg-perm {
2515 gap: 8px;
2516 }
2517 /* Two-line headers so all three rings line up. */
2518 .dg-perm__tool figcaption {
2519 display: flex;
2520 align-items: flex-end;
2521 justify-content: center;
2522 min-height: 2.6em;
2523 font-size: 14px;
2524 line-height: 1.3;
2525 }
2526 .dg-perm__rings {
2527 margin: 4px 0 6px;
2528 }
2529 .dg-perm .dg-perm__code {
2530 font-size: 10.5px;
2531 overflow-wrap: anywhere;
2532 }
2533 .dg-perm .dg-perm__grant {
2534 font-size: 10px;
2535 overflow-wrap: anywhere;
2536 }
2537 .dg-perm .dg-verdict {
2538 font-size: 12px;
2539 }
2540 .cmp-table {
2541 min-width: 820px;
2542 font-size: 14.5px;
2543 }
2544 .cmp-table th,
2545 .cmp-table td {
2546 padding: 12px;
2547 }
2548 .cmp-table thead td,
2549 .cmp-table tbody th {
2550 width: 104px;
2551 }
2552 }
2553 </style>