@terreno/mcp 0.31.0 → 56.0.0-beta.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.
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +15 -16
- package/dist/bootstrap.js.map +1 -1
- package/dist/docs/templates/bootstrap/backend/types/models/userTypes.template.md +4 -5
- package/dist/docs/templates/bootstrap/frontend/app/_layout.template.tsx +1 -1
- package/dist/docs/templates/tools/model.template.md +2 -4
- package/dist/docs/versioned/next/README.md +1 -0
- package/dist/docs/versioned/next/explanation/README.md +1 -7
- package/dist/docs/versioned/next/how-to/README.md +2 -8
- package/dist/docs/versioned/next/how-to/deploy-to-gcp.md +228 -20
- package/dist/docs/versioned/next/how-to/migrate-rtk-to-syncdb.md +445 -0
- package/dist/docs/versioned/next/implementationPlans/PLAN_INDEX.md +4 -57
- package/dist/docs/versioned/next/implementationPlans/README.md +30 -56
- package/dist/docs/versioned/next/implementationPlans/agentic-sdlc-plugin.md +1 -2
- package/dist/docs/versioned/next/implementationPlans/ai-dev-loop-boost.md +0 -1
- package/dist/docs/versioned/next/implementationPlans/build-terreno-app-validation.md +0 -1
- package/dist/docs/versioned/next/implementationPlans/deploy-to-gcp.md +0 -1
- package/dist/docs/versioned/next/implementationPlans/deploy-to-vercel.md +0 -1
- package/dist/docs/versioned/next/implementationPlans/deployment-foundation.md +0 -1
- package/dist/docs/versioned/next/implementationPlans/docs-reference-coverage.md +0 -1
- package/dist/docs/versioned/next/implementationPlans/docs-tutorials-ai-first.md +0 -1
- package/dist/docs/versioned/next/implementationPlans/examples-demo-coverage.md +0 -1
- package/dist/docs/versioned/next/implementationPlans/oss-governance-baseline.md +0 -1
- package/dist/docs/versioned/next/implementationPlans/positioning-django-rails-universal.md +0 -1
- package/dist/docs/versioned/next/implementationPlans/public-roadmap-github.md +0 -1
- package/dist/docs/versioned/next/implementationPlans/rtk-to-syncdb-migration-docs.md +52 -47
- package/dist/docs/versioned/next/implementationPlans/syncdb-api-inventory.md +303 -0
- package/dist/docs/versioned/next/implementationPlans/syncdb-codegen.md +252 -0
- package/dist/docs/versioned/next/implementationPlans/syncdb-local-first.md +468 -420
- package/dist/docs/versioned/next/implementationPlans/syncdb-phase-c-design.md +425 -0
- package/dist/docs/versioned/next/implementationPlans/terreno-syncdb-2.md +800 -0
- package/dist/docs/versioned/next/implementationPlans/upgrade-guides-and-skill.md +0 -1
- package/dist/docs/versioned/next/implementationPlans/web-ssr-and-admin-spa.md +0 -1
- package/dist/docs/versioned/next/reference/README.md +1 -4
- package/dist/docs/versioned/next/reference/environment-variables.md +382 -220
- package/dist/docs/versioned/next/reference/syncdb.md +456 -0
- package/dist/docs/versioned/next/superpowers/plans/2026-07-28-admin-mobile-navigation.md +97 -0
- package/dist/docs/versioned/next/superpowers/specs/2026-07-28-admin-mobile-navigation-design.md +36 -0
- package/dist/docs/versioned/next/tasks/agentic-sdlc-plugin.md +5 -5
- package/dist/docs/versioned/next/tasks/deploy-to-gcp.md +11 -11
- package/dist/docs/versioned/next/tasks/deployment-foundation.md +12 -12
- package/dist/docs/versioned/next/tasks/docs-reference-coverage.md +4 -4
- package/dist/docs/versioned/next/tasks/oss-governance-baseline.md +18 -18
- package/dist/docs/versioned/next/tasks/positioning-django-rails-universal.md +4 -4
- package/dist/docs/versioned/next/tasks/public-roadmap-github.md +15 -15
- package/dist/docs/versioned/next/tasks/rtk-to-syncdb-migration-docs.md +10 -10
- package/dist/docs/versioned/next/tasks/syncdb-codegen.md +65 -0
- package/dist/docs/versioned/next/tasks/syncdb-local-first.md +434 -117
- package/package.json +4 -5
- package/src/docs/templates/bootstrap/backend/types/models/userTypes.template.md +4 -5
- package/src/docs/templates/bootstrap/frontend/app/_layout.template.tsx +1 -1
- package/src/docs/templates/tools/model.template.md +2 -4
- package/src/docs/versioned/next/README.md +1 -0
- package/src/docs/versioned/next/explanation/README.md +1 -7
- package/src/docs/versioned/next/how-to/README.md +2 -8
- package/src/docs/versioned/next/how-to/deploy-to-gcp.md +228 -20
- package/src/docs/versioned/next/how-to/migrate-rtk-to-syncdb.md +445 -0
- package/src/docs/versioned/next/implementationPlans/PLAN_INDEX.md +4 -57
- package/src/docs/versioned/next/implementationPlans/README.md +30 -56
- package/src/docs/versioned/next/implementationPlans/agentic-sdlc-plugin.md +1 -2
- package/src/docs/versioned/next/implementationPlans/ai-dev-loop-boost.md +0 -1
- package/src/docs/versioned/next/implementationPlans/build-terreno-app-validation.md +0 -1
- package/src/docs/versioned/next/implementationPlans/deploy-to-gcp.md +0 -1
- package/src/docs/versioned/next/implementationPlans/deploy-to-vercel.md +0 -1
- package/src/docs/versioned/next/implementationPlans/deployment-foundation.md +0 -1
- package/src/docs/versioned/next/implementationPlans/docs-reference-coverage.md +0 -1
- package/src/docs/versioned/next/implementationPlans/docs-tutorials-ai-first.md +0 -1
- package/src/docs/versioned/next/implementationPlans/examples-demo-coverage.md +0 -1
- package/src/docs/versioned/next/implementationPlans/oss-governance-baseline.md +0 -1
- package/src/docs/versioned/next/implementationPlans/positioning-django-rails-universal.md +0 -1
- package/src/docs/versioned/next/implementationPlans/public-roadmap-github.md +0 -1
- package/src/docs/versioned/next/implementationPlans/rtk-to-syncdb-migration-docs.md +52 -47
- package/src/docs/versioned/next/implementationPlans/syncdb-api-inventory.md +303 -0
- package/src/docs/versioned/next/implementationPlans/syncdb-codegen.md +252 -0
- package/src/docs/versioned/next/implementationPlans/syncdb-local-first.md +468 -420
- package/src/docs/versioned/next/implementationPlans/syncdb-phase-c-design.md +425 -0
- package/src/docs/versioned/next/implementationPlans/terreno-syncdb-2.md +800 -0
- package/src/docs/versioned/next/implementationPlans/upgrade-guides-and-skill.md +0 -1
- package/src/docs/versioned/next/implementationPlans/web-ssr-and-admin-spa.md +0 -1
- package/src/docs/versioned/next/reference/README.md +1 -4
- package/src/docs/versioned/next/reference/environment-variables.md +382 -220
- package/src/docs/versioned/next/reference/syncdb.md +456 -0
- package/src/docs/versioned/next/superpowers/plans/2026-07-28-admin-mobile-navigation.md +97 -0
- package/src/docs/versioned/next/superpowers/specs/2026-07-28-admin-mobile-navigation-design.md +36 -0
- package/src/docs/versioned/next/tasks/agentic-sdlc-plugin.md +5 -5
- package/src/docs/versioned/next/tasks/deploy-to-gcp.md +11 -11
- package/src/docs/versioned/next/tasks/deployment-foundation.md +12 -12
- package/src/docs/versioned/next/tasks/docs-reference-coverage.md +4 -4
- package/src/docs/versioned/next/tasks/oss-governance-baseline.md +18 -18
- package/src/docs/versioned/next/tasks/positioning-django-rails-universal.md +4 -4
- package/src/docs/versioned/next/tasks/public-roadmap-github.md +15 -15
- package/src/docs/versioned/next/tasks/rtk-to-syncdb-migration-docs.md +10 -10
- package/src/docs/versioned/next/tasks/syncdb-codegen.md +65 -0
- package/src/docs/versioned/next/tasks/syncdb-local-first.md +434 -117
- package/LICENSE +0 -21
- package/dist/__tests__/bootstrap.test.d.ts +0 -2
- package/dist/__tests__/bootstrap.test.d.ts.map +0 -1
- package/dist/__tests__/bootstrap.test.js +0 -299
- package/dist/__tests__/bootstrap.test.js.map +0 -1
- package/dist/__tests__/databaseQuery.test.d.ts +0 -2
- package/dist/__tests__/databaseQuery.test.d.ts.map +0 -1
- package/dist/__tests__/databaseQuery.test.js +0 -83
- package/dist/__tests__/databaseQuery.test.js.map +0 -1
- package/dist/__tests__/docsRoot.test.d.ts +0 -2
- package/dist/__tests__/docsRoot.test.d.ts.map +0 -1
- package/dist/__tests__/docsRoot.test.js +0 -59
- package/dist/__tests__/docsRoot.test.js.map +0 -1
- package/dist/__tests__/inferPackages.test.d.ts +0 -2
- package/dist/__tests__/inferPackages.test.d.ts.map +0 -1
- package/dist/__tests__/inferPackages.test.js +0 -35
- package/dist/__tests__/inferPackages.test.js.map +0 -1
- package/dist/__tests__/preload.d.ts +0 -2
- package/dist/__tests__/preload.d.ts.map +0 -1
- package/dist/__tests__/preload.js +0 -12
- package/dist/__tests__/preload.js.map +0 -1
- package/dist/__tests__/prompts.test.d.ts +0 -2
- package/dist/__tests__/prompts.test.d.ts.map +0 -1
- package/dist/__tests__/prompts.test.js +0 -295
- package/dist/__tests__/prompts.test.js.map +0 -1
- package/dist/__tests__/resources.test.d.ts +0 -2
- package/dist/__tests__/resources.test.d.ts.map +0 -1
- package/dist/__tests__/resources.test.js +0 -352
- package/dist/__tests__/resources.test.js.map +0 -1
- package/dist/__tests__/search.test.d.ts +0 -2
- package/dist/__tests__/search.test.d.ts.map +0 -1
- package/dist/__tests__/search.test.js +0 -163
- package/dist/__tests__/search.test.js.map +0 -1
- package/dist/__tests__/tools.test.d.ts +0 -2
- package/dist/__tests__/tools.test.d.ts.map +0 -1
- package/dist/__tests__/tools.test.js +0 -540
- package/dist/__tests__/tools.test.js.map +0 -1
- package/dist/__tests__/upgradeGuide.test.d.ts +0 -2
- package/dist/__tests__/upgradeGuide.test.d.ts.map +0 -1
- package/dist/__tests__/upgradeGuide.test.js +0 -22
- package/dist/__tests__/upgradeGuide.test.js.map +0 -1
- package/dist/docs/upgrades/0.31.0.md +0 -60
- package/dist/docs/versioned/next/explanation/deployment-architecture-gcp.md +0 -65
- package/dist/docs/versioned/next/explanation/deployment-baseline.md +0 -78
- package/dist/docs/versioned/next/explanation/positioning.md +0 -164
- package/dist/docs/versioned/next/explanation/repository-settings.md +0 -44
- package/dist/docs/versioned/next/explanation/roadmap-process.md +0 -330
- package/dist/docs/versioned/next/explanation/roadmap-seed-issues.md +0 -866
- package/dist/docs/versioned/next/how-to/build-for-web.md +0 -69
- package/dist/docs/versioned/next/how-to/deploy-backend-to-cloud-run.md +0 -115
- package/dist/docs/versioned/next/how-to/deploy-web-to-gcs-cdn.md +0 -183
- package/dist/docs/versioned/next/implementationPlans/b2b-platform-program.md +0 -114
- package/dist/docs/versioned/next/implementationPlans/billing-stripe.md +0 -158
- package/dist/docs/versioned/next/implementationPlans/comms-abstraction.md +0 -240
- package/dist/docs/versioned/next/implementationPlans/comms-adapter-expo-push.md +0 -107
- package/dist/docs/versioned/next/implementationPlans/comms-adapter-sendgrid.md +0 -107
- package/dist/docs/versioned/next/implementationPlans/comms-adapter-twilio-sms.md +0 -102
- package/dist/docs/versioned/next/implementationPlans/comms-adapter-twilio-verify.md +0 -93
- package/dist/docs/versioned/next/implementationPlans/infra-mcp-research.md +0 -188
- package/dist/docs/versioned/next/implementationPlans/infra-mcp.md +0 -269
- package/dist/docs/versioned/next/implementationPlans/native-module-baseline.md +0 -105
- package/dist/docs/versioned/next/implementationPlans/orgs-and-teams.md +0 -158
- package/dist/docs/versioned/next/implementationPlans/password-reset-and-email-verification.md +0 -147
- package/dist/docs/versioned/next/reference/admin-spa.md +0 -130
- package/dist/docs/versioned/next/reference/ai.md +0 -519
- package/dist/docs/versioned/next/reference/test.md +0 -108
- package/dist/docs/versioned/next/roadmap.md +0 -9
- package/dist/docs/versioned/next/tasks/README.md +0 -42
- package/dist/docs/versioned/next/tasks/billing-stripe.md +0 -75
- package/dist/docs/versioned/next/tasks/comms-abstraction.md +0 -77
- package/dist/docs/versioned/next/tasks/comms-adapter-expo-push.md +0 -29
- package/dist/docs/versioned/next/tasks/comms-adapter-sendgrid.md +0 -29
- package/dist/docs/versioned/next/tasks/comms-adapter-twilio-sms.md +0 -29
- package/dist/docs/versioned/next/tasks/comms-adapter-twilio-verify.md +0 -19
- package/dist/docs/versioned/next/tasks/infra-mcp.md +0 -43
- package/dist/docs/versioned/next/tasks/native-module-baseline.md +0 -42
- package/dist/docs/versioned/next/tasks/orgs-and-teams.md +0 -70
- package/dist/docs/versioned/next/tasks/password-reset-and-email-verification.md +0 -60
- package/src/docs/upgrades/0.31.0.md +0 -60
- package/src/docs/versioned/next/explanation/deployment-architecture-gcp.md +0 -65
- package/src/docs/versioned/next/explanation/deployment-baseline.md +0 -78
- package/src/docs/versioned/next/explanation/positioning.md +0 -164
- package/src/docs/versioned/next/explanation/repository-settings.md +0 -44
- package/src/docs/versioned/next/explanation/roadmap-process.md +0 -330
- package/src/docs/versioned/next/explanation/roadmap-seed-issues.md +0 -866
- package/src/docs/versioned/next/how-to/build-for-web.md +0 -69
- package/src/docs/versioned/next/how-to/deploy-backend-to-cloud-run.md +0 -115
- package/src/docs/versioned/next/how-to/deploy-web-to-gcs-cdn.md +0 -183
- package/src/docs/versioned/next/implementationPlans/b2b-platform-program.md +0 -114
- package/src/docs/versioned/next/implementationPlans/billing-stripe.md +0 -158
- package/src/docs/versioned/next/implementationPlans/comms-abstraction.md +0 -240
- package/src/docs/versioned/next/implementationPlans/comms-adapter-expo-push.md +0 -107
- package/src/docs/versioned/next/implementationPlans/comms-adapter-sendgrid.md +0 -107
- package/src/docs/versioned/next/implementationPlans/comms-adapter-twilio-sms.md +0 -102
- package/src/docs/versioned/next/implementationPlans/comms-adapter-twilio-verify.md +0 -93
- package/src/docs/versioned/next/implementationPlans/infra-mcp-research.md +0 -188
- package/src/docs/versioned/next/implementationPlans/infra-mcp.md +0 -269
- package/src/docs/versioned/next/implementationPlans/native-module-baseline.md +0 -105
- package/src/docs/versioned/next/implementationPlans/orgs-and-teams.md +0 -158
- package/src/docs/versioned/next/implementationPlans/password-reset-and-email-verification.md +0 -147
- package/src/docs/versioned/next/reference/admin-spa.md +0 -130
- package/src/docs/versioned/next/reference/ai.md +0 -519
- package/src/docs/versioned/next/reference/test.md +0 -108
- package/src/docs/versioned/next/roadmap.md +0 -9
- package/src/docs/versioned/next/tasks/README.md +0 -42
- package/src/docs/versioned/next/tasks/billing-stripe.md +0 -75
- package/src/docs/versioned/next/tasks/comms-abstraction.md +0 -77
- package/src/docs/versioned/next/tasks/comms-adapter-expo-push.md +0 -29
- package/src/docs/versioned/next/tasks/comms-adapter-sendgrid.md +0 -29
- package/src/docs/versioned/next/tasks/comms-adapter-twilio-sms.md +0 -29
- package/src/docs/versioned/next/tasks/comms-adapter-twilio-verify.md +0 -19
- package/src/docs/versioned/next/tasks/infra-mcp.md +0 -43
- package/src/docs/versioned/next/tasks/native-module-baseline.md +0 -42
- package/src/docs/versioned/next/tasks/orgs-and-teams.md +0 -70
- package/src/docs/versioned/next/tasks/password-reset-and-email-verification.md +0 -60
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@terreno/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "56.0.0-beta.0",
|
|
4
4
|
"description": "MCP server for Terreno - provides documentation, tools, and prompts for building full-stack apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -27,18 +27,17 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@modelcontextprotocol/sdk": "^1.27.0",
|
|
29
29
|
"@sentry/bun": "^10.39.0",
|
|
30
|
-
"@terreno/api": "0.
|
|
30
|
+
"@terreno/api": "56.0.0-beta.0",
|
|
31
31
|
"minisearch": "^7.2.0",
|
|
32
|
-
"mongoose": "
|
|
32
|
+
"mongoose": "8.23.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@biomejs/biome": "^2.3.6",
|
|
36
36
|
"@types/bun": "^1.3.8",
|
|
37
37
|
"@types/node": "^25.3.0",
|
|
38
|
-
"typescript": "~
|
|
38
|
+
"typescript": "~6.0.3"
|
|
39
39
|
},
|
|
40
40
|
"files": [
|
|
41
|
-
"LICENSE",
|
|
42
41
|
"dist",
|
|
43
42
|
"src/docs"
|
|
44
43
|
],
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
+
/// <reference types="passport-local-mongoose" />
|
|
1
2
|
import type {APIErrorConstructor} from "@terreno/api";
|
|
2
3
|
import type mongoose from "mongoose";
|
|
3
|
-
import type {Document, Model} from "mongoose";
|
|
4
|
-
|
|
5
|
-
type ModelQuery<T> = Partial<Record<keyof T, unknown>> & Record<string, unknown>;
|
|
4
|
+
import type {Document, FilterQuery, Model} from "mongoose";
|
|
6
5
|
|
|
7
6
|
export interface DefaultStatics<T> {
|
|
8
7
|
findOneOrNone(
|
|
9
|
-
query:
|
|
8
|
+
query: FilterQuery<T>,
|
|
10
9
|
errorArgs?: Partial<APIErrorConstructor>
|
|
11
10
|
): Promise<(Document & T) | null>;
|
|
12
11
|
|
|
13
12
|
findExactlyOne(
|
|
14
|
-
query:
|
|
13
|
+
query: FilterQuery<T>,
|
|
15
14
|
errorArgs?: Partial<APIErrorConstructor>
|
|
16
15
|
): Promise<Document & T>;
|
|
17
16
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import FontAwesome from "@expo/vector-icons/FontAwesome";
|
|
2
|
-
import {DarkTheme, DefaultTheme, ThemeProvider} from "
|
|
2
|
+
import {DarkTheme, DefaultTheme, ThemeProvider} from "expo-router/react-navigation";
|
|
3
3
|
import {useFonts} from "expo-font";
|
|
4
4
|
import {Stack} from "expo-router";
|
|
5
5
|
import * as SplashScreen from "expo-splash-screen";
|
|
@@ -5,11 +5,9 @@ interface {{Name}}Document extends mongoose.Document {
|
|
|
5
5
|
{{interfaceFields}}
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
type ModelQuery<T> = Partial<Record<keyof T, unknown>> & Record<string, unknown>;
|
|
9
|
-
|
|
10
8
|
interface {{Name}}Model extends mongoose.Model<{{Name}}Document> {
|
|
11
|
-
findOneOrNone(query:
|
|
12
|
-
findExactlyOne(query:
|
|
9
|
+
findOneOrNone(query: mongoose.FilterQuery<{{Name}}Document>): Promise<{{Name}}Document | null>;
|
|
10
|
+
findExactlyOne(query: mongoose.FilterQuery<{{Name}}Document>): Promise<{{Name}}Document>;
|
|
13
11
|
}
|
|
14
12
|
|
|
15
13
|
const {{lowerName}}Schema = new mongoose.Schema<{{Name}}Document, {{Name}}Model>(
|
|
@@ -17,6 +17,7 @@ Documentation for the Terreno monorepo: shared packages for full-stack applicati
|
|
|
17
17
|
| [@terreno/api](reference/api.md) | REST API framework (Express/Mongoose) |
|
|
18
18
|
| [@terreno/ui](reference/ui.md) | React Native UI component library |
|
|
19
19
|
| [@terreno/rtk](reference/rtk.md) | RTK Query utilities for API backends |
|
|
20
|
+
| [@terreno/syncdb](reference/syncdb.md) | Local-first data layer (offline sync, conflicts) |
|
|
20
21
|
| [@terreno/admin-backend](reference/admin-backend.md) | Admin panel backend plugin |
|
|
21
22
|
| [@terreno/admin-frontend](reference/admin-frontend.md) | Admin panel frontend screens |
|
|
22
23
|
| [@terreno/api-health](reference/api-health.md) | Health check endpoint plugin |
|
|
@@ -2,19 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Understanding-oriented documentation: concepts, architecture, and context.
|
|
4
4
|
|
|
5
|
-
## Deployment
|
|
6
|
-
|
|
7
|
-
- [Deployment baseline](deployment-baseline.md) — seven requirements for production Terreno apps
|
|
8
|
-
- [GCP deployment architecture](deployment-architecture-gcp.md) — Cloud Run + GCS/CDN topology and tradeoffs
|
|
9
|
-
- [GCP hosting architecture](gcp-hosting-architecture.md) — static site hosting with GCS and Cloud CDN (legacy detail)
|
|
10
|
-
|
|
11
5
|
## Contents
|
|
12
6
|
|
|
13
7
|
- [AI-powered workflows](ai-workflows.md) — Autonomous documentation, testing, and maintenance workflows
|
|
14
8
|
- [Authentication architecture](authentication.md) — How JWT, OAuth, and token refresh work
|
|
15
9
|
- [Configuration system](configuration-system.md) — Runtime configuration with database persistence
|
|
16
10
|
- [Dependency management](dependency-management.md) — Dependabot, auto-merge, and security practices
|
|
11
|
+
- [GCP hosting architecture](gcp-hosting-architecture.md) — Static site hosting with GCS and Cloud CDN
|
|
17
12
|
- [Modular API design](modular-api-design.md) — 🚧 Why TerrenoApp replaces setupServer
|
|
18
13
|
- [modelRouter actions](model-router-actions.md) — Named collection and instance operations on modelRouter
|
|
19
14
|
- [No barrel imports](no-barrel-imports.md) — Import concrete modules, not `index` re-export barrels
|
|
20
|
-
- [Positioning](positioning.md) — Canonical copy blocks and the honest Django/Rails comparison
|
|
@@ -2,14 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Problem-oriented, practical steps. Use these when you know what you want to do.
|
|
4
4
|
|
|
5
|
-
## Deployment
|
|
6
|
-
|
|
7
|
-
- [Deployment baseline](../explanation/deployment-baseline.md) — seven requirements every host must satisfy
|
|
8
|
-
- [Build for web](build-for-web.md) — export static web bundle with correct API URL
|
|
9
|
-
- [Deploy to Google Cloud Platform](deploy-to-gcp.md) — index for GCP guides
|
|
10
|
-
- [Deploy backend to Cloud Run](deploy-backend-to-cloud-run.md) — container + Secret Manager + Cloud Run
|
|
11
|
-
- [Deploy web to GCS + CDN](deploy-web-to-gcs-cdn.md) — static hosting with SPA routing
|
|
12
|
-
|
|
13
5
|
## Contents
|
|
14
6
|
|
|
15
7
|
- [Create a Mongoose model](create-a-model.md) — Define models with proper conventions
|
|
@@ -17,6 +9,8 @@ Problem-oriented, practical steps. Use these when you know what you want to do.
|
|
|
17
9
|
- [Configure Better Auth](configure-better-auth.md) — Set up Better Auth with social OAuth (Google, GitHub, Apple)
|
|
18
10
|
- [Add WebSocket integration](websocket-integration.md) — Set up real-time Socket.io connections
|
|
19
11
|
- [Call external APIs](call-external-apis.md) — Authenticated HTTP client, retries, and error normalization for third-party integrations
|
|
12
|
+
- [Deploy to Google Cloud Platform](deploy-to-gcp.md) — Deploy demo and example apps to GCS with CDN
|
|
13
|
+
- [Migrate from @terreno/rtk to @terreno/syncdb](migrate-rtk-to-syncdb.md) — Move data sync to the local-first layer
|
|
20
14
|
|
|
21
15
|
## Coming Soon
|
|
22
16
|
|
|
@@ -1,36 +1,244 @@
|
|
|
1
1
|
# Deploy to Google Cloud Platform
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Learn how to deploy the Terreno demo and example-frontend apps to Google Cloud Storage with CDN-backed hosting.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Prerequisites
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Before you begin, ensure you have:
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- **GCP Project**: A Google Cloud Platform project with billing enabled
|
|
10
|
+
- **gcloud CLI**: [Installed and authenticated](https://cloud.google.com/sdk/docs/install)
|
|
11
|
+
- **Permissions**: Your GCP user or service account needs:
|
|
12
|
+
- `roles/storage.admin` (create buckets, set IAM)
|
|
13
|
+
- `roles/compute.loadBalancerAdmin` (create backend buckets, URL maps)
|
|
14
|
+
- `roles/compute.networkAdmin` (create IPs, proxies, forwarding rules)
|
|
15
|
+
- **GitHub Repository Access**: Admin access to configure secrets
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
|-------|----------------|
|
|
13
|
-
| [Deploy backend to Cloud Run](deploy-backend-to-cloud-run.md) | Container image, Secret Manager, Cloud Run with session affinity |
|
|
14
|
-
| [Deploy web to GCS + CDN](deploy-web-to-gcs-cdn.md) | Static web export, bucket + CDN setup, cache invalidation |
|
|
15
|
-
| [Build for web](build-for-web.md) | Export command, `EXPO_PUBLIC_API_URL`, local verification |
|
|
17
|
+
## Initial Infrastructure Setup
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
Run the setup script once to provision all GCP resources:
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
``````bash
|
|
22
|
+
# Clone the repository
|
|
23
|
+
git clone https://github.com/FlourishHealth/terreno.git
|
|
24
|
+
cd terreno
|
|
20
25
|
|
|
21
|
-
|
|
26
|
+
# Run the setup script
|
|
27
|
+
./scripts/setup-gcs-hosting.sh
|
|
28
|
+
``````
|
|
22
29
|
|
|
23
|
-
|
|
30
|
+
The script will prompt you for your service account email if `GCP_SA_KEY` is not set. It will create:
|
|
24
31
|
|
|
25
|
-
|
|
32
|
+
1. **GCS Buckets**: `flourish-terreno-terreno-demo` and `flourish-terreno-terreno-frontend-example`
|
|
33
|
+
2. **Public Access**: Configured with `allUsers:objectViewer`
|
|
34
|
+
3. **SPA Routing**: `notFoundPage=index.html` for client-side routing
|
|
35
|
+
4. **CDN Resources**:
|
|
36
|
+
- Backend buckets (CDN-enabled)
|
|
37
|
+
- URL maps
|
|
38
|
+
- Static IP addresses
|
|
39
|
+
- HTTP proxies
|
|
40
|
+
- Forwarding rules
|
|
26
41
|
|
|
27
|
-
|
|
42
|
+
### Script Output
|
|
28
43
|
|
|
29
|
-
|
|
44
|
+
At the end, the script outputs:
|
|
30
45
|
|
|
31
|
-
|
|
46
|
+
``````
|
|
47
|
+
=== Setup Complete ===
|
|
32
48
|
|
|
33
|
-
|
|
49
|
+
Demo:
|
|
50
|
+
CDN IP: 34.120.xxx.xxx
|
|
51
|
+
URL: http://34.120.xxx.xxx/
|
|
52
|
+
(Point your DNS A record to this IP)
|
|
34
53
|
|
|
35
|
-
|
|
36
|
-
|
|
54
|
+
Frontend Example:
|
|
55
|
+
CDN IP: 34.149.xxx.xxx
|
|
56
|
+
URL: http://34.149.xxx.xxx/
|
|
57
|
+
(Point your DNS A record to this IP)
|
|
58
|
+
``````
|
|
59
|
+
|
|
60
|
+
## Configure GitHub Secrets
|
|
61
|
+
|
|
62
|
+
Add the following secret to your GitHub repository:
|
|
63
|
+
|
|
64
|
+
### GCP_SA_KEY
|
|
65
|
+
|
|
66
|
+
1. Create a service account key:
|
|
67
|
+
``````bash
|
|
68
|
+
# Create service account
|
|
69
|
+
gcloud iam service-accounts create terreno-deploy \
|
|
70
|
+
--display-name="Terreno Deploy"
|
|
71
|
+
|
|
72
|
+
# Grant permissions
|
|
73
|
+
gcloud projects add-iam-policy-binding flourish-terreno \
|
|
74
|
+
--member="serviceAccount:terreno-deploy@flourish-terreno.iam.gserviceaccount.com" \
|
|
75
|
+
--role="roles/storage.objectAdmin"
|
|
76
|
+
|
|
77
|
+
gcloud projects add-iam-policy-binding flourish-terreno \
|
|
78
|
+
--member="serviceAccount:terreno-deploy@flourish-terreno.iam.gserviceaccount.com" \
|
|
79
|
+
--role="roles/compute.loadBalancerAdmin"
|
|
80
|
+
|
|
81
|
+
# Create JSON key
|
|
82
|
+
gcloud iam service-accounts keys create key.json \
|
|
83
|
+
--iam-account=terreno-deploy@flourish-terreno.iam.gserviceaccount.com
|
|
84
|
+
``````
|
|
85
|
+
|
|
86
|
+
2. Add the key to GitHub:
|
|
87
|
+
- Go to **Settings** → **Secrets and variables** → **Actions**
|
|
88
|
+
- Click **New repository secret**
|
|
89
|
+
- Name: `GCP_SA_KEY`
|
|
90
|
+
- Value: Paste the entire contents of `key.json`
|
|
91
|
+
- Click **Add secret**
|
|
92
|
+
|
|
93
|
+
3. Delete the local key file:
|
|
94
|
+
``````bash
|
|
95
|
+
rm key.json
|
|
96
|
+
``````
|
|
97
|
+
|
|
98
|
+
## Deploy to Production
|
|
99
|
+
|
|
100
|
+
Production deployments happen automatically when you push to the `master` branch:
|
|
101
|
+
|
|
102
|
+
``````bash
|
|
103
|
+
# Make changes to demo or example-frontend
|
|
104
|
+
git checkout master
|
|
105
|
+
git pull
|
|
106
|
+
# ... make changes ...
|
|
107
|
+
git add .
|
|
108
|
+
git commit -m "Update demo UI"
|
|
109
|
+
git push origin master
|
|
110
|
+
``````
|
|
111
|
+
|
|
112
|
+
The workflows will:
|
|
113
|
+
1. Build the app with Bun and Expo
|
|
114
|
+
2. Upload the build artifact
|
|
115
|
+
3. Sync assets to GCS with cache headers:
|
|
116
|
+
- Hashed assets: `Cache-Control: public, max-age=31536000, immutable`
|
|
117
|
+
- `index.html`: `Cache-Control: no-cache, no-store, must-revalidate`
|
|
118
|
+
4. Invalidate the CDN cache
|
|
119
|
+
|
|
120
|
+
### Triggered Workflows
|
|
121
|
+
|
|
122
|
+
| App | Workflow | Triggers on paths |
|
|
123
|
+
|-----|----------|-------------------|
|
|
124
|
+
| Demo | `demo-deploy.yml` | `demo/**`, `ui/**` |
|
|
125
|
+
| Example Frontend | `frontend-example-deploy.yml` | `example-frontend/**`, `ui/**`, `rtk/**` |
|
|
126
|
+
|
|
127
|
+
## Deploy PR Previews
|
|
128
|
+
|
|
129
|
+
Pull request previews deploy automatically when you open a PR that modifies the relevant paths:
|
|
130
|
+
|
|
131
|
+
``````bash
|
|
132
|
+
# Create a feature branch
|
|
133
|
+
git checkout -b feature/new-component
|
|
134
|
+
|
|
135
|
+
# Make changes
|
|
136
|
+
# ... edit files ...
|
|
137
|
+
|
|
138
|
+
git add .
|
|
139
|
+
git commit -m "Add new component"
|
|
140
|
+
git push origin feature/new-component
|
|
141
|
+
|
|
142
|
+
# Open a pull request on GitHub
|
|
143
|
+
``````
|
|
144
|
+
|
|
145
|
+
The workflow will:
|
|
146
|
+
1. Build the app with a preview-specific `baseUrl`
|
|
147
|
+
2. Deploy to `gs://BUCKET/_previews/pr-{number}/`
|
|
148
|
+
3. Create GitHub deployment with a preview URL
|
|
149
|
+
4. Comment on the PR with the preview link
|
|
150
|
+
|
|
151
|
+
### Preview URLs
|
|
152
|
+
|
|
153
|
+
Previews are accessible at:
|
|
154
|
+
- **Demo**: `http://{CDN_IP}/_previews/pr-{number}/` (or `https://storage.googleapis.com/flourish-terreno-terreno-demo/_previews/pr-{number}/` if CDN is not configured)
|
|
155
|
+
- **Example Frontend**: `http://{CDN_IP}/_previews/pr-{number}/` (or `https://storage.googleapis.com/flourish-terreno-terreno-frontend-example/_previews/pr-{number}/`)
|
|
156
|
+
|
|
157
|
+
### Preview Cleanup
|
|
158
|
+
|
|
159
|
+
When you close or merge a PR, the `preview-cleanup.yml` workflow automatically:
|
|
160
|
+
- Deletes preview files from both buckets
|
|
161
|
+
- Deactivates GitHub deployments
|
|
162
|
+
|
|
163
|
+
## Manual Deployment
|
|
164
|
+
|
|
165
|
+
To deploy manually without GitHub Actions:
|
|
166
|
+
|
|
167
|
+
``````bash
|
|
168
|
+
# Demo
|
|
169
|
+
cd demo
|
|
170
|
+
bun install
|
|
171
|
+
bun run compile
|
|
172
|
+
bun run export
|
|
173
|
+
gsutil -m -h "Cache-Control:public, max-age=31536000, immutable" \
|
|
174
|
+
rsync -r -d -x '.*\.html$' \
|
|
175
|
+
dist/ gs://flourish-terreno-terreno-demo/
|
|
176
|
+
gsutil -h "Cache-Control:no-cache, no-store, must-revalidate" \
|
|
177
|
+
cp dist/index.html gs://flourish-terreno-terreno-demo/index.html
|
|
178
|
+
|
|
179
|
+
# Invalidate CDN
|
|
180
|
+
gcloud compute url-maps invalidate-cdn-cache terreno-demo-url-map \
|
|
181
|
+
--path "/*" --async
|
|
182
|
+
|
|
183
|
+
# Example Frontend
|
|
184
|
+
cd example-frontend
|
|
185
|
+
bun install
|
|
186
|
+
bun run compile
|
|
187
|
+
bun run export
|
|
188
|
+
gsutil -m -h "Cache-Control:public, max-age=31536000, immutable" \
|
|
189
|
+
rsync -r -d -x '.*\.html$' \
|
|
190
|
+
dist/ gs://flourish-terreno-terreno-frontend-example/
|
|
191
|
+
gsutil -h "Cache-Control:no-cache, no-store, must-revalidate" \
|
|
192
|
+
cp dist/index.html gs://flourish-terreno-terreno-frontend-example/index.html
|
|
193
|
+
|
|
194
|
+
# Invalidate CDN
|
|
195
|
+
gcloud compute url-maps invalidate-cdn-cache terreno-frontend-example-url-map \
|
|
196
|
+
--path "/*" --async
|
|
197
|
+
``````
|
|
198
|
+
|
|
199
|
+
## Troubleshooting
|
|
200
|
+
|
|
201
|
+
### Build Fails with "Module not found"
|
|
202
|
+
|
|
203
|
+
**Problem**: Workspace dependencies not compiled.
|
|
204
|
+
|
|
205
|
+
**Solution**: Run `bun run compile` in `ui/` and `rtk/` before building the app.
|
|
206
|
+
|
|
207
|
+
### Preview URL Returns 404
|
|
208
|
+
|
|
209
|
+
**Problem**: CDN's `notFoundPage` serves root `index.html`, not the preview's.
|
|
210
|
+
|
|
211
|
+
**Solution**: The deploy workflow uploads "bare" route objects. Check that the workflow completed successfully.
|
|
212
|
+
|
|
213
|
+
### CDN Shows Stale Content
|
|
214
|
+
|
|
215
|
+
**Problem**: CDN cache not invalidated.
|
|
216
|
+
|
|
217
|
+
**Solution**: Run cache invalidation manually:
|
|
218
|
+
``````bash
|
|
219
|
+
gcloud compute url-maps invalidate-cdn-cache URLMAP_NAME --path "/*" --async
|
|
220
|
+
``````
|
|
221
|
+
|
|
222
|
+
### Permission Denied on gsutil
|
|
223
|
+
|
|
224
|
+
**Problem**: Service account lacks permissions.
|
|
225
|
+
|
|
226
|
+
**Solution**: Grant `roles/storage.objectAdmin`:
|
|
227
|
+
``````bash
|
|
228
|
+
gsutil iam ch "serviceAccount:SA_EMAIL:objectAdmin" gs://BUCKET_NAME
|
|
229
|
+
``````
|
|
230
|
+
|
|
231
|
+
### SPA Routes Return 404 on Refresh
|
|
232
|
+
|
|
233
|
+
**Problem**: Bucket not configured with `notFoundPage`.
|
|
234
|
+
|
|
235
|
+
**Solution**: Run the setup script or manually configure:
|
|
236
|
+
``````bash
|
|
237
|
+
gsutil web set -e index.html gs://BUCKET_NAME
|
|
238
|
+
``````
|
|
239
|
+
|
|
240
|
+
## Next Steps
|
|
241
|
+
|
|
242
|
+
- [GCP Hosting Architecture](../explanation/gcp-hosting-architecture.md) — Understand the design
|
|
243
|
+
- [Environment Variables Reference](../reference/environment-variables.md) — Configure runtime settings
|
|
244
|
+
- [Set up CI/CD pipelines](../how-to/README.md) — Automate testing and deployment
|