create-expo-updates-server 0.1.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 (117) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -0
  3. package/bin/create-expo-updates-server.mjs +5 -0
  4. package/dist/template/.env.docker.example +15 -0
  5. package/dist/template/.env.example +35 -0
  6. package/dist/template/Dockerfile +42 -0
  7. package/dist/template/LICENSE +21 -0
  8. package/dist/template/README.md +665 -0
  9. package/dist/template/app/api/admin/access-tokens/[id]/route.ts +25 -0
  10. package/dist/template/app/api/admin/access-tokens/route.test.ts +73 -0
  11. package/dist/template/app/api/admin/access-tokens/route.ts +90 -0
  12. package/dist/template/app/api/admin/embedded-updates/[embeddedUpdateId]/route.ts +25 -0
  13. package/dist/template/app/api/admin/embedded-updates/route.test.ts +102 -0
  14. package/dist/template/app/api/admin/embedded-updates/route.ts +47 -0
  15. package/dist/template/app/api/admin/emergency-redirects/[id]/route.ts +62 -0
  16. package/dist/template/app/api/admin/emergency-redirects/route.test.ts +84 -0
  17. package/dist/template/app/api/admin/emergency-redirects/route.ts +56 -0
  18. package/dist/template/app/api/admin/login/route.test.ts +55 -0
  19. package/dist/template/app/api/admin/login/route.ts +52 -0
  20. package/dist/template/app/api/admin/logout/route.ts +20 -0
  21. package/dist/template/app/api/admin/session/route.ts +15 -0
  22. package/dist/template/app/api/admin/updates/[encodedKey]/deactivate/route.ts +33 -0
  23. package/dist/template/app/api/admin/updates/[encodedKey]/promote/route.ts +29 -0
  24. package/dist/template/app/api/admin/updates/[encodedKey]/rollback/route.ts +29 -0
  25. package/dist/template/app/api/admin/updates/[encodedKey]/route.ts +96 -0
  26. package/dist/template/app/api/admin/updates/route.test.ts +142 -0
  27. package/dist/template/app/api/admin/updates/route.ts +32 -0
  28. package/dist/template/app/api/assets/route.ts +6 -0
  29. package/dist/template/app/api/health/route.test.ts +26 -0
  30. package/dist/template/app/api/health/route.ts +42 -0
  31. package/dist/template/app/api/manifest/route.ts +6 -0
  32. package/dist/template/app/api/update-complete/route.ts +6 -0
  33. package/dist/template/app/favicon.ico +0 -0
  34. package/dist/template/app/globals.css +26 -0
  35. package/dist/template/app/layout.tsx +34 -0
  36. package/dist/template/app/login/page.tsx +77 -0
  37. package/dist/template/app/page.tsx +12 -0
  38. package/dist/template/app/updates/[encodedKey]/page.tsx +482 -0
  39. package/dist/template/app/updates/embedded/page.tsx +164 -0
  40. package/dist/template/app/updates/emergency-redirects/page.tsx +430 -0
  41. package/dist/template/app/updates/layout.tsx +14 -0
  42. package/dist/template/app/updates/page.tsx +281 -0
  43. package/dist/template/docker-compose.yml +100 -0
  44. package/dist/template/docs/expo-app-setup.md +497 -0
  45. package/dist/template/docs/getting-started.md +502 -0
  46. package/dist/template/docs/getting-started.ru.md +623 -0
  47. package/dist/template/docs/index.md +57 -0
  48. package/dist/template/docs/migrations/schema.sql +363 -0
  49. package/dist/template/docs/npm-installer.md +83 -0
  50. package/dist/template/docs/operations-guide.md +270 -0
  51. package/dist/template/docs/ota-emergency-recovery.md +109 -0
  52. package/dist/template/docs/supabase-setup.md +133 -0
  53. package/dist/template/eslint.config.mjs +30 -0
  54. package/dist/template/gitignore.template +58 -0
  55. package/dist/template/next.config.ts +7 -0
  56. package/dist/template/package-lock.json +12156 -0
  57. package/dist/template/package.json +50 -0
  58. package/dist/template/postcss.config.mjs +7 -0
  59. package/dist/template/public/file.svg +1 -0
  60. package/dist/template/public/globe.svg +1 -0
  61. package/dist/template/public/next.svg +1 -0
  62. package/dist/template/public/vercel.svg +1 -0
  63. package/dist/template/public/window.svg +1 -0
  64. package/dist/template/scripts/configure-expo-app.mjs +145 -0
  65. package/dist/template/scripts/create-access-token.mjs +135 -0
  66. package/dist/template/scripts/create-admin.mjs +169 -0
  67. package/dist/template/scripts/import-emergency-redirects.mjs +126 -0
  68. package/dist/template/scripts/lib/embedded-update-registrar.test.ts +64 -0
  69. package/dist/template/scripts/lib/expo-app-configurator.mjs +666 -0
  70. package/dist/template/scripts/lib/expo-app-configurator.test.ts +463 -0
  71. package/dist/template/scripts/lib/expo-app-prompts.mjs +139 -0
  72. package/dist/template/scripts/lib/expo-app-prompts.test.ts +97 -0
  73. package/dist/template/scripts/lib/expo-export-command.test.ts +31 -0
  74. package/dist/template/scripts/lib/ota-publish-retry.test.ts +33 -0
  75. package/dist/template/scripts/manage-emergency-redirect.mjs +483 -0
  76. package/dist/template/scripts/sync-docker-database-password.sh +16 -0
  77. package/dist/template/src/client/admin-api.ts +174 -0
  78. package/dist/template/src/client/admin-types.ts +93 -0
  79. package/dist/template/src/client/logout-button.tsx +31 -0
  80. package/dist/template/src/server/controllers/assets.ts +216 -0
  81. package/dist/template/src/server/controllers/manifest.test.ts +403 -0
  82. package/dist/template/src/server/controllers/manifest.ts +626 -0
  83. package/dist/template/src/server/controllers/update-complete.ts +36 -0
  84. package/dist/template/src/server/lib/admin-access-tokens.ts +169 -0
  85. package/dist/template/src/server/lib/admin-api.ts +101 -0
  86. package/dist/template/src/server/lib/admin-auth.ts +208 -0
  87. package/dist/template/src/server/lib/admin-embedded-updates.ts +150 -0
  88. package/dist/template/src/server/lib/admin-updates.ts +1282 -0
  89. package/dist/template/src/server/lib/common.js +24 -0
  90. package/dist/template/src/server/lib/emergency-channel-redirects.ts +310 -0
  91. package/dist/template/src/server/lib/env.js +8 -0
  92. package/dist/template/src/server/lib/manifest-helpers.js +91 -0
  93. package/dist/template/src/server/lib/response.js +11 -0
  94. package/dist/template/src/server/lib/signing.js +55 -0
  95. package/dist/template/src/server/lib/supabase.js +763 -0
  96. package/dist/template/src/server/manifest/manifest-repository.ts +269 -0
  97. package/dist/template/src/server/manifest/manifest-request.ts +21 -0
  98. package/dist/template/src/server/manifest/manifest-response.ts +235 -0
  99. package/dist/template/src/server/manifest/manifest-values.ts +62 -0
  100. package/dist/template/templates/expo-app/.env.ota.example +18 -0
  101. package/dist/template/templates/expo-app/ci_scripts/ci_post_xcodebuild.sh +6 -0
  102. package/dist/template/templates/expo-app/ci_scripts/register-embedded-update.sh +36 -0
  103. package/dist/template/templates/expo-app/plugins/with-ota-embedded-registration.js +33 -0
  104. package/dist/template/templates/expo-app/scripts/ota-publish/api/database-client.mjs +87 -0
  105. package/dist/template/templates/expo-app/scripts/ota-publish/api/storage-client.mjs +57 -0
  106. package/dist/template/templates/expo-app/scripts/ota-publish/index.mjs +182 -0
  107. package/dist/template/templates/expo-app/scripts/ota-publish/lib/common.mjs +84 -0
  108. package/dist/template/templates/expo-app/scripts/ota-publish/lib/expo-export-command.mjs +24 -0
  109. package/dist/template/templates/expo-app/scripts/ota-publish/lib/retry.mjs +25 -0
  110. package/dist/template/templates/expo-app/scripts/ota-publish/shared/config.mjs +48 -0
  111. package/dist/template/templates/expo-app/scripts/ota-register-embedded/android-register-embedded-update.sh +18 -0
  112. package/dist/template/templates/expo-app/scripts/ota-register-embedded/index.mjs +275 -0
  113. package/dist/template/tsconfig.json +36 -0
  114. package/dist/template/vitest.config.mts +20 -0
  115. package/dist/template-manifest.json +564 -0
  116. package/lib/cli.mjs +549 -0
  117. package/package.json +41 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-present Expo Update Custom Server contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # create-expo-updates-server
