examples/framework-nextjs-app-directory/README.md
Keystone can be used as a data engine in Next.js applications without having to host a separate Keystone server.
This is made possible by Keystone's getContext API.
getStaticProps or getServerSideProps to CRUD data. ⚡️Note: Since you are not starting the keystone server, the Admin UI will not be available. You can host Keystone as a separate server if you need Admin UI.
[email protected], password is passw0rd.pnpm next:dev is all you need to develop your Next.js app. You don't need to start the keystone server since getContext will work without starting the Keystone server.pnpm keystone:dev or pnpm keystone:build just once after making changes to your lists. Alternatively you can open two terminal tabs and run both pnpm keystone:dev and pnpm next:dev concurrently during development.pnpm keystone:build once to make sure you have the latest schema files built for getContext API.Admin UI needs the Keystone server to run. Your Next.js app runs on a Next.js server. Keystone's Admin UI runs on Keystone server. You can't have two servers running in a Next.js production environment. Since we are not starting the Keystone server in production builds, we won't have access to Keystone's Admin UI. You can access it in local (use the command pnpm keystone:dev) because you can easily start two servers in your local but once you deploy your Next.js app you won't have access to the Admin UI.
Easy. Deploy twice to two different servers.
Both these apps connect to the same database and are built with the same source code so everything will work as you expect it to.
Deploy this example to Vercel and see it for yourself.