@startup-api/cloudflare 0.0.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 (39) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +114 -0
  3. package/package.json +53 -0
  4. package/public/index.html +405 -0
  5. package/public/users/accounts.html +504 -0
  6. package/public/users/admin/index.html +765 -0
  7. package/public/users/power-strip.js +658 -0
  8. package/public/users/profile.html +443 -0
  9. package/public/users/style.css +493 -0
  10. package/src/CookieManager.ts +56 -0
  11. package/src/PowerStrip.ts +23 -0
  12. package/src/StartupAPIEnv.ts +12 -0
  13. package/src/auth/GoogleProvider.ts +67 -0
  14. package/src/auth/OAuthProvider.ts +52 -0
  15. package/src/auth/TwitchProvider.ts +64 -0
  16. package/src/auth/index.ts +231 -0
  17. package/src/billing/PaymentEngine.ts +20 -0
  18. package/src/billing/Plan.ts +80 -0
  19. package/src/billing/plansConfig.ts +48 -0
  20. package/src/handlers/account.ts +246 -0
  21. package/src/handlers/admin.ts +144 -0
  22. package/src/handlers/auth.ts +54 -0
  23. package/src/handlers/ssr.ts +274 -0
  24. package/src/handlers/user.ts +168 -0
  25. package/src/handlers/utils.ts +120 -0
  26. package/src/index.ts +190 -0
  27. package/src/schemas/account.ts +37 -0
  28. package/src/schemas/admin.ts +10 -0
  29. package/src/schemas/billing.ts +11 -0
  30. package/src/schemas/credential.ts +38 -0
  31. package/src/schemas/membership.ts +9 -0
  32. package/src/schemas/session.ts +10 -0
  33. package/src/schemas/user.ts +22 -0
  34. package/src/storage/AccountDO.ts +370 -0
  35. package/src/storage/CredentialDO.ts +82 -0
  36. package/src/storage/SystemDO.ts +264 -0
  37. package/src/storage/UserDO.ts +385 -0
  38. package/worker-configuration.d.ts +11696 -0
  39. package/wrangler.template.jsonc +55 -0
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Canonical Wrangler configuration for a project that consumes
3
+ * `@startup-api/cloudflare` as an npm dependency.
4
+ *
5
+ * `npm create startup` copies this file into the generated project and fills
6
+ * in the `__PROJECT_NAME__` and `__ORIGIN_URL__` placeholders. Keeping it here,
7
+ * next to the worker source, means the bindings and migrations below always
8
+ * match the version of the package that ships them.
9
+ *
10
+ * For configuration docs see:
11
+ * https://developers.cloudflare.com/workers/wrangler/configuration/
12
+ */
13
+ {
14
+ "$schema": "node_modules/wrangler/config-schema.json",
15
+ "name": "__PROJECT_NAME__",
16
+ // Thin local entrypoint that re-exports the worker + Durable Objects from the package.
17
+ "main": "src/index.ts",
18
+ "compatibility_date": "2025-09-27",
19
+ "compatibility_flags": ["global_fetch_strictly_public"],
20
+ "assets": {
21
+ // Framework assets are synced here from the package on install (see scripts/sync-assets.mjs).
22
+ "directory": "./public",
23
+ "run_worker_first": true,
24
+ "binding": "ASSETS",
25
+ },
26
+ "observability": {
27
+ "enabled": true,
28
+ },
29
+ "r2_buckets": [
30
+ {
31
+ "binding": "IMAGE_STORAGE",
32
+ "bucket_name": "__PROJECT_NAME__-images",
33
+ },
34
+ ],
35
+ "durable_objects": {
36
+ "bindings": [
37
+ { "name": "USER", "class_name": "UserDO" },
38
+ { "name": "ACCOUNT", "class_name": "AccountDO" },
39
+ { "name": "SYSTEM", "class_name": "SystemDO" },
40
+ { "name": "CREDENTIAL", "class_name": "CredentialDO" },
41
+ ],
42
+ },
43
+ "migrations": [
44
+ { "tag": "v1", "new_sqlite_classes": ["UserDO"] },
45
+ { "tag": "v2", "new_sqlite_classes": ["AccountDO"] },
46
+ { "tag": "v3", "new_sqlite_classes": ["SystemDO"] },
47
+ { "tag": "v4", "new_sqlite_classes": ["CredentialDO"] },
48
+ ],
49
+ "vars": {
50
+ // The origin (or other object) this worker proxies back to. Set during `npm create startup`.
51
+ "ORIGIN_URL": "__ORIGIN_URL__",
52
+ // SESSION_SECRET is intentionally left out of source control. Set it as a
53
+ // secret (`wrangler secret put SESSION_SECRET`) or in `.dev.vars` for local dev.
54
+ },
55
+ }