Best approach to turn React + Express + MySQL web app into offline desktop application?

I built a web application using React frontend, Express backend, and MySQL database. Everything works fine when running on localhost during development.

My client wants to deploy this as a completely offline desktop application. They don’t want any internet connection or cloud services involved. The app needs to work on Windows, Mac, and Linux.

I’m considering two options:

Desktop App Packaging
Bundle everything into a single executable that users can install and run locally.

Local Installation Setup
Create an installer that sets up the backend server and database on the user’s machine.

What tools would work best for packaging a full-stack JavaScript app with database into a desktop application? Can I include the MySQL database and Node.js server inside the desktop package? What are the security considerations for running everything locally without internet access?

I undertook a similar project with a MERN stack application and encountered challenges with MySQL integration for a desktop environment. I recommend considering SQLite instead of MySQL, as it simplifies the deployment process; SQLite stores the data in a single file, making it much easier to manage. For the packaging process, using Electron along with electron-builder can streamline everything into a single executable installer, which can encapsulate your React frontend and Express backend seamlessly. Remember to implement proper database migration handling during initialization and consider a recovery solution for your database, as users may inadvertently delete files. Moreover, local security concerns shift slightly; while traditional authentication schemes may not be necessary, ensure rigorous input validation to mitigate risks associated with local file access.

Electron’s your best bet for packaging React + Express + MySQL into a desktop app. I’ve built this stack before and hit some database snags you’ll want to avoid. MySQL’s a pain to bundle since it needs separate installation and service management on each OS. I switched to an embedded database solution, but if you stick with MySQL, use a proper installer script that handles the database service setup automatically. Your biggest headache will be managing the Express server lifecycle in Electron - you need to start and stop your backend cleanly when the app opens and closes. Don’t forget automatic database backups since users won’t have typical server backup infrastructure. Watch out for port conflicts if users run other apps - implement dynamic port selection for Express. Security’s actually easier without network exposure, but validate all user inputs since they’ll have direct file system access.

check out tauri instead of electron - much smaller bundles and way better performance. you can still use your react frontend, but tauri’s desktop wrapper blows electron out of the water. mysql bundling across platforms is still gonna be a pain though.