Next.js + Database
Learn how to deploy a full-stack Next.js app with PostgreSQL using Ink MCP.
Create an Ink account and connect MCP
Make sure you have an Ink account and have connected Ink MCP to your agent. There are two ways to connect:
- OAuth — authenticate through a browser flow, no keys to manage
- Token — create an API key at ml.ink/account/api-keys
See Quick Start for full setup instructions.
Verify the connection
Once the MCP server is connected, confirm your agent can reach it by asking it to check.
Do you have Ink MCP connected?
Build the app
Ask your agent to build a Next.js app with a database. The agent will deploy a PostgreSQL database via template and build the app with server actions for data operations.
Build a Next.js app with a notes feature. Use server actions for the backend and connect to a PostgreSQL database on Ink for persistence. Include create, read, update, and delete operations.
Deploy with Ink
The agent deploys a PostgreSQL database via template first, then deploys the Next.js app with the database credentials as environment variables.
Deploy to Ink
template_deploy(
"slug": "postgresql",
"name": "notes-db"
)create_service(
"name": "notes-app",
"repo": "ink/notes-app",
"build_pack": "railpack",
"port": "3000",
"env_vars": {
"DATABASE_URL": "postgresql://user:pass@notes-db.ml.ink:5432/notes"
}
)Visit your app
Ink returns a live URL once the build completes. Your Next.js app is connected to a managed PostgreSQL database.
Check logs and metrics (optional)
Ask your agent to pull build logs, runtime logs, or metrics for your deployed service.
Check metrics and logs
That's it — your full-stack Next.js app is deployed with a managed database. From here you can add a custom domain, explore database templates, or explore more examples.