Example stacks
Trestle is the backend platform, not the frontend framework. Choose the client and server shape that fits your product while keeping credentials in the correct trust zone.
React, Vue or Svelte single-page app
Use application-user credentials directly from the browser. Keep refresh material in the safest storage your architecture permits, apply collection rules to every operation, and never ship service credentials in the bundle. A small same-origin session broker is preferable when you need HttpOnly cookies.
const response = await fetch(`${TRESTLE_URL}/api/v1/collections/issues/records`, {
headers: {Authorization: `Bearer ${accessToken}`}
});
const {items, nextCursor} = await response.json();
Next.js, Nuxt or SvelteKit
Keep the Trestle service secret on the framework server. Server-render protected data, perform trusted mutations through server actions/routes, and issue a separate application-user session when the browser must subscribe directly to user-scoped realtime events.
// Server-only route
const issues = await fetch(`${TRESTLE_URL}/api/v1/collections/issues/records`, {
headers: {Authorization: `Bearer ${process.env.TRESTLE_SERVICE_TOKEN}`}
});
Go, Node, Python or .NET backend
Use one service account per workload and environment. Your service can own domain-specific orchestration while Trestle handles persistence, files, audit and event delivery. Pass request IDs across the boundary and keep scopes narrow.
Mobile application
Store refresh credentials in Keychain or Android Keystore, rotate them atomically, and keep short-lived access tokens in memory where practical. Resume paginated lists with cursors and reconnect SSE after network changes.
Static site plus serverless functions
Use provider functions as a credential boundary for contact forms, private content or administrative actions. Public read-only data may be exposed through tightly constrained collection rules; privileged writes should remain server-side.
Automation-heavy system
Make handlers idempotent by delivery/event ID. Webhooks suit arbitrary HTTPS services; Lambda suits AWS-hosted asynchronous functions. Neither path should treat provider acceptance as proof that downstream work completed.
Repository layout
my-product/
├── apps/web/ # React, Vue, Svelte, Next, Nuxt, etc.
├── services/domain-api/ # optional trusted domain layer
├── infrastructure/ # Trestle config, proxy and deployment manifests
├── scripts/schema/ # repeatable collection/bootstrap requests
└── .env.example # names only; never real secretsKeep Trestle data outside the source tree in deployments, back it up as an operational asset, and use separate credentials for development, staging and production.