alchemy 0.74.2 → 0.75.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/README.md +1 -1
  2. package/bin/alchemy.js +1760 -1725
  3. package/bin/alchemy.ts +1 -1
  4. package/bin/commands/create.ts +5 -4
  5. package/bin/commands/init.ts +109 -65
  6. package/bin/constants.ts +2 -2
  7. package/bin/services/dependencies.ts +4 -4
  8. package/bin/services/execute-alchemy.ts +1 -1
  9. package/bin/services/find-workspace-root.ts +1 -1
  10. package/bin/services/get-package-version.ts +4 -4
  11. package/bin/services/github-workflow.ts +7 -7
  12. package/bin/services/template-manager.ts +20 -13
  13. package/bin/services/vibe-rules.ts +6 -5
  14. package/bin/trpc.ts +7 -0
  15. package/bin/types.ts +1 -0
  16. package/lib/alchemy.d.ts.map +1 -1
  17. package/lib/alchemy.js +29 -1
  18. package/lib/alchemy.js.map +1 -1
  19. package/lib/auth.js +1 -1
  20. package/lib/auth.js.map +1 -1
  21. package/lib/cloudflare/astro/astro.js +1 -1
  22. package/lib/cloudflare/astro/astro.js.map +1 -1
  23. package/lib/cloudflare/bun-spa/bun-spa.d.ts +1 -1
  24. package/lib/cloudflare/bun-spa/bun-spa.d.ts.map +1 -1
  25. package/lib/cloudflare/bun-spa/bun-spa.js +10 -11
  26. package/lib/cloudflare/bun-spa/bun-spa.js.map +1 -1
  27. package/lib/cloudflare/bun-spa/get-bun-spa-backend.d.ts +11 -0
  28. package/lib/cloudflare/bun-spa/get-bun-spa-backend.d.ts.map +1 -0
  29. package/lib/cloudflare/bun-spa/get-bun-spa-backend.js +26 -0
  30. package/lib/cloudflare/bun-spa/get-bun-spa-backend.js.map +1 -0
  31. package/lib/cloudflare/bun-spa/index.d.ts +2 -0
  32. package/lib/cloudflare/bun-spa/index.d.ts.map +1 -0
  33. package/lib/cloudflare/bun-spa/index.js +2 -0
  34. package/lib/cloudflare/bun-spa/index.js.map +1 -0
  35. package/lib/cloudflare/bundle/internal-worker-bundle.js +1 -1
  36. package/lib/cloudflare/bundle/internal-worker-bundle.js.map +1 -1
  37. package/lib/cloudflare/bundle/plugin-hybrid-node-compat.js +1 -1
  38. package/lib/cloudflare/bundle/plugin-hybrid-node-compat.js.map +1 -1
  39. package/lib/cloudflare/bundle/plugin-node-compat.js +1 -1
  40. package/lib/cloudflare/bundle/plugin-node-compat.js.map +1 -1
  41. package/lib/cloudflare/bundle/plugin-wasm.js +1 -1
  42. package/lib/cloudflare/bundle/plugin-wasm.js.map +1 -1
  43. package/lib/cloudflare/d1-migrations.js +1 -1
  44. package/lib/cloudflare/d1-migrations.js.map +1 -1
  45. package/lib/cloudflare/kv-namespace.d.ts +5 -0
  46. package/lib/cloudflare/kv-namespace.d.ts.map +1 -1
  47. package/lib/cloudflare/kv-namespace.js +44 -19
  48. package/lib/cloudflare/kv-namespace.js.map +1 -1
  49. package/lib/cloudflare/miniflare/miniflare-controller.js +1 -1
  50. package/lib/cloudflare/miniflare/miniflare-controller.js.map +1 -1
  51. package/lib/cloudflare/miniflare/miniflare-worker-proxy.d.ts.map +1 -1
  52. package/lib/cloudflare/miniflare/miniflare-worker-proxy.js +34 -4
  53. package/lib/cloudflare/miniflare/miniflare-worker-proxy.js.map +1 -1
  54. package/lib/cloudflare/miniflare/paths.d.ts.map +1 -1
  55. package/lib/cloudflare/miniflare/paths.js +2 -1
  56. package/lib/cloudflare/miniflare/paths.js.map +1 -1
  57. package/lib/cloudflare/miniflare/symlink-miniflare-state.js +1 -1
  58. package/lib/cloudflare/miniflare/symlink-miniflare-state.js.map +1 -1
  59. package/lib/cloudflare/next.js +1 -1
  60. package/lib/cloudflare/next.js.map +1 -1
  61. package/lib/cloudflare/nuxt/nuxt.js +1 -1
  62. package/lib/cloudflare/nuxt/nuxt.js.map +1 -1
  63. package/lib/cloudflare/react-router/plugin.d.ts.map +1 -1
  64. package/lib/cloudflare/react-router/plugin.js +2 -1
  65. package/lib/cloudflare/react-router/plugin.js.map +1 -1
  66. package/lib/cloudflare/react-router/react-router.js +1 -1
  67. package/lib/cloudflare/react-router/react-router.js.map +1 -1
  68. package/lib/cloudflare/redwood/redwood.js +1 -1
  69. package/lib/cloudflare/redwood/redwood.js.map +1 -1
  70. package/lib/cloudflare/sveltekit/sveltekit.js +1 -1
  71. package/lib/cloudflare/sveltekit/sveltekit.js.map +1 -1
  72. package/lib/cloudflare/tanstack-start/tanstack-start.js +1 -1
  73. package/lib/cloudflare/tanstack-start/tanstack-start.js.map +1 -1
  74. package/lib/cloudflare/tunnel.d.ts.map +1 -1
  75. package/lib/cloudflare/tunnel.js +25 -1
  76. package/lib/cloudflare/tunnel.js.map +1 -1
  77. package/lib/cloudflare/vite/plugin.js +1 -1
  78. package/lib/cloudflare/vite/plugin.js.map +1 -1
  79. package/lib/cloudflare/website.js +1 -1
  80. package/lib/cloudflare/website.js.map +1 -1
  81. package/lib/cloudflare/worker.d.ts.map +1 -1
  82. package/lib/cloudflare/worker.js +1 -1
  83. package/lib/cloudflare/worker.js.map +1 -1
  84. package/lib/cloudflare/wrangler.json.js +1 -1
  85. package/lib/cloudflare/wrangler.json.js.map +1 -1
  86. package/lib/coinbase/faucet.js +2 -2
  87. package/lib/coinbase/faucet.js.map +1 -1
  88. package/lib/docker/api.js +1 -1
  89. package/lib/docker/api.js.map +1 -1
  90. package/lib/docker/image.js +1 -1
  91. package/lib/docker/image.js.map +1 -1
  92. package/lib/esbuild/bundle.js +1 -1
  93. package/lib/esbuild/bundle.js.map +1 -1
  94. package/lib/fs/file.js +1 -1
  95. package/lib/fs/file.js.map +1 -1
  96. package/lib/llms.js +1 -1
  97. package/lib/llms.js.map +1 -1
  98. package/lib/os/exec.js +1 -1
  99. package/lib/os/exec.js.map +1 -1
  100. package/lib/scope.d.ts.map +1 -1
  101. package/lib/scope.js +1 -1
  102. package/lib/scope.js.map +1 -1
  103. package/lib/state/file-system-state-store.js +1 -1
  104. package/lib/state/file-system-state-store.js.map +1 -1
  105. package/lib/state/migrations.js +1 -1
  106. package/lib/state/migrations.js.map +1 -1
  107. package/lib/state/sqlite-state-store.js +1 -1
  108. package/lib/state/sqlite-state-store.js.map +1 -1
  109. package/lib/stripe/file.d.ts +3 -3
  110. package/lib/stripe/file.js +3 -3
  111. package/lib/test/bun.js +1 -1
  112. package/lib/test/bun.js.map +1 -1
  113. package/lib/test/prune.js +1 -1
  114. package/lib/test/prune.js.map +1 -1
  115. package/lib/test/vitest.js +1 -1
  116. package/lib/test/vitest.js.map +1 -1
  117. package/lib/util/content-type.js +1 -1
  118. package/lib/util/content-type.js.map +1 -1
  119. package/lib/util/idempotent-spawn.js +1 -1
  120. package/lib/util/idempotent-spawn.js.map +1 -1
  121. package/lib/util/lock.js +1 -1
  122. package/lib/util/lock.js.map +1 -1
  123. package/package.json +6 -1
  124. package/src/alchemy.ts +56 -1
  125. package/src/auth.ts +1 -1
  126. package/src/cloudflare/astro/astro.ts +1 -1
  127. package/src/cloudflare/bun-spa/bun-spa.ts +13 -13
  128. package/src/cloudflare/bun-spa/get-bun-spa-backend.ts +29 -0
  129. package/src/cloudflare/bun-spa/index.ts +1 -0
  130. package/src/cloudflare/bundle/internal-worker-bundle.ts +1 -1
  131. package/src/cloudflare/bundle/plugin-hybrid-node-compat.ts +1 -1
  132. package/src/cloudflare/bundle/plugin-node-compat.ts +1 -1
  133. package/src/cloudflare/bundle/plugin-wasm.ts +1 -1
  134. package/src/cloudflare/d1-migrations.ts +1 -1
  135. package/src/cloudflare/kv-namespace.ts +52 -20
  136. package/src/cloudflare/miniflare/miniflare-controller.ts +1 -1
  137. package/src/cloudflare/miniflare/miniflare-worker-proxy.ts +39 -4
  138. package/src/cloudflare/miniflare/paths.ts +2 -1
  139. package/src/cloudflare/miniflare/symlink-miniflare-state.ts +1 -1
  140. package/src/cloudflare/next.ts +1 -1
  141. package/src/cloudflare/nuxt/nuxt.ts +1 -1
  142. package/src/cloudflare/react-router/plugin.ts +2 -1
  143. package/src/cloudflare/react-router/react-router.ts +1 -1
  144. package/src/cloudflare/redwood/redwood.ts +1 -1
  145. package/src/cloudflare/sveltekit/sveltekit.ts +1 -1
  146. package/src/cloudflare/tanstack-start/tanstack-start.ts +1 -1
  147. package/src/cloudflare/tunnel.ts +36 -1
  148. package/src/cloudflare/vite/plugin.ts +1 -1
  149. package/src/cloudflare/website.ts +1 -1
  150. package/src/cloudflare/worker.ts +1 -3
  151. package/src/cloudflare/wrangler.json.ts +1 -1
  152. package/src/coinbase/faucet.ts +2 -2
  153. package/src/docker/api.ts +1 -1
  154. package/src/docker/image.ts +1 -1
  155. package/src/esbuild/bundle.ts +1 -1
  156. package/src/fs/file.ts +1 -1
  157. package/src/llms.ts +1 -1
  158. package/src/os/exec.ts +1 -1
  159. package/src/scope.ts +1 -1
  160. package/src/state/file-system-state-store.ts +1 -1
  161. package/src/state/migrations.ts +1 -1
  162. package/src/state/sqlite-state-store.ts +1 -1
  163. package/src/stripe/file.ts +3 -3
  164. package/src/test/bun.ts +1 -1
  165. package/src/test/prune.ts +1 -1
  166. package/src/test/vitest.ts +1 -1
  167. package/src/util/content-type.ts +1 -1
  168. package/src/util/idempotent-spawn.ts +1 -1
  169. package/src/util/lock.ts +1 -1
  170. package/templates/astro/alchemy.run.ts +0 -2
  171. package/templates/bun-spa/README.md +94 -0
  172. package/templates/bun-spa/_env +1 -0
  173. package/templates/bun-spa/_env.example +1 -0
  174. package/templates/bun-spa/_gitignore +29 -0
  175. package/templates/bun-spa/alchemy.run.ts +21 -0
  176. package/templates/bun-spa/bun-env.d.ts +26 -0
  177. package/templates/bun-spa/eslint.config.js +27 -0
  178. package/templates/bun-spa/package.json +30 -0
  179. package/templates/bun-spa/src/App.css +46 -0
  180. package/templates/bun-spa/src/App.tsx +54 -0
  181. package/templates/bun-spa/src/assets/logo.svg +1 -0
  182. package/templates/bun-spa/src/assets/react.svg +1 -0
  183. package/templates/bun-spa/src/frontend.tsx +15 -0
  184. package/templates/bun-spa/src/index.css +69 -0
  185. package/templates/bun-spa/src/index.html +14 -0
  186. package/templates/bun-spa/src/worker.ts +51 -0
  187. package/templates/bun-spa/tsconfig.json +24 -0
  188. package/templates/hono/alchemy.run.ts +0 -2
  189. package/templates/nextjs/alchemy.run.ts +0 -2
  190. package/templates/nuxt/alchemy.run.ts +0 -2
  191. package/templates/react-router/alchemy.run.ts +0 -2
  192. package/templates/react-router/package.json +1 -1
  193. package/templates/rwsdk/alchemy.run.ts +0 -1
  194. package/templates/rwsdk/package.json +1 -1
  195. package/templates/sveltekit/alchemy.run.ts +0 -2
  196. package/templates/sveltekit/package.json +1 -1
  197. package/templates/tanstack-start/alchemy.run.ts +0 -2
  198. package/templates/tanstack-start/package.json +1 -1
  199. package/templates/typescript/alchemy.run.ts +0 -2
  200. package/templates/vite/alchemy.run.ts +0 -2
  201. package/templates/vite/package.json +1 -1
  202. package/workers/tunnel-proxy.js +1 -1
