forge icon indicating copy to clipboard operation
forge copied to clipboard

Feature Request: Add Next.js Support to Electron Forge

Open vatsal-afk opened this issue 10 months ago • 2 comments

Pre-flight checklist

  • [x] I have read the contribution documentation for this project.
  • [x] I agree to follow the code of conduct that this project uses.
  • [x] I have searched the issue tracker for a feature request that matches the one I want to file, without success.

Problem description

Currently, Electron Forge provides templates for React, TypeScript, and Vite, but Next.js is not officially supported.Next.js can be used as the frontend for Electron apps due to its routing, API routes, and static generation capabilities. However, setting up Next.js with Electron Forge requires manual configurations and workarounds.

This proposal suggests adding an official Next.js template (@electron-forge/template-nextjs) to simplify integration.

Proposed solution

Add a new Forge template:
@electron-forge/template-nextjs

Alternatives considered

Manually configuring Next.js in Electron

Additional information

Would You Accept a PR?

If the maintainers support this, I’d be happy to help contribute an implementation. Let me know if there are any technical constraints or preferences for adding this!

vatsal-afk avatar Mar 16 '25 18:03 vatsal-afk

Current Next.js produces a server bundle along with client bundle which is served by the server. Are you proposing, running a nextjs server in the main process and creating a renderer window and open url localhost:3000 on it?

karmakarmeghdip avatar Aug 16 '25 13:08 karmakarmeghdip

I have already tried it, have put standalone bundle within resources and start the node server and loaded the server URL in window. it is working fine for Linux and mac; In windows server did not start.

vigneshwaran9494 avatar Dec 12 '25 04:12 vigneshwaran9494