2
+
3
+ Create a standalone, self-hosted Expo Updates Server project from the
4
+ versioned template bundled in this npm package.
5
+
6
+ ```bash
7
+ npx create-expo-updates-server@latest my-server
8
+ cd my-server
9
+ ```
10
+
11
+ The initializer performs no network requests, dependency installation, Git
12
+ initialization, or secret generation while scaffolding. The target path must
13
+ remain absent while the command runs; the initializer never merges with an
14
+ existing path. If scaffolding fails after staging starts, the error reports the
15
+ private staging directory left for manual inspection or removal.
16
+
17
+ See the
18
+ [installer documentation](https://github.com/tonichiga/expo-updates-server/blob/main/docs/npm-installer.md)
19
+ for Docker and npm setup instructions.
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { main } from "../lib/cli.mjs";
4
+
5
+ process.exitCode = await main(process.argv.slice(2));
@@ -0,0 +1,15 @@
1
+ POSTGRES_DB=expo_updates
2
+ POSTGRES_USER=expo_updates
3
+ POSTGRES_PASSWORD=replace-with-a-strong-storage-password
4
+ POSTGRES_PORT=5432
5
+
6
+ MINIO_ROOT_USER=expo_updates
7
+ MINIO_ROOT_PASSWORD=replace-with-a-strong-storage-password
8
+ MINIO_API_PORT=9000
9
+ MINIO_CONSOLE_PORT=9001
10
+ OTA_STORAGE_BUCKET=expo-updates
11
+
12
+ OTA_HTTP_PORT=3000
13
+ OTA_PUBLIC_BASE_URL=http://localhost:3000
14
+ OTA_CDN_BASE_URL=
15
+ CODE_SIGNING_PRIVATE_KEY=
@@ -0,0 +1,35 @@
1
+ # OTA signing (optional)
2
+ CODE_SIGNING_PRIVATE_KEY=""
3
+
4
+ # Feature flags (optional)
5
+ FLAGS=""
6
+ FLAGS_SECRET=""
7
+
8
+ # Database
9
+ DATABASE_PROVIDER="pg"
10
+ DATABASE_URL="postgresql://user:password@host:5432/database"
11
+ DATABASE_SSL="false"
12
+
13
+ # Cloudflare R2 or another S3-compatible storage
14
+ R2_ENDPOINT="https://<account-id>.r2.cloudflarestorage.com"
15
+ R2_ACCESS_KEY_ID="<access-key-id>"
16
+ R2_SECRET_ACCESS_KEY="<secret-access-key>"
17
+ R2_BUCKET="expo-updates"
18
+ R2_REGION="auto"
19
+
20
+ # OTA storage
21
+ OTA_STORAGE_BUCKET="expo-updates"
22
+ OTA_SIGNED_URL_TTL="3600"
23
+ OTA_PUBLIC_BASE_URL="https://updates.example.com"
24
+ OTA_CDN_BASE_URL=""
25
+
26
+ # Supabase provider
27
+ SUPABASE_PROJECT_URL="https://<project-ref>.supabase.co"
28
+ SUPABASE_PUBLISHED_KEY=""
29
+ SUPABASE_SERVICE_ROLE_KEY="<service-role-key>"
30
+ SUPABASE_SIGNED_URL_TTL="3600"
31
+ SUPABASE_UPDATES_BUCKET="expo-updates"
32
+
33
+ # Optional Cloudflare/Vercel integration
34
+ CF_API_TOKEN=""
35
+ VERCEL_OIDC_TOKEN=""
@@ -0,0 +1,42 @@
1
+ FROM node:24-alpine AS dependencies
2
+
3
+ WORKDIR /app
4
+ COPY package.json package-lock.json ./
5
+ RUN npm ci
6
+
7
+ FROM node:24-alpine AS production-dependencies
8
+
9
+ WORKDIR /app
10
+ COPY package.json package-lock.json ./
11
+ RUN npm ci --omit=dev
12
+
13
+ FROM node:24-alpine AS builder
14
+
15
+ WORKDIR /app
16
+ ENV NEXT_TELEMETRY_DISABLED=1
17
+ COPY --from=dependencies /app/node_modules ./node_modules
18
+ COPY . .
19
+ RUN npm run build
20
+
21
+ FROM node:24-alpine AS runner
22
+
23
+ WORKDIR /app
24
+ ENV NODE_ENV=production
25
+ ENV NEXT_TELEMETRY_DISABLED=1
26
+ ENV PORT=3000
27
+ ENV HOSTNAME=0.0.0.0
28
+
29
+ RUN addgroup --system --gid 1001 nodejs \
30
+ && adduser --system --uid 1001 nextjs
31
+
32
+ COPY --from=builder --chown=nextjs:nodejs /app/public ./public
33
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
34
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
35
+ COPY --from=production-dependencies --chown=nextjs:nodejs /app/node_modules ./node_modules
36
+ COPY --from=builder --chown=nextjs:nodejs /app/scripts ./scripts
37
+ COPY --from=builder --chown=nextjs:nodejs /app/package.json ./package.json
38
+
39
+ USER nextjs
40
+ EXPOSE 3000
41
+
42
+ CMD ["node", "server.js"]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 tonichiga
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.