@@ -0,0 +1,94 @@
1
+ # Bun + React + TypeScript
2
+
3
+ [![Deployed with Alchemy](https://alchemy.run/alchemy-badge.svg)](https://alchemy.run)
4
+
5
+ This template provides a minimal setup to get React working with Bun's native bundler, featuring Hot Module Reloading (HMR) and a simple backend API.
6
+
7
+ ## Features
8
+
9
+ - **Bun's Native Bundler**: Fast bundling with built-in support for TypeScript, JSX, and CSS
10
+ - **Hot Module Reloading**: Changes to your frontend code are instantly reflected in the browser
11
+ - **Cloudflare Workers**: Backend API powered by Cloudflare Workers
12
+ - **Single Page Application**: Optimized static asset serving in production
13
+
14
+ ## Making API Calls to the Backend
15
+
16
+ The template includes a simple example of calling your backend API. Use the `getBackendUrl()` helper to get the correct backend URL in both dev and production:
17
+
18
+ ```tsx
19
+ import { getBackendUrl } from "alchemy/cloudflare/bun-spa";
20
+
21
+ const apiBaseUrl = getBackendUrl();
22
+
23
+ function backendUrl(path: string) {
24
+ return new URL(path, apiBaseUrl);
25
+ }
26
+
27
+ // Make API calls
28
+ const response = await fetch(backendUrl("/api/hello"));
29
+ const data = await response.json();
30
+ ```
31
+
32
+ This pattern works seamlessly in both:
33
+ - **Development**: Routes requests to your local dev server
34
+ - **Production**: Routes requests to your deployed Cloudflare Worker
35
+
36
+ ## Development vs Production
37
+
38
+ ### Development
39
+
40
+ In development mode (`bun run dev`), Bun serves your application with HMR enabled:
41
+ - Frontend changes are applied instantly in the browser
42
+ - Backend changes trigger automatic redeployment
43
+ - Static assets are served directly by Bun's dev server
44
+
45
+ ### Production
46
+
47
+ In production (`bun run deploy`), your application is optimized for Cloudflare:
48
+ - Static assets are bundled into the `dist/client` directory
49
+ - Assets are uploaded to Cloudflare and served before the worker
50
+ - Worker handles API routes and fallback responses
51
+
52
+ ## Getting Started
53
+
54
+ ```sh
55
+ # Install dependencies
56
+ bun install
57
+
58
+ # Start development server
59
+ bun run dev
60
+
61
+ # Deploy to Cloudflare
62
+ bun run deploy
63
+
64
+ # Destroy resources
65
+ bun run destroy
66
+ ```
67
+
68
+ ## Project Structure
69
+
70
+ ```
71
+ ├── alchemy.run.ts # Infrastructure definition
72
+ ├── bunfig.toml # Bun configuration for BUN_PUBLIC_* env vars
73
+ ├── package.json # Dependencies and scripts
74
+ ├── src/
75
+ │ ├── index.html # Main HTML entry point
76
+ │ ├── App.tsx # Main React component
77
+ │ ├── frontend.tsx # React entry point with HMR
78
+ │ ├── worker.ts # Cloudflare Worker backend
79
+ │ └── assets/ # Static assets (images, etc.)
80
+ └── types/
81
+ └── worker.d.ts # Worker's Env type definition from bindings
82
+ ```
83
+
84
+ ## Environment Variables
85
+
86
+ The `bunfig.toml` file is required for Bun to expose `BUN_PUBLIC_*` environment variables to your frontend during development. This allows alchemy to pass configuration to your frontend during development.
87
+
88
+ ## Learn More
89
+
90
+ - [Alchemy Documentation](https://alchemy.run)
91
+ - [Bun Documentation](https://bun.sh/docs)
92
+ - [React Documentation](https://react.dev)
93
+ - [Cloudflare Workers](https://developers.cloudflare.com/workers/)
94
+
@@ -0,0 +1 @@
1
+ ALCHEMY_PASSWORD=change-me
@@ -0,0 +1 @@
1
+ ALCHEMY_PASSWORD=change-me
@@ -0,0 +1,29 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ dist
12
+ dist-ssr
13
+ *.local
14
+
15
+ # Editor directories and files
16
+ .vscode/*
17
+ !.vscode/extensions.json
18
+ .idea
19
+ .DS_Store
20
+ *.suo
21
+ *.ntvs*
22
+ *.njsproj
23
+ *.sln
24
+ *.sw?
25
+
26
+ .alchemy/
27
+ .env
28
+ .wrangler/
29
+
@@ -0,0 +1,21 @@
1
+ /// <reference types="bun-types-no-globals" />
2
+
3
+ import alchemy from "alchemy";
4
+ import { BunSPA } from "alchemy/cloudflare";
5
+
6
+ const app = await alchemy("{projectName}");
7
+
8
+ export const bunsite = await BunSPA("bun-spa-site", {
9
+ entrypoint: "src/worker.ts",
10
+ frontend: ["src/index.html"],
11
+ // Use Cloudflare bindings in your worker as normal
12
+ bindings: {
13
+ SOME_VALUE: "some-value",
14
+ },
15
+ });
16
+
17
+ console.log({
18
+ url: bunsite.url,
19
+ });
20
+
21
+ await app.finalize();
@@ -0,0 +1,26 @@
1
+ // Generated by `bun init`
2
+
3
+ declare module "*.svg" {
4
+ /**
5
+ * A path to the SVG file
6
+ */
7
+ const path: `${string}.svg`;
8
+ export = path;
9
+ }
10
+
11
+ declare module "*.png" {
12
+ /**
13
+ * A path to the PNG file
14
+ */
15
+ const path: `${string}.png`;
16
+ export = path;
17
+ }
18
+
19
+ declare module "*.module.css" {
20
+ /**
21
+ * A record of class names to their corresponding CSS module classes
22
+ */
23
+ const classes: { readonly [key: string]: string };
24
+ export = classes;
25
+ }
26
+
@@ -0,0 +1,27 @@
1
+ import js from '@eslint/js'
2
+ import reactHooks from 'eslint-plugin-react-hooks'
3
+ import reactRefresh from 'eslint-plugin-react-refresh'
4
+ import tseslint from 'typescript-eslint'
5
+
6
+ export default tseslint.config(
7
+ { ignores: ['dist'] },
8
+ {
9
+ extends: [js.configs.recommended, ...tseslint.configs.recommended],
10
+ files: ['**/*.{ts,tsx}'],
11
+ languageOptions: {
12
+ ecmaVersion: 2020,
13
+ },
14
+ plugins: {
15
+ 'react-hooks': reactHooks,
16
+ 'react-refresh': reactRefresh,
17
+ },
18
+ rules: {
19
+ ...reactHooks.configs.recommended.rules,
20
+ 'react-refresh/only-export-components': [
21
+ 'warn',
22
+ { allowConstantExport: true },
23
+ ],
24
+ },
25
+ },
26
+ )
27
+
@@ -0,0 +1,30 @@
1
+ {
2
+ "type": "module",
3
+ "name": "@alchemy.run/bun-spa-template",
4
+ "private": true,
5
+ "version": "0.0.0",
6
+ "scripts": {
7
+ "build": "tsc -b",
8
+ "deploy": "alchemy deploy",
9
+ "destroy": "alchemy destroy",
10
+ "dev": "alchemy dev",
11
+ "lint": "eslint ."
12
+ },
13
+ "dependencies": {
14
+ "react": "^19.1.0",
15
+ "react-dom": "^19.1.0"
16
+ },
17
+ "devDependencies": {
18
+ "bun-types-no-globals": "1.3.0",
19
+ "alchemy": "workspace:*",
20
+ "@cloudflare/workers-types": "^4.20250805.0",
21
+ "@eslint/js": "^9.25.0",
22
+ "@types/react": "^19.1.2",
23
+ "@types/react-dom": "^19.1.2",
24
+ "eslint": "^9.25.0",
25
+ "eslint-plugin-react-hooks": "^5.2.0",
26
+ "eslint-plugin-react-refresh": "^0.4.19",
27
+ "typescript": "^5.8.3",
28
+ "typescript-eslint": "^8.30.1"
29
+ }
30
+ }
@@ -0,0 +1,46 @@
1
+ #root {
2
+ max-width: 1280px;
3
+ margin: 0 auto;
4
+ padding: 2rem;
5
+ text-align: center;
6
+ }
7
+
8
+ .logo {
9
+ height: 6em;
10
+ padding: 1.5em;
11
+ will-change: filter;
12
+ transition: filter 300ms;
13
+ }
14
+ .logo:hover {
15
+ filter: drop-shadow(0 0 2em #646cffaa);
16
+ }
17
+ .logo.bun:hover {
18
+ filter: drop-shadow(0 0 2em #f472b6aa);
19
+ }
20
+ .logo.react:hover {
21
+ filter: drop-shadow(0 0 2em #61dafbaa);
22
+ }
23
+
24
+ @keyframes logo-spin {
25
+ from {
26
+ transform: rotate(0deg);
27
+ }
28
+ to {
29
+ transform: rotate(360deg);
30
+ }
31
+ }
32
+
33
+ @media (prefers-reduced-motion: no-preference) {
34
+ a:nth-of-type(2) .logo {
35
+ animation: logo-spin infinite 20s linear;
36
+ }
37
+ }
38
+
39
+ .card {
40
+ padding: 2em;
41
+ }
42
+
43
+ .read-the-docs {
44
+ color: #888;
45
+ }
46
+
@@ -0,0 +1,54 @@
1
+ import { getBackendUrl } from "alchemy/cloudflare/bun-spa";
2
+ import { useState } from "react";
3
+ import "./App.css";
4
+ import bunLogo from "./assets/logo.svg";
5
+ import reactLogo from "./assets/react.svg";
6
+
7
+ const apiBaseUrl = getBackendUrl();
8
+
9
+ function backendUrl(path: string) {
10
+ return new URL(path, apiBaseUrl);
11
+ }
12
+
13
+ function App() {
14
+ const [count, setCount] = useState(0);
15
+ const [message, setMessage] = useState<string>("");
16
+
17
+ const callBackend = async () => {
18
+ const response = await fetch(backendUrl("/api/hello"));
19
+ const data = (await response.json()) as { message: string };
20
+ setMessage(data.message);
21
+ };
22
+
23
+ return (
24
+ <>
25
+ <div>
26
+ <a href="https://bun.sh" target="_blank" rel="noopener">
27
+ <img src={bunLogo} className="logo bun" alt="Bun logo" />
28
+ </a>
29
+ <a href="https://react.dev" target="_blank" rel="noopener">
30
+ <img src={reactLogo} className="logo react" alt="React logo" />
31
+ </a>
32
+ </div>
33
+ <h1>Bun + React</h1>
34
+ <div className="card">
35
+ <button onClick={() => setCount((count) => count + 1)}>
36
+ count is {count}
37
+ </button>
38
+ <p>
39
+ Edit <code>src/App.tsx</code> and save to test HMR
40
+ </p>
41
+ </div>
42
+ <div className="card">
43
+ <button onClick={callBackend}>Call Backend API</button>
44
+ {message && <p>Response: {message}</p>}
45
+ </div>
46
+ <p className="read-the-docs">
47
+ Click on the Bun and React logos to learn more
48
+ </p>
49
+ </>
50
+ );
51
+ }
52
+
53
+ export default App;
54
+
@@ -0,0 +1 @@
1
+ <svg id="Bun" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 70"><title>Bun Logo</title><path id="Shadow" d="M71.09,20.74c-.16-.17-.33-.34-.5-.5s-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5A26.46,26.46,0,0,1,75.5,35.7c0,16.57-16.82,30.05-37.5,30.05-11.58,0-21.94-4.23-28.83-10.86l.5.5.5.5.5.5.5.5.5.5.5.5.5.5C19.55,65.3,30.14,69.75,42,69.75c20.68,0,37.5-13.48,37.5-30C79.5,32.69,76.46,26,71.09,20.74Z"/><g id="Body"><path id="Background" d="M73,35.7c0,15.21-15.67,27.54-35,27.54S3,50.91,3,35.7C3,26.27,9,17.94,18.22,13S33.18,3,38,3s8.94,4.13,19.78,10C67,17.94,73,26.27,73,35.7Z" style="fill:#fbf0df"/><path id="Bottom_Shadow" data-name="Bottom Shadow" d="M73,35.7a21.67,21.67,0,0,0-.8-5.78c-2.73,33.3-43.35,34.9-59.32,24.94A40,40,0,0,0,38,63.24C57.3,63.24,73,50.89,73,35.7Z" style="fill:#f6dece"/><path id="Light_Shine" data-name="Light Shine" d="M24.53,11.17C29,8.49,34.94,3.46,40.78,3.45A9.29,9.29,0,0,0,38,3c-2.42,0-5,1.25-8.25,3.13-1.13.66-2.3,1.39-3.54,2.15-2.33,1.44-5,3.07-8,4.7C8.69,18.13,3,26.62,3,35.7c0,.4,0,.8,0,1.19C9.06,15.48,20.07,13.85,24.53,11.17Z" style="fill:#fffefc"/><path id="Top" d="M35.12,5.53A16.41,16.41,0,0,1,29.49,18c-.28.25-.06.73.3.59,3.37-1.31,7.92-5.23,6-13.14C35.71,5,35.12,5.12,35.12,5.53Zm2.27,0A16.24,16.24,0,0,1,39,19c-.12.35.31.65.55.36C41.74,16.56,43.65,11,37.93,5,37.64,4.74,37.19,5.14,37.39,5.49Zm2.76-.17A16.42,16.42,0,0,1,47,17.12a.33.33,0,0,0,.65.11c.92-3.49.4-9.44-7.17-12.53C40.08,4.54,39.82,5.08,40.15,5.32ZM21.69,15.76a16.94,16.94,0,0,0,10.47-9c.18-.36.75-.22.66.18-1.73,8-7.52,9.67-11.12,9.45C21.32,16.4,21.33,15.87,21.69,15.76Z" style="fill:#ccbea7;fill-rule:evenodd"/><path id="Outline" d="M38,65.75C17.32,65.75.5,52.27.5,35.7c0-10,6.18-19.33,16.53-24.92,3-1.6,5.57-3.21,7.86-4.62,1.26-.78,2.45-1.51,3.6-2.19C32,1.89,35,.5,38,.5s5.62,1.2,8.9,3.14c1,.57,2,1.19,3.07,1.87,2.49,1.54,5.3,3.28,9,5.27C69.32,16.37,75.5,25.69,75.5,35.7,75.5,52.27,58.68,65.75,38,65.75ZM38,3c-2.42,0-5,1.25-8.25,3.13-1.13.66-2.3,1.39-3.54,2.15-2.33,1.44-5,3.07-8,4.7C8.69,18.13,3,26.62,3,35.7,3,50.89,18.7,63.25,38,63.25S73,50.89,73,35.7C73,26.62,67.31,18.13,57.78,13,54,11,51.05,9.12,48.66,7.64c-1.09-.67-2.09-1.29-3-1.84C42.63,4,40.42,3,38,3Z"/></g><g id="Mouth"><g id="Background-2" data-name="Background"><path d="M45.05,43a8.93,8.93,0,0,1-2.92,4.71,6.81,6.81,0,0,1-4,1.88A6.84,6.84,0,0,1,34,47.71,8.93,8.93,0,0,1,31.12,43a.72.72,0,0,1,.8-.81H44.26A.72.72,0,0,1,45.05,43Z" style="fill:#b71422"/></g><g id="Tongue"><path id="Background-3" data-name="Background" d="M34,47.79a6.91,6.91,0,0,0,4.12,1.9,6.91,6.91,0,0,0,4.11-1.9,10.63,10.63,0,0,0,1-1.07,6.83,6.83,0,0,0-4.9-2.31,6.15,6.15,0,0,0-5,2.78C33.56,47.4,33.76,47.6,34,47.79Z" style="fill:#ff6164"/><path id="Outline-2" data-name="Outline" d="M34.16,47a5.36,5.36,0,0,1,4.19-2.08,6,6,0,0,1,4,1.69c.23-.25.45-.51.66-.77a7,7,0,0,0-4.71-1.93,6.36,6.36,0,0,0-4.89,2.36A9.53,9.53,0,0,0,34.16,47Z"/></g><path id="Outline-3" data-name="Outline" d="M38.09,50.19a7.42,7.42,0,0,1-4.45-2,9.52,9.52,0,0,1-3.11-5.05,1.2,1.2,0,0,1,.26-1,1.41,1.41,0,0,1,1.13-.51H44.26a1.44,1.44,0,0,1,1.13.51,1.19,1.19,0,0,1,.25,1h0a9.52,9.52,0,0,1-3.11,5.05A7.42,7.42,0,0,1,38.09,50.19Zm-6.17-7.4c-.16,0-.2.07-.21.09a8.29,8.29,0,0,0,2.73,4.37A6.23,6.23,0,0,0,38.09,49a6.28,6.28,0,0,0,3.65-1.73,8.3,8.3,0,0,0,2.72-4.37.21.21,0,0,0-.2-.09Z"/></g><g id="Face"><ellipse id="Right_Blush" data-name="Right Blush" cx="53.22" cy="40.18" rx="5.85" ry="3.44" style="fill:#febbd0"/><ellipse id="Left_Bluch" data-name="Left Bluch" cx="22.95" cy="40.18" rx="5.85" ry="3.44" style="fill:#febbd0"/><path id="Eyes" d="M25.7,38.8a5.51,5.51,0,1,0-5.5-5.51A5.51,5.51,0,0,0,25.7,38.8Zm24.77,0A5.51,5.51,0,1,0,45,33.29,5.5,5.5,0,0,0,50.47,38.8Z" style="fill-rule:evenodd"/><path id="Iris" d="M24,33.64a2.07,2.07,0,1,0-2.06-2.07A2.07,2.07,0,0,0,24,33.64Zm24.77,0a2.07,2.07,0,1,0-2.06-2.07A2.07,2.07,0,0,0,48.75,33.64Z" style="fill:#fff;fill-rule:evenodd"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
@@ -0,0 +1,15 @@
1
+ import { StrictMode } from "react";
2
+ import { createRoot } from "react-dom/client";
3
+ import App from "./App.tsx";
4
+ import "./index.css";
5
+
6
+ createRoot(document.getElementById("root")!).render(
7
+ <StrictMode>
8
+ <App />
9
+ </StrictMode>,
10
+ );
11
+
12
+ if (import.meta.hot) {
13
+ import.meta.hot.accept();
14
+ }
15
+
@@ -0,0 +1,69 @@
1
+ :root {
2
+ font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
3
+ line-height: 1.5;
4
+ font-weight: 400;
5
+
6
+ color-scheme: light dark;
7
+ color: rgba(255, 255, 255, 0.87);
8
+ background-color: #242424;
9
+
10
+ font-synthesis: none;
11
+ text-rendering: optimizeLegibility;
12
+ -webkit-font-smoothing: antialiased;
13
+ -moz-osx-font-smoothing: grayscale;
14
+ }
15
+
16
+ a {
17
+ font-weight: 500;
18
+ color: #646cff;
19
+ text-decoration: inherit;
20
+ }
21
+ a:hover {
22
+ color: #535bf2;
23
+ }
24
+
25
+ body {
26
+ margin: 0;
27
+ display: flex;
28
+ place-items: center;
29
+ min-width: 320px;
30
+ min-height: 100vh;
31
+ }
32
+
33
+ h1 {
34
+ font-size: 3.2em;
35
+ line-height: 1.1;
36
+ }
37
+
38
+ button {
39
+ border-radius: 8px;
40
+ border: 1px solid transparent;
41
+ padding: 0.6em 1.2em;
42
+ font-size: 1em;
43
+ font-weight: 500;
44
+ font-family: inherit;
45
+ background-color: #1a1a1a;
46
+ cursor: pointer;
47
+ transition: border-color 0.25s;
48
+ }
49
+ button:hover {
50
+ border-color: #646cff;
51
+ }
52
+ button:focus,
53
+ button:focus-visible {
54
+ outline: 4px auto -webkit-focus-ring-color;
55
+ }
56
+
57
+ @media (prefers-color-scheme: light) {
58
+ :root {
59
+ color: #213547;
60
+ background-color: #ffffff;
61
+ }
62
+ a:hover {
63
+ color: #747bff;
64
+ }
65
+ button {
66
+ background-color: #f9f9f9;
67
+ }
68
+ }
69
+
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="./assets/logo.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Bun + React + TS</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="./frontend.tsx"></script>
12
+ </body>
13
+ </html>
14
+
@@ -0,0 +1,51 @@
1
+ import type { bunsite } from "../alchemy.run";
2
+
3
+ // Infer all the env bindings from the bunsite object
4
+ type BunsiteEnv = typeof bunsite.Env;
5
+
6
+ export default {
7
+ fetch(request: Request, env: BunsiteEnv): Response {
8
+ const url = new URL(request.url);
9
+
10
+ console.log("SOME_VALUE from type safe bindings", env.SOME_VALUE);
11
+
12
+ // Handle CORS preflight requests
13
+ if (request.method === "OPTIONS") {
14
+ return new Response(null, {
15
+ status: 204,
16
+ headers: corsHeaders(request),
17
+ });
18
+ }
19
+
20
+ const headers = corsHeaders(request);
21
+
22
+ if (url.pathname === "/api/hello") {
23
+ return Response.json(
24
+ {
25
+ message: "Hello from Bun + Alchemy API",
26
+ },
27
+ { headers },
28
+ );
29
+ }
30
+
31
+ // Return 404 for other API routes
32
+ if (url.pathname.startsWith("/api/")) {
33
+ return Response.json({ error: "Not found" }, { status: 404, headers });
34
+ }
35
+
36
+ return new Response(null, { status: 404 });
37
+ },
38
+ };
39
+
40
+ function corsHeaders(request: Request): HeadersInit {
41
+ const origin = request.headers.get("Origin") || "";
42
+ // Allow any localhost origin
43
+ if (origin.includes("localhost") || origin.includes("127.0.0.1")) {
44
+ return {
45
+ "Access-Control-Allow-Origin": origin,
46
+ "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
47
+ "Access-Control-Allow-Headers": "Content-Type",
48
+ };
49
+ }
50
+ return {};
51
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "include": [
3
+ "src/**/*.ts",
4
+ "src/**/*.tsx",
5
+ "alchemy.run.ts",
6
+ "bun-env.d.ts"
7
+ ],
8
+ "compilerOptions": {
9
+ "target": "ESNext",
10
+ "lib": [
11
+ "ESNext"
12
+ ],
13
+ "jsx": "react-jsx",
14
+ "module": "ESNext",
15
+ "moduleResolution": "Bundler",
16
+ "resolveJsonModule": true,
17
+ "noEmit": true,
18
+ "strict": true,
19
+ "skipLibCheck": true,
20
+ "types": [
21
+ "@cloudflare/workers-types"
22
+ ]
23
+ }
24
+ }
@@ -1,5 +1,3 @@
1
- /// <reference types="@types/node" />
2
-
3
1
  import alchemy from "alchemy";
4
2
  import { KVNamespace, Worker } from "alchemy/cloudflare";
5
3
 
@@ -1,5 +1,3 @@
1
- /// <reference types="@types/node" />
2
-
3
1
  import alchemy from "alchemy";
4
2
  import { Nextjs } from "alchemy/cloudflare";
5
3
 
@@ -1,5 +1,3 @@
1
- /// <reference types="@types/node" />
2
-
3
1
  import alchemy from "alchemy";
4
2
  import { Nuxt } from "alchemy/cloudflare";
5
3
 
@@ -1,5 +1,3 @@
1
- /// <reference types="@types/node" />
2
-
3
1
  import alchemy from "alchemy";
4
2
  import { ReactRouter } from "alchemy/cloudflare";
5
3
 
@@ -27,7 +27,7 @@
27
27
  "@types/react-dom": "^19.1.2",
28
28
  "tailwindcss": "^4.1.4",
29
29
  "typescript": "^5.8.3",
30
- "vite": "^6.3.3",
30
+ "vite": "^7.1.9",
31
31
  "vite-tsconfig-paths": "^5.1.4",
32
32
  "wrangler": "^4.20.5"
33
33
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="@types/node" />
2
1
  import alchemy from "alchemy";
3
2
  import { D1Database, DurableObjectNamespace, Redwood } from "alchemy/cloudflare";
4
3
 
@@ -43,7 +43,7 @@
43
43
  "typescript": "^5.8.3",
44
44
  "vibe-rules": "^0.2.31",
45
45
  "alchemy": "workspace:*",
46
- "vite": "^6.2.6",
46
+ "vite": "^7.1.9",
47
47
  "wrangler": "^4.16.0"
48
48
  },
49
49
  "pnpm": {
@@ -1,5 +1,3 @@
1
- /// <reference types="@types/node" />
2
-
3
1
  import alchemy from "alchemy";
4
2
  import { SvelteKit } from "alchemy/cloudflare";
5
3
 
@@ -27,7 +27,7 @@
27
27
  "svelte-check": "^4.0.0",
28
28
  "tailwindcss": "^4.0.0",
29
29
  "typescript": "^5.8.3",
30
- "vite": "^6.2.6",
30
+ "vite": "^7.1.9",
31
31
  "vite-plugin-devtools-json": "^0.2.0"
32
32
  }
33
33
  }
@@ -1,5 +1,3 @@
1
- /// <reference types="@types/node" />
2
-
3
1
  import alchemy from "alchemy";
4
2
  import { TanStackStart } from "alchemy/cloudflare";
5
3
 
@@ -35,7 +35,7 @@
35
35
  "alchemy": "workspace:*",
36
36
  "jsdom": "^26.0.0",
37
37
  "typescript": "^5.7.2",
38
- "vite": "^7.1.7",
38
+ "vite": "^7.1.9",
39
39
  "vitest": "^3.0.5",
40
40
  "web-vitals": "^4.2.4"
41
41
  }
@@ -1,5 +1,3 @@
1
- /// <reference types="@types/node" />
2
-
3
1
  import alchemy from "alchemy";
4
2
  import { Worker } from "alchemy/cloudflare";
5
3
 
@@ -1,5 +1,3 @@
1
- /// <reference types="@types/node" />
2
-
3
1
  import alchemy from "alchemy";
4
2
  import { Vite } from "alchemy/cloudflare";
5
3
 
@@ -30,6 +30,6 @@
30
30
  "globals": "^16.0.0",
31
31
  "typescript": "^5.8.3",
32
32
  "typescript-eslint": "^8.30.1",
33
- "vite": "^6.3.5"
33
+ "vite": "^7.1.9"
34
34
  }
35
35
  }
@@ -34,7 +34,7 @@ var h={async fetch(e,r){let n=new URL(e.url);n.host=r.TUNNEL_HOST;let l=new Head
34
34
  Alchemy</a>.</p>
35
35
  </div>
36
36
  <div class="bg-slate-200 px-5 py-3 flex flex-col w-full max-w-lg">
37
- <p class="text-sm text-slate-500">Alchemy 0.74.2</p>
37
+ <p class="text-sm text-slate-500">Alchemy 0.75.0</p>
38
38
  </div>
39
39
  </div>
40
40
  </body>