How can i set a Nextjs page as the default homepage for my erpnext?

I have tried building the files in the templates folder and added it to the hooks.py but it gives me a render error.
Need step by step. Thank you

This is a non-trivial setup. I would try putting it inside the www folder of your custom app. Very likely you will have to add a custom process controller in supervisor.conf for it to work in production and probably an entry in the Procfile for it to run in a development environment. In hooks.py what I would do is route from your app/homepage to /homepage.

I’m interested in solving the same sort of problem using Nuxt.

Thanks for this. I have tried putting it inside the www folder and added the route in hooks.py however I’m kinda lost in the next step. Would you expound on the custom process controller in supervisor.conf?

I tried putting a sample page in html and it was successfully read but pages in nextjs or js files cannot be read.

Sure. Next/Nuxt is a server process written in node/ TS. It benefits from being run in concert with the other frappe processes. You would want to to start and stop with other bench processes. If you examine the way Frappe run the socketio server, you can setup a similar workflow. I gotcha I recently solved was that if you’re using nvm to manage your node version, you need to set an alias to node for this process to run in the latest version: nvm alias node 20.

[program:frappe-bench-node-socketio]
command=node /home/{frappe-user}/frappe-bench/apps/frappe/socketio.js
priority=4
autostart=true
autorestart=true
stdout_logfile=/home/{frappe-user}/frappe-bench/logs/node-socketio.log
stderr_logfile=/home/{frappe-user}/frappe-bench/logs/node-socketio.error.log
user={frappe-user}
directory=/home/{frappe-user}/frappe-bench
startretries=10

Replace the command line with the start command for next. For Nuxt it would be something like this, but I haven’t tested it.

command=nuxi /home/{frappe-user}/frappe-bench/apps/{custom-app}/www/

I am also not an expert on deploying node applications, so this may not be the right way to to it production, so take this as a starting point rather than a solution.