Cloud Providers
Standalone Mastra applications can be deployed to popular cloud providers, see one of the following guides for more information:
For self-hosted Node.js server deployment, see the Creating A Mastra Server guide.
Prerequisites
Before deploying to a cloud provider, ensure you have:
- A Mastra application
- Node.js
v20.0
or higher - A GitHub repository for your application (required for most CI/CD setups)
- Domain name management access (for SSL and HTTPS)
- Basic familiarity with server setup (e.g. Nginx, environment variables)
LibSQLStore
LibSQLStore
writes to the local filesystem, which is not supported in cloud environments that use ephemeral file systems. If you’re deploying to platforms like AWS Lambda, Azure App Services, or Digital Ocean App Platform, you must remove all usage of LibSQLStore
.
Specifically, ensure you’ve removed it from both src/mastra/index.ts
and src/mastra/agents/weather-agent.ts
:
src/mastra/index.ts
export const mastra = new Mastra({
// ...
- storage: new LibSQLStore({
- // stores telemetry, evals, ... into memory storage, if it needs to persist, change to file:../mastra.db
- url: ":memory:",
- })
});
src/mastra/agents/weather-agent.ts
export const weatherAgent = new Agent({
// ..
- memory: new Memory({
- storage: new LibSQLStore({
- url: "file:../mastra.db" // path is relative to the .mastra/output directory
- })
- })
});