A Mastra v1 general chat agent running on Fireworks-hosted GLM 5.2, with conversation memory in Prisma Postgres, deployed to Prisma Compute.
- Mastra v1 for the agent runtime and HTTP server.
- Fireworks AI GLM 5.2 (
accounts/fireworks/models/glm-5p2) as the model, via@ai-sdk/fireworks. - Prisma Postgres as the storage backend for agent memory and telemetry, via
@mastra/pg. - Prisma Compute as the deployment target.
- Bun as the runtime and script runner, pnpm for package management.
- src/mastra/index.ts registers the Mastra instance, storage, and logger.
- src/mastra/agents/chat-agent.ts defines the chat agent.
- src/mastra/storage.ts wires
PostgresStoretoDATABASE_URL. - scripts/chat.ts is a Bun smoke test for the agent.
- prisma.compute.ts configures the Compute deployment.
Copy .env.example to .env and fill in:
FIREWORKS_API_KEYfrom fireworks.ai.DATABASE_URL, a Prisma Postgres direct connection string (db.prisma.io, not the pooled endpoint, because the store runs DDL on first boot).
pnpm installpnpm devstarts Mastra Studio + the REST API onhttp://localhost:4111.pnpm chat "your message"runs a one-shot chat through the agent.
pnpm build runs mastra build, producing a self-contained Hono server in
.mastra/output/. Run it with node .mastra/output/index.mjs.
Mastra is deployed as a generic bun app. Compute runs the build.command
from prisma.compute.ts (mastra build), then bundles the
resulting .mastra/output/index.mjs entry with its Bun bundler.
pnpm dlx @prisma/cli@latest auth login(browser flow).- Set the deployed app's env vars (
DATABASE_URL,FIREWORKS_API_KEY). pnpm dlx @prisma/cli@latest app deployfor a preview, orapp deploy --prod --yesfor production.
DATABASE_URL must be set and reachable at deploy time: storage initialises
eagerly on boot and the server will not start without it.