Next.js Discord

Discord Forum

Needed files for selfhosting

Unanswered
American Sable posted this in #help-forum
Open in Discord
Avatar
American SableOP
Nextjs' documentation seems to be a bit sparse on how to self host my application.
After I run "npm run build" and the .next-folder is created, which files do I need to copy on my server?
I had the idea that the ".next"-folder is self contained, but I need at least the "node_modules" (for the next binary) and the package.json to be able to run "start".

1 Reply

Avatar
risky
you should either build on the server and run normaly, or use standalone and only need to make sure you have node for starting: https://nextjs.org/docs/app/api-reference/next-config-js/output#automatically-copying-traced-files