← Next.js View source for Next.js You do not have permission to edit this page, for the following reason: The action you have requested is limited to users in the group: Users. You can view and copy the source of this page. = Next.js = If you use Node.js, we strongly recommend that you [https://heliohost.org/dashboard/load/ monitor your site load here]. Node apps often require a lot of server resources, and exceeding the account load limits will cause your user account to be [[:Suspension_Policy#High_Server_Usage|suspended for high server usage]]. = About Next.js = [https://nextjs.org/ Next.js] is a popular full stack framework for [[:Node.js|Node.js]], it utilizes React for frontend and is packed with awesome features like server-side rendering. It also includes API routes and much more. = Node.js Server Resource Usage = If you use Node.js, we strongly recommend that you [https://heliohost.org/dashboard/load/ monitor your site load here]. Node apps often require a lot of server resources, and exceeding the account load limits will cause your user account to be [[:Suspension_Policy#High_Server_Usage|suspended for high server usage]]. = Setup = Go into your project root (if you don't have a project, learn how to create one [https://nextjs.org/learn/basics/create-nextjs-app here]) Create a new file called `start.js` and put this inside: <pre> const path = require('path'); const nextPath = path.join(__dirname, 'node_modules', '.bin', 'next'); process.argv.length = 1; process.argv.push(nextPath, 'start'); require(nextPath); </pre> = Server setup = Upload all your files to your Tommy server. Then go to the Node.js section and set the following: * Node.js Version: At least 14.21.0 (though we highly recommend using the latest one: `17.9.1`) * Application Root: / (Folder where you uploaded your next project, we recommend `/`) * Application Startup File: `start.js` (the file created earlier) * Custom environment variables: `PORT = 8888` * Optionally: Custom environment variables: `NODE\_ENV = production` = Starting the server = Once all of the above steps are done, you can press the `Enable Node.js` button. Then you need to press the `NPM install` button. And then `Run script`, Script name: `build` After that finishes, you will need to wait '''up to 2 hours''' for the server to update. Node.js application deployment can take '''up to 2 hours''' to go into effect as it requires an Apache restart. After an entire 2 hours, if your Node app is not working for you, please [[:Clear_Your_Cache|clear your web browser cache]]. Template used on this page: Template:Caution (view source) Return to Next.js.