Package Next.js website with Tauri
One approach is the monorepo strategy, where shared components are placed in a standalone shared project. This can be used in both the Tauri frontend project and Next.js. You will have 4 projects: 1. a shared project containing common libraries and components; 2. a Next.js project; 3. a Tauri frontend project; 4. a src-tauri project, written in Rust.
Another approach is to package your Next.js project as an SSG site, also known as a static export. This allows you to write your Tauri frontend directly within the same project. However, you cannot use server actions, API routes, edge functions, etc.; server actions should be replaced by API routes, as they are not supported in static exports. The Next.js output type should be set to export based on whether it's a Tauri build. You can still access the API routes deployed to an external server in the Tauri native app.
I like the second approach as you don't need to reorganize your project structure and only need to have two separate folders: src for nextjs; src-tauri for rust code.
written with minim.