Deployment
Build AdminKit for Next.js into a static export in out/ and deploy it to any static host with clean URLs, at the root or under a base path (BASE_PATH).
Build
npm run buildAdminKit for Next.js is a static export (output: "export" in next.config.ts): npm run build writes plain HTML, CSS and JavaScript to out/, one HTML file per page (out/index.html, out/pages-settings.html, ...) and the error page out/404.html. It needs no Node.js server. Check the build locally with npm start, which serves out/ at http://localhost:3000 the way a static host does.
Static hosting
Upload the contents of out/ to any static host. The pages link to each other without .html (/pages-settings), so the host has to serve pages-settings.html for /pages-settings (clean URLs), and 404.html for paths that do not exist.
Vercel
Import the repository and add a vercel.json that deploys out/ as static files with clean URLs:
{
"framework": null,
"buildCommand": "npm run build",
"outputDirectory": "out",
"cleanUrls": true
}Netlify
Set the build command to npm run build and the publish directory to out. Netlify serves pages-settings.html at /pages-settings and uses 404.html by default.
[build]
command = "npm run build"
publish = "out"nginx
server {
root /var/www/adminkit/out;
location / {
try_files $uri $uri.html $uri/ =404;
}
error_page 404 /404.html;
}Other hosts (Cloudflare Pages, GitHub Pages, an S3 bucket behind a CDN) work the same way: serve out/, map extensionless paths to their .html file, and use 404.html for the rest.
Base path
To serve the app from a sub-path such as https://example.com/admin/, set BASE_PATH when you build:
BASE_PATH=/admin npm run buildOr put BASE_PATH=/admin in a .env file (see .env.example). Links made with next/link and images written with asset() get the prefix. Upload out/ to the /admin/ folder of the host; npm start serves such a build under the same path.
Server features
The static export has no server, so route handlers, server actions, middleware and on-demand rendering are not available. To add them, remove output: "export" from next.config.ts and deploy to a host that runs Next.js (such as Vercel or a Node.js server with next start). The pages work either way: they render the same markup with demo data from src/mocks/.
Last updated on