alchemy 0.37.2 → 0.38.1

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 (262) hide show
  1. package/bin/alchemy.mjs +44306 -48055
  2. package/bin/alchemy.ts +80 -85
  3. package/bin/commands/create.ts +263 -0
  4. package/bin/constants.ts +13 -0
  5. package/bin/errors.ts +11 -0
  6. package/bin/services/dependencies.ts +47 -0
  7. package/bin/services/get-package-version.ts +11 -0
  8. package/bin/services/package-manager.ts +113 -0
  9. package/bin/services/template-manager.ts +137 -0
  10. package/bin/types.ts +83 -0
  11. package/lib/alchemy.d.ts.map +1 -1
  12. package/lib/alchemy.js +12 -3
  13. package/lib/alchemy.js.map +1 -1
  14. package/lib/apply.d.ts +2 -0
  15. package/lib/apply.d.ts.map +1 -1
  16. package/lib/apply.js +47 -12
  17. package/lib/apply.js.map +1 -1
  18. package/lib/build-date.d.ts +6 -0
  19. package/lib/build-date.d.ts.map +1 -0
  20. package/lib/build-date.js +8 -0
  21. package/lib/build-date.js.map +1 -0
  22. package/lib/cloudflare/api.d.ts.map +1 -1
  23. package/lib/cloudflare/api.js +2 -1
  24. package/lib/cloudflare/api.js.map +1 -1
  25. package/lib/cloudflare/do-state-store/internal.js +5 -3
  26. package/lib/cloudflare/do-state-store/internal.js.map +1 -1
  27. package/lib/cloudflare/do-state-store/worker.d.ts.map +1 -1
  28. package/lib/cloudflare/do-state-store/worker.js +6 -1
  29. package/lib/cloudflare/do-state-store/worker.js.map +1 -1
  30. package/lib/cloudflare/pipeline.d.ts +1 -1
  31. package/lib/cloudflare/pipeline.d.ts.map +1 -1
  32. package/lib/cloudflare/pipeline.js +6 -1
  33. package/lib/cloudflare/pipeline.js.map +1 -1
  34. package/lib/cloudflare/worker-stub.d.ts +23 -2
  35. package/lib/cloudflare/worker-stub.d.ts.map +1 -1
  36. package/lib/cloudflare/worker-stub.js +16 -2
  37. package/lib/cloudflare/worker-stub.js.map +1 -1
  38. package/lib/cloudflare/worker.d.ts +5 -4
  39. package/lib/cloudflare/worker.d.ts.map +1 -1
  40. package/lib/cloudflare/worker.js +4 -7
  41. package/lib/cloudflare/worker.js.map +1 -1
  42. package/lib/context.d.ts +2 -2
  43. package/lib/context.d.ts.map +1 -1
  44. package/lib/destroy.d.ts +8 -2
  45. package/lib/destroy.d.ts.map +1 -1
  46. package/lib/destroy.js +19 -5
  47. package/lib/destroy.js.map +1 -1
  48. package/lib/scope.d.ts +26 -4
  49. package/lib/scope.d.ts.map +1 -1
  50. package/lib/scope.js +104 -9
  51. package/lib/scope.js.map +1 -1
  52. package/lib/sentry/project.js +1 -1
  53. package/lib/sentry/project.js.map +1 -1
  54. package/lib/util/logger.js +1 -1
  55. package/lib/util/logger.js.map +1 -1
  56. package/lib/util/mutex.d.ts +9 -0
  57. package/lib/util/mutex.d.ts.map +1 -0
  58. package/lib/util/mutex.js +35 -0
  59. package/lib/util/mutex.js.map +1 -0
  60. package/package.json +16 -6
  61. package/src/alchemy.ts +17 -5
  62. package/src/apply.ts +67 -17
  63. package/src/build-date.ts +8 -0
  64. package/src/cloudflare/api.ts +2 -1
  65. package/src/cloudflare/do-state-store/internal.ts +5 -3
  66. package/src/cloudflare/do-state-store/worker.ts +13 -3
  67. package/src/cloudflare/pipeline.ts +6 -0
  68. package/src/cloudflare/worker-stub.ts +31 -2
  69. package/src/cloudflare/worker.ts +6 -15
  70. package/src/context.ts +2 -2
  71. package/src/destroy.ts +30 -7
  72. package/src/scope.ts +145 -10
  73. package/src/sentry/project.ts +1 -1
  74. package/src/util/logger.ts +1 -1
  75. package/src/util/mutex.ts +33 -0
  76. package/templates/astro/.vscode/extensions.json +4 -0
  77. package/templates/astro/.vscode/launch.json +11 -0
  78. package/templates/astro/README.md +48 -0
  79. package/templates/astro/_env.example +1 -0
  80. package/templates/astro/_gitignore +27 -0
  81. package/templates/astro/alchemy.run.ts +16 -0
  82. package/templates/astro/astro.config.mjs +8 -0
  83. package/templates/astro/package.json +23 -0
  84. package/templates/astro/public/favicon.svg +9 -0
  85. package/templates/astro/src/assets/astro.svg +1 -0
  86. package/templates/astro/src/assets/background.svg +1 -0
  87. package/templates/astro/src/components/Welcome.astro +210 -0
  88. package/templates/astro/src/layouts/Layout.astro +22 -0
  89. package/templates/astro/src/pages/api/hello.ts +19 -0
  90. package/templates/astro/src/pages/index.astro +11 -0
  91. package/templates/astro/tsconfig.json +18 -0
  92. package/templates/astro/types/env.d.ts +16 -0
  93. package/templates/astro/wrangler.jsonc +6 -0
  94. package/templates/nuxt/README.md +75 -0
  95. package/templates/nuxt/_env +1 -0
  96. package/templates/nuxt/_env.example +1 -0
  97. package/templates/nuxt/_gitignore +27 -0
  98. package/templates/nuxt/alchemy.run.ts +16 -0
  99. package/templates/nuxt/app.vue +6 -0
  100. package/templates/nuxt/nuxt.config.ts +13 -0
  101. package/templates/nuxt/package.json +26 -0
  102. package/templates/nuxt/public/favicon.ico +0 -0
  103. package/templates/nuxt/public/robots.txt +2 -0
  104. package/templates/nuxt/server/api/hello.ts +7 -0
  105. package/templates/nuxt/server/middleware/auth.ts +5 -0
  106. package/templates/nuxt/server/middleware/hello.ts +5 -0
  107. package/templates/nuxt/server/tsconfig.json +3 -0
  108. package/templates/nuxt/tsconfig.json +15 -0
  109. package/templates/nuxt/types/env.d.ts +16 -0
  110. package/templates/react-router/.vscode/settings.json +5 -0
  111. package/templates/react-router/README.md +79 -0
  112. package/templates/react-router/_env +1 -0
  113. package/templates/react-router/_env.example +1 -0
  114. package/templates/react-router/_gitignore +15 -0
  115. package/templates/react-router/alchemy.run.ts +17 -0
  116. package/templates/react-router/app/app.css +15 -0
  117. package/templates/react-router/app/entry.server.tsx +43 -0
  118. package/templates/react-router/app/root.tsx +75 -0
  119. package/templates/react-router/app/routes/home.tsx +17 -0
  120. package/templates/react-router/app/routes.ts +3 -0
  121. package/templates/react-router/app/welcome/logo-dark.svg +23 -0
  122. package/templates/react-router/app/welcome/logo-light.svg +23 -0
  123. package/templates/react-router/app/welcome/welcome.tsx +90 -0
  124. package/templates/react-router/package.json +34 -0
  125. package/templates/react-router/public/favicon.ico +0 -0
  126. package/templates/react-router/react-router.config.ts +8 -0
  127. package/templates/react-router/tsconfig.cloudflare.json +27 -0
  128. package/templates/react-router/tsconfig.json +17 -0
  129. package/templates/react-router/tsconfig.node.json +20 -0
  130. package/templates/react-router/types/env.d.ts +16 -0
  131. package/templates/react-router/vite.config.ts +14 -0
  132. package/templates/react-router/workers/app.ts +23 -0
  133. package/templates/react-router/wrangler.jsonc +6 -0
  134. package/templates/rwsdk/.cursor/rules/rwsdk_rwsdk-interruptors.mdc +247 -0
  135. package/templates/rwsdk/.cursor/rules/rwsdk_rwsdk-middleware.mdc +75 -0
  136. package/templates/rwsdk/.cursor/rules/rwsdk_rwsdk-react.mdc +110 -0
  137. package/templates/rwsdk/.cursor/rules/rwsdk_rwsdk-request-response.mdc +213 -0
  138. package/templates/rwsdk/.devcontainer/Dockerfile +8 -0
  139. package/templates/rwsdk/.devcontainer/devcontainer.json +21 -0
  140. package/templates/rwsdk/README.md +62 -0
  141. package/templates/rwsdk/_env +5 -0
  142. package/templates/rwsdk/_env.example +5 -0
  143. package/templates/rwsdk/_gitignore +71 -0
  144. package/templates/rwsdk/alchemy.run.ts +29 -0
  145. package/templates/rwsdk/package.json +61 -0
  146. package/templates/rwsdk/prisma/schema.prisma +43 -0
  147. package/templates/rwsdk/src/app/Document.tsx +16 -0
  148. package/templates/rwsdk/src/app/headers.ts +32 -0
  149. package/templates/rwsdk/src/app/pages/Home.tsx +13 -0
  150. package/templates/rwsdk/src/app/pages/user/Login.tsx +79 -0
  151. package/templates/rwsdk/src/app/pages/user/functions.ts +171 -0
  152. package/templates/rwsdk/src/app/pages/user/routes.ts +17 -0
  153. package/templates/rwsdk/src/app/shared/links.ts +3 -0
  154. package/templates/rwsdk/src/client.tsx +3 -0
  155. package/templates/rwsdk/src/db.ts +26 -0
  156. package/templates/rwsdk/src/scripts/seed.ts +21 -0
  157. package/templates/rwsdk/src/session/durableObject.ts +63 -0
  158. package/templates/rwsdk/src/session/store.ts +13 -0
  159. package/templates/rwsdk/src/worker.tsx +63 -0
  160. package/templates/rwsdk/tsconfig.json +47 -0
  161. package/templates/rwsdk/types/env.d.ts +16 -0
  162. package/templates/rwsdk/types/rw.d.ts +5 -0
  163. package/templates/rwsdk/types/vite.d.ts +4 -0
  164. package/templates/rwsdk/vite.config.mts +6 -0
  165. package/templates/rwsdk/wrangler.jsonc +28 -0
  166. package/templates/sveltekit/README.md +38 -0
  167. package/templates/sveltekit/_env +1 -0
  168. package/templates/sveltekit/_env.example +1 -0
  169. package/templates/sveltekit/_gitignore +26 -0
  170. package/templates/sveltekit/_npmrc +1 -0
  171. package/templates/sveltekit/_prettierrc +3 -0
  172. package/templates/sveltekit/alchemy.run.ts +16 -0
  173. package/templates/sveltekit/bun.lock +1099 -0
  174. package/templates/sveltekit/package.json +33 -0
  175. package/templates/sveltekit/src/app.css +1 -0
  176. package/templates/sveltekit/src/app.d.ts +13 -0
  177. package/templates/sveltekit/src/app.html +12 -0
  178. package/templates/sveltekit/src/routes/+layout.svelte +7 -0
  179. package/templates/sveltekit/src/routes/+page.svelte +2 -0
  180. package/templates/sveltekit/static/favicon.png +0 -0
  181. package/templates/sveltekit/svelte.config.js +12 -0
  182. package/templates/sveltekit/tsconfig.json +27 -0
  183. package/templates/sveltekit/types/env.d.ts +16 -0
  184. package/templates/sveltekit/vite.config.ts +6 -0
  185. package/templates/sveltekit/wrangler.jsonc +7 -0
  186. package/templates/tanstack-start/.vscode/settings.json +11 -0
  187. package/templates/tanstack-start/README.md +72 -0
  188. package/templates/tanstack-start/_env +1 -0
  189. package/templates/tanstack-start/_env.example +1 -0
  190. package/templates/tanstack-start/_gitignore +22 -0
  191. package/templates/tanstack-start/_prettierignore +4 -0
  192. package/templates/tanstack-start/alchemy.run.ts +16 -0
  193. package/templates/tanstack-start/package.json +37 -0
  194. package/templates/tanstack-start/public/android-chrome-192x192.png +0 -0
  195. package/templates/tanstack-start/public/android-chrome-512x512.png +0 -0
  196. package/templates/tanstack-start/public/apple-touch-icon.png +0 -0
  197. package/templates/tanstack-start/public/favicon-16x16.png +0 -0
  198. package/templates/tanstack-start/public/favicon-32x32.png +0 -0
  199. package/templates/tanstack-start/public/favicon.ico +0 -0
  200. package/templates/tanstack-start/public/favicon.png +0 -0
  201. package/templates/tanstack-start/public/site.webmanifest +19 -0
  202. package/templates/tanstack-start/src/components/DefaultCatchBoundary.tsx +53 -0
  203. package/templates/tanstack-start/src/components/NotFound.tsx +25 -0
  204. package/templates/tanstack-start/src/components/PostError.tsx +5 -0
  205. package/templates/tanstack-start/src/components/UserError.tsx +5 -0
  206. package/templates/tanstack-start/src/router.tsx +22 -0
  207. package/templates/tanstack-start/src/routes/__root.tsx +146 -0
  208. package/templates/tanstack-start/src/routes/_pathlessLayout/_nested-layout/route-a.tsx +10 -0
  209. package/templates/tanstack-start/src/routes/_pathlessLayout/_nested-layout/route-b.tsx +10 -0
  210. package/templates/tanstack-start/src/routes/_pathlessLayout/_nested-layout.tsx +34 -0
  211. package/templates/tanstack-start/src/routes/_pathlessLayout.tsx +16 -0
  212. package/templates/tanstack-start/src/routes/api/users.$userId.ts +28 -0
  213. package/templates/tanstack-start/src/routes/api/users.ts +59 -0
  214. package/templates/tanstack-start/src/routes/customScript[.]js.ts +10 -0
  215. package/templates/tanstack-start/src/routes/deferred.tsx +62 -0
  216. package/templates/tanstack-start/src/routes/index.tsx +12 -0
  217. package/templates/tanstack-start/src/routes/posts.$postId.tsx +34 -0
  218. package/templates/tanstack-start/src/routes/posts.index.tsx +8 -0
  219. package/templates/tanstack-start/src/routes/posts.tsx +38 -0
  220. package/templates/tanstack-start/src/routes/posts_.$postId.deep.tsx +29 -0
  221. package/templates/tanstack-start/src/routes/redirect.tsx +9 -0
  222. package/templates/tanstack-start/src/routes/users.$userId.tsx +44 -0
  223. package/templates/tanstack-start/src/routes/users.index.tsx +18 -0
  224. package/templates/tanstack-start/src/routes/users.tsx +49 -0
  225. package/templates/tanstack-start/src/styles/app.css +12 -0
  226. package/templates/tanstack-start/src/utils/loggingMiddleware.tsx +41 -0
  227. package/templates/tanstack-start/src/utils/posts.tsx +40 -0
  228. package/templates/tanstack-start/src/utils/seo.ts +33 -0
  229. package/templates/tanstack-start/src/utils/users.tsx +5 -0
  230. package/templates/tanstack-start/tsconfig.json +31 -0
  231. package/templates/tanstack-start/types/env.d.ts +16 -0
  232. package/templates/tanstack-start/vite.config.ts +33 -0
  233. package/templates/tanstack-start/wrangler.jsonc +7 -0
  234. package/templates/typescript/README.md +15 -0
  235. package/templates/typescript/_gitignore +37 -0
  236. package/templates/typescript/alchemy.run.ts +15 -0
  237. package/templates/typescript/index.ts +1 -0
  238. package/templates/typescript/package.json +18 -0
  239. package/templates/typescript/src/worker.js +5 -0
  240. package/templates/typescript/src/worker.ts +7 -0
  241. package/templates/typescript/tsconfig.json +21 -0
  242. package/templates/typescript/types/env.d.ts +16 -0
  243. package/templates/vite/README.md +54 -0
  244. package/templates/vite/_env.example +1 -0
  245. package/templates/vite/_gitignore +27 -0
  246. package/templates/vite/alchemy.run.ts +17 -0
  247. package/templates/vite/eslint.config.js +28 -0
  248. package/templates/vite/index.html +13 -0
  249. package/templates/vite/package.json +35 -0
  250. package/templates/vite/public/vite.svg +1 -0
  251. package/templates/vite/src/App.css +42 -0
  252. package/templates/vite/src/App.tsx +35 -0
  253. package/templates/vite/src/assets/react.svg +1 -0
  254. package/templates/vite/src/index.css +68 -0
  255. package/templates/vite/src/main.tsx +10 -0
  256. package/templates/vite/src/vite-env.d.ts +1 -0
  257. package/templates/vite/tsconfig.json +34 -0
  258. package/templates/vite/types/env.d.ts +16 -0
  259. package/templates/vite/vite.config.ts +9 -0
  260. package/templates/vite/worker/index.ts +12 -0
  261. package/templates/vite/wrangler.jsonc +6 -0
  262. package/bin/create-alchemy.ts +0 -1220
