The what and why of wrapping a NextJS client with `@keystone-alpha/app-next`.
See original GitHub issueThe Custom Server section of the KS5 docs mention @keystone-alpha/app-next
for serving a Next.js App on the same server as the API.
What attracted me to this was simplifying my app by maintaining a single NodeJS server.
- Why else would I want to do this?
- What would I gain or lose from doing this?
I’m happy to be pointed to any insightful resources.
I tried digging around the source code and found that app-next
provides a wrapper for Keystone app.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Advanced Features: Custom `App` - Next.js
Control page initialization and add a layout that persists for all pages by overriding the default App component used by Next.js.
Read more >@keystonejs/app-next - npm
Start using @keystonejs/app-next in your project by running `npm i ... A KeystoneJS app for serving a Next.js application.
Read more >What's New in Next.js 13 - AppSignal Blog
Let's explore the new features and improvements in Next.js 13. ... Additional JavaScript will only be added as client-side interactivity is ...
Read more >Next.js 13: Working with the new app directory - LogRocket Blog
tsx is an optional file that you can create within any directory inside the app folder. It automatically wraps the page inside of...
Read more >What's new in Next.js 13, and what do they really do?
jsx be a Server Component that wraps your client provider…that wraps children/UI in turn. 3. Your favorite UI Library might not work. Server...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Great question!
The entire
app-*
ecosystem within KeystoneJS is based around the idea of deploying everything to a single server.This is by far not the only way to deploy things, and so comes with some trade-offs:
Pros
app
s in the futureCons
app-static
app, there’s no way to deploy your static assets to a globally cached CDN.You should only use
app
s (other than the graphql app) when you’re comfortable with the above trade-offs. If you grow beyond that, you can eject out of theapp
ecosystem and setup your own hosting and deployment pipeline to reap the benefits you desire.Yes you’re right - they’d still be within the same node process. The
next-app
is just a thin wrapper over doing a custom server.It sounds like you want to keep your Next & Keystone apps running independently; they’d have their own
"start"
commands, be deployed separately, have their own logging and monitoring, etc.For example, you might deploy your Keystone app to https://api.example.com, then in your Next app set up the GraphQL client to have
uri: "https://api.example.com"
, and be deployed to https://www.example.com