Deploy

Once you're ready to deploy to production it's time to hook up Alinea to a backend. Alinea exposes a handler that can be hosted on most Javascript runtimes (Node.js or edge/serverless functions). The handler needs access to a backend service that can authenticate users, store drafts and publish changes back to the git repository.

Create the CMS handler in the app folder.

app/api/cms/[...slug]/route.ts
import {cms} from '@/cms'

export const GET = cms.backendHandler
export const POST = cms.backendHandler

Update your CMS config to inform Alinea where the handler is located and where to generate the admin dashboard.

export const cms = createCMS({
  // schema and workspaces ...
  dashboard: {
    handlerUrl: '/api/cms',
    staticFile: 'public/admin.html',
    dashboardUrl: '/admin.html'
  }
})

Deploy your code and follow the instructions on /admin.html to configure your backend.