@@ -0,0 +1,63 @@
1
+ import { MAX_SESSION_DURATION } from "rwsdk/auth";
2
+ import { DurableObject } from "cloudflare:workers";
3
+
4
+ export interface Session {
5
+ userId?: string | null;
6
+ challenge?: string | null;
7
+ createdAt: number;
8
+ }
9
+
10
+ export class SessionDurableObject extends DurableObject {
11
+ private session: Session | undefined = undefined;
12
+ constructor(state: DurableObjectState, env: Env) {
13
+ super(state, env);
14
+ this.session = undefined;
15
+ }
16
+
17
+ async saveSession({
18
+ userId = null,
19
+ challenge = null,
20
+ }: {
21
+ userId?: string | null;
22
+ challenge?: string | null;
23
+ }): Promise<Session> {
24
+ const session: Session = {
25
+ userId,
26
+ challenge,
27
+ createdAt: Date.now(),
28
+ };
29
+
30
+ await this.ctx.storage.put<Session>("session", session);
31
+ this.session = session;
32
+ return session;
33
+ }
34
+
35
+ async getSession(): Promise<{ value: Session } | { error: string }> {
36
+ if (this.session) {
37
+ return { value: this.session };
38
+ }
39
+
40
+ const session = await this.ctx.storage.get<Session>("session");
41
+
42
+ if (!session) {
43
+ return {
44
+ error: "Invalid session",
45
+ };
46
+ }
47
+
48
+ if (session.createdAt + MAX_SESSION_DURATION < Date.now()) {
49
+ await this.revokeSession();
50
+ return {
51
+ error: "Session expired",
52
+ };
53
+ }
54
+
55
+ this.session = session;
56
+ return { value: session };
57
+ }
58
+
59
+ async revokeSession() {
60
+ await this.ctx.storage.delete("session");
61
+ this.session = undefined;
62
+ }
63
+ }
@@ -0,0 +1,13 @@
1
+ import { defineDurableSession } from "rwsdk/auth";
2
+
3
+ export let sessions: ReturnType<typeof createSessionStore>;
4
+
5
+ const createSessionStore = (env: Env) =>
6
+ defineDurableSession({
7
+ sessionDurableObject: env.SESSION_DURABLE_OBJECT,
8
+ });
9
+
10
+ export const setupSessionStore = (env: Env) => {
11
+ sessions = createSessionStore(env);
12
+ return sessions;
13
+ };
@@ -0,0 +1,63 @@
1
+ import { defineApp, ErrorResponse } from "rwsdk/worker";
2
+ import { route, render, prefix } from "rwsdk/router";
3
+ import { Document } from "@/app/Document";
4
+ import { Home } from "@/app/pages/Home";
5
+ import { setCommonHeaders } from "@/app/headers";
6
+ import { userRoutes } from "@/app/pages/user/routes";
7
+ import { sessions, setupSessionStore } from "./session/store";
8
+ import { Session } from "./session/durableObject";
9
+ import { type User, db, setupDb } from "@/db";
10
+ import { env } from "cloudflare:workers";
11
+ export { SessionDurableObject } from "./session/durableObject";
12
+
13
+ export type AppContext = {
14
+ session: Session | null;
15
+ user: User | null;
16
+ };
17
+
18
+ export default defineApp([
19
+ setCommonHeaders(),
20
+ async ({ ctx, request, headers }) => {
21
+ await setupDb(env);
22
+ setupSessionStore(env);
23
+
24
+ try {
25
+ ctx.session = await sessions.load(request);
26
+ } catch (error) {
27
+ if (error instanceof ErrorResponse && error.code === 401) {
28
+ await sessions.remove(request, headers);
29
+ headers.set("Location", "/user/login");
30
+
31
+ return new Response(null, {
32
+ status: 302,
33
+ headers,
34
+ });
35
+ }
36
+
37
+ throw error;
38
+ }
39
+
40
+ if (ctx.session?.userId) {
41
+ ctx.user = await db.user.findUnique({
42
+ where: {
43
+ id: ctx.session.userId,
44
+ },
45
+ });
46
+ }
47
+ },
48
+ render(Document, [
49
+ route("/", () => new Response("Hello, World!")),
50
+ route("/protected", [
51
+ ({ ctx }) => {
52
+ if (!ctx.user) {
53
+ return new Response(null, {
54
+ status: 302,
55
+ headers: { Location: "/user/login" },
56
+ });
57
+ }
58
+ },
59
+ Home,
60
+ ]),
61
+ prefix("/user", userRoutes),
62
+ ]),
63
+ ]);
@@ -0,0 +1,47 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
+
5
+ /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
6
+ "target": "es2021",
7
+ /* Specify a set of bundled library declaration files that describe the target runtime environment. */
8
+ "lib": ["DOM", "DOM.Iterable", "ESNext", "ES2022"],
9
+ /* Specify what JSX code is generated. */
10
+ "jsx": "react-jsx",
11
+
12
+ /* Specify what module code is generated. */
13
+ "module": "es2022",
14
+ /* Specify how TypeScript looks up a file from a given module specifier. */
15
+ "moduleResolution": "bundler",
16
+ /* Specify type package names to be included without being referenced in a source file. */
17
+ "types": [
18
+ "@cloudflare/workers-types",
19
+ "types/**/*.ts"
20
+ ],
21
+ "paths": {
22
+ "@/*": ["./src/*"],
23
+ "@generated/*": ["./generated/*"]
24
+ },
25
+ /* Enable importing .json files */
26
+ "resolveJsonModule": true,
27
+
28
+ /* Enable error reporting in type-checked JavaScript files. */
29
+ "checkJs": false,
30
+
31
+ /* Disable emitting files from a compilation. */
32
+ "noEmit": true,
33
+
34
+ /* Ensure that each file can be safely transpiled without relying on other imports. */
35
+ "isolatedModules": true,
36
+ /* Allow 'import x from y' when a module doesn't have a default export. */
37
+ "allowSyntheticDefaultImports": true,
38
+ /* Ensure that casing is correct in imports. */
39
+ "forceConsistentCasingInFileNames": true,
40
+
41
+ /* Enable all strict type-checking options. */
42
+ "strict": true,
43
+
44
+ /* Skip type checking all .d.ts files. */
45
+ "skipLibCheck": true
46
+ }
47
+ }
@@ -0,0 +1,16 @@
1
+ // This file infers types for the cloudflare:workers environment from your Alchemy Worker.
2
+ // @see https://alchemy.run/docs/concepts/bindings.html#type-safe-bindings
3
+
4
+ import type { worker } from "../alchemy.run.ts";
5
+
6
+ export type CloudflareEnv = typeof worker.Env;
7
+
8
+ declare global {
9
+ type Env = CloudflareEnv;
10
+ }
11
+
12
+ declare module "cloudflare:workers" {
13
+ namespace Cloudflare {
14
+ export interface Env extends CloudflareEnv {}
15
+ }
16
+ }
@@ -0,0 +1,5 @@
1
+ import { AppContext } from "../src/worker";
2
+
3
+ declare module "rwsdk/worker" {
4
+ interface DefaultAppContext extends AppContext {}
5
+ }
@@ -0,0 +1,4 @@
1
+ declare module "*?url" {
2
+ const result: string;
3
+ export default result;
4
+ }
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from "vite";
2
+ import { redwood } from "rwsdk/vite";
3
+
4
+ export default defineConfig({
5
+ plugins: [redwood()],
6
+ });
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "my-alchemy-app-website",
3
+ "main": "src/worker.tsx",
4
+ "compatibility_date": "2025-04-02",
5
+ "compatibility_flags": ["nodejs_compat"],
6
+ "assets": { "binding": "ASSETS", "directory": "dist/client" },
7
+ "durable_objects": {
8
+ "bindings": [
9
+ { "name": "SESSION_DURABLE_OBJECT", "class_name": "SessionDurableObject" }
10
+ ]
11
+ },
12
+ "d1_databases": [
13
+ {
14
+ "binding": "DB",
15
+ "database_id": "33c4fe7d-fbfe-4cef-959c-bb54292af712",
16
+ "database_name": "my-alchemy-app-db",
17
+ "migrations_dir": "migrations",
18
+ "preview_database_id": "33c4fe7d-fbfe-4cef-959c-bb54292af712"
19
+ }
20
+ ],
21
+ "migrations": [
22
+ {
23
+ "tag": "v1",
24
+ "new_sqlite_classes": [],
25
+ "new_classes": ["SessionDurableObject"]
26
+ }
27
+ ]
28
+ }
@@ -0,0 +1,38 @@
1
+ # sv
2
+
3
+ Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
4
+
5
+ ## Creating a project
6
+
7
+ If you're seeing this, you've probably already done this step. Congrats!
8
+
9
+ ```bash
10
+ # create a new project in the current directory
11
+ npx sv create
12
+
13
+ # create a new project in my-app
14
+ npx sv create my-app
15
+ ```
16
+
17
+ ## Developing
18
+
19
+ Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
20
+
21
+ ```bash
22
+ npm run dev
23
+
24
+ # or start the server and open the app in a new browser tab
25
+ npm run dev -- --open
26
+ ```
27
+
28
+ ## Building
29
+
30
+ To create a production version of your app:
31
+
32
+ ```bash
33
+ npm run build
34
+ ```
35
+
36
+ You can preview the production build with `npm run preview`.
37
+
38
+ > To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
@@ -0,0 +1 @@
1
+ ALCHEMY_PASSWORD=change-me
@@ -0,0 +1 @@
1
+ ALCHEMY_PASSWORD=change-me
@@ -0,0 +1,26 @@
1
+ node_modules
2
+
3
+ # Output
4
+ .output
5
+ .vercel
6
+ .netlify
7
+ .wrangler
8
+ /.svelte-kit
9
+ /build
10
+
11
+ # OS
12
+ .DS_Store
13
+ Thumbs.db
14
+
15
+ # Env
16
+ .env
17
+ .env.*
18
+ !.env.example
19
+ !.env.test
20
+
21
+ # Vite
22
+ vite.config.js.timestamp-*
23
+ vite.config.ts.timestamp-*
24
+
25
+ .alchemy/
26
+ .env
@@ -0,0 +1 @@
1
+ engine-strict=true
@@ -0,0 +1,3 @@
1
+ {
2
+ "plugins": ["prettier-plugin-tailwindcss"]
3
+ }
@@ -0,0 +1,16 @@
1
+ /// <reference types="@types/node" />
2
+
3
+ import alchemy from "alchemy";
4
+ import { SvelteKit } from "alchemy/cloudflare";
5
+
6
+ const app = await alchemy("my-alchemy-app");
7
+
8
+ export const worker = await SvelteKit("website", {
9
+ command: "bun run build",
10
+ });
11
+
12
+ console.log({
13
+ url: worker.url,
14
+ });
15
+
16
+ await app.finalize();