cra-template-electron-python-fastapi
This is a create-react-app (CRA) template for Electron-Python applications based on the official base template for Create React App.
Getting Started
Note that Python >3.6 is required for development.
To create a React-Electron-Python application and run it in dev mode, run:
npx create-react-app my-app --template electron-python-fastapi
cd my-app
python -m pip install virtualenv
python -m virtualenv venv
.\venv\Scripts\activate
python -m pip install -r requirements.txt
npm start
These commands will do the following:
- Create a React-Electron-Python application called
my-app
using the CRA electron-python-fastapi template. - Change the current directory to
my-app
- Launch the application in dev mode, with hot reloading and the Developer tools console installed with React DevTools extension
For more information on how to use CRA, see the Create React App docs.
Distribution
This template uses electron-builder to package and build a ready for distribution application for Windows, macOS and Linux.
To build the application, run:
npm run dist:win
npm run dist:mac
npm run dist:linux
These commands will generate distributables for Windows, macOS and Linux respectively. By default, the distributables will be in NSIS (Windows), dmg (macOS) and deb (linux) form.
Remember to change the author, description, build.appId and build.productName in package.json
before creating a distributable
React-Electron
For creating an application with only React and Electron, use the CRA electron-builder template.
npx create-react-app my-app --template electron-builder
cd my-app
npm start