Next.js + Database
Learn how to deploy a full-stack Next.js app with PostgreSQL using Ink.
Create an Ink account and connect Ink
Make sure you have an Ink account and have set up Ink for your agent. Use the CLI, the Ink Skill, or MCP. For MCP auth, choose:
- OAuth — authenticate through a browser flow, no keys to manage
- Token — create an API key at deployink.com/account/api-keys
See Quick Start for full setup instructions.
Verify the connection
Once Ink is connected, confirm your agent can reach it by asking it to check.
Do you have Ink 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(
"template": "postgres",
"name": "notes-db"
)service_create(
"name": "notes-app",
"repo": "ink/notes-app",
"build_pack": "railpack",
"ports": {
"0": "[object Object]"
},
"env_vars": {
"0": "[object Object]"
}
)Visit your app
Ink returns a live URL once the build completes. Your Next.js app is connected to a template-backed PostgreSQL service with persistent storage.
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 PostgreSQL database template. From here you can add a custom domain, explore database templates, or explore more examples.