FAQ
Frequently asked questions about next-forge
Why don’t you use trpc?
While tRPC is a great tool for building type-safe APIs, Next.js Server Actions provide similar benefits with tighter framework integration. This native solution reduces complexity while maintaining the type safety that makes tRPC attractive. Since Server Actions are part of the framework itself, they’re also likely to receive continued optimization and feature improvements directly from the Next.js team.
Why did you pick X as the default tool instead of Y?
The default next-forge tooling was chosen by myself after having used them in numerous production applications. It doesn’t mean they’re the best tools, it means they’re the ones that helped me launch quickly. Tools and tastes change over time and it’s inevitable that the defaults will change at some point.
That being said, if you really believe tool Y is a much better choice than tool X, feel free to start up a conversation with me on X and we can hash it out!
Why does apps/web
have a prebuild
script?
The website has a prebuild script in order to use the Content Collections CLI directly. The files are cached and not rebuilt in the Next.js build process. This is a workaround for this issue.
Why is there a suppressHydrationWarning
on every html
tag?
This is the recommendation by next-themes
to supress the warning stemming from determining theme on the client side.
Why are there unused dependencies like import-in-the-middle
?
Without these packages, Turbopack throws warnings highlighting cases where packages are being used but are not installed so it can fail when running in production.
This was already an issue when we were using Webpack, it just never warned us that it was missing. This can be fixed by installing the external packages into the project itself.
Why is the api
separate from the web
app?
The API is separated from the web app for two reasons:
- To isolate functions that are not part of the main user-facing application i.e. background jobs, cron jobs, webhooks, etc.
- To provide a dedicated endpoint for non-web applications e.g. mobile apps, smart home devices, etc.
Functionally speaking, it doesn’t matter as much if you’re running these projects on Vercel. Serverless functions are all independent pieces of infrastructure and can scale independently.