├── .eslintignore ├── .eslintrc.json ├── .gitignore ├── .prettierrc ├── LICENSE.md ├── README.md ├── index.html ├── package-lock.json ├── package.json ├── screenshot-1.png ├── src ├── declaration.d.ts ├── main │ └── main.ts └── renderer │ ├── components │ ├── App.tsx │ └── Greetings.tsx │ ├── index.tsx │ └── theme.tsx ├── static └── electron.svg ├── tsconfig.json └── webpack ├── electron.webpack.ts └── react.webpack.ts /.eslintignore: -------------------------------------------------------------------------------- 1 | */.js 2 | 3 | 4 | ### macOS ### 5 | # General 6 | .DS_Store 7 | .AppleDouble 8 | .LSOverride 9 | 10 | # Icon must end with two \r 11 | Icon 12 | 13 | # Thumbnails 14 | ._* 15 | 16 | # Files that might appear in the root of a volume 17 | .DocumentRevisions-V100 18 | .fseventsd 19 | .Spotlight-V100 20 | .TemporaryItems 21 | .Trashes 22 | .VolumeIcon.icns 23 | .com.apple.timemachine.donotpresent 24 | 25 | # Directories potentially created on remote AFP share 26 | .AppleDB 27 | .AppleDesktop 28 | Network Trash Folder 29 | Temporary Items 30 | .apdisk 31 | 32 | ### Node ### 33 | # Logs 34 | logs 35 | *.log 36 | npm-debug.log* 37 | yarn-debug.log* 38 | yarn-error.log* 39 | lerna-debug.log* 40 | 41 | # Diagnostic reports (https://nodejs.org/api/report.html) 42 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 43 | 44 | # Runtime data 45 | pids 46 | *.pid 47 | *.seed 48 | *.pid.lock 49 | 50 | # Directory for instrumented libs generated by jscoverage/JSCover 51 | lib-cov 52 | 53 | # Coverage directory used by tools like istanbul 54 | coverage 55 | *.lcov 56 | 57 | # nyc test coverage 58 | .nyc_output 59 | 60 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 61 | .grunt 62 | 63 | # Bower dependency directory (https://bower.io/) 64 | bower_components 65 | 66 | # node-waf configuration 67 | .lock-wscript 68 | 69 | # Compiled binary addons (https://nodejs.org/api/addons.html) 70 | build/Release 71 | 72 | # Dependency directories 73 | node_modules/ 74 | jspm_packages/ 75 | 76 | # Snowpack dependency directory (https://snowpack.dev/) 77 | web_modules/ 78 | 79 | # TypeScript cache 80 | *.tsbuildinfo 81 | 82 | # Optional npm cache directory 83 | .npm 84 | 85 | # Optional eslint cache 86 | .eslintcache 87 | 88 | # Microbundle cache 89 | .rpt2_cache/ 90 | .rts2_cache_cjs/ 91 | .rts2_cache_es/ 92 | .rts2_cache_umd/ 93 | 94 | # Optional REPL history 95 | .node_repl_history 96 | 97 | # Output of 'npm pack' 98 | *.tgz 99 | 100 | # Yarn Integrity file 101 | .yarn-integrity 102 | 103 | # dotenv environment variables file 104 | .env 105 | .env.test 106 | .env.local 107 | 108 | # parcel-bundler cache (https://parceljs.org/) 109 | .cache 110 | .parcel-cache 111 | 112 | # Next.js build output 113 | .next 114 | out 115 | 116 | # Nuxt.js build / generate output 117 | .nuxt 118 | dist 119 | 120 | packages 121 | 122 | # Gatsby files 123 | .cache/ 124 | # Comment in the public line in if your project uses Gatsby and not Next.js 125 | # https://nextjs.org/blog/next-9-1#public-directory-support 126 | # public 127 | 128 | # vuepress build output 129 | .vuepress/dist 130 | 131 | # Serverless directories 132 | .serverless/ 133 | 134 | # FuseBox cache 135 | .fusebox/ 136 | 137 | # DynamoDB Local files 138 | .dynamodb/ 139 | 140 | # TernJS port file 141 | .tern-port 142 | 143 | # Stores VSCode versions used for testing VSCode extensions 144 | .vscode-test 145 | 146 | # yarn v2 147 | .yarn/cache 148 | .yarn/unplugged 149 | .yarn/build-state.yml 150 | .yarn/install-state.gz 151 | .pnp.* 152 | 153 | ### vscode ### 154 | .vscode/* 155 | !.vscode/settings.json 156 | !.vscode/tasks.json 157 | !.vscode/launch.json 158 | !.vscode/extensions.json 159 | *.code-workspace 160 | 161 | # Local History for Visual Studio Code 162 | .history/ -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "@typescript-eslint/parser", 3 | "plugins": ["react", "@typescript-eslint"], 4 | "extends": [ 5 | "eslint:recommended", 6 | "plugin:react/recommended", 7 | "plugin:@typescript-eslint/recommended", 8 | "prettier" 9 | ], 10 | "env": { 11 | "browser": true, 12 | "es2020": true, 13 | "node": true 14 | }, 15 | "parserOptions": { 16 | "ecmaFeatures": { 17 | "jsx": true 18 | }, 19 | "ecmaVersion": 11, 20 | "sourceType": "module" 21 | }, 22 | "settings": { 23 | "react": { 24 | "version": "detect" 25 | } 26 | }, 27 | "rules": { 28 | "react/react-in-jsx-scope": 0, 29 | "react/display-name": 0, 30 | "react/prop-types": 0, 31 | "@typescript-eslint/explicit-function-return-type": 0, 32 | "@typescript-eslint/explicit-member-accessibility": 0, 33 | "@typescript-eslint/indent": 0, 34 | "@typescript-eslint/member-delimiter-style": 0, 35 | "@typescript-eslint/no-explicit-any": 0, 36 | "@typescript-eslint/no-var-requires": 0, 37 | "@typescript-eslint/no-use-before-define": 0, 38 | "@typescript-eslint/no-unused-vars": [ 39 | 2, 40 | { 41 | "argsIgnorePattern": "^_" 42 | } 43 | ], 44 | "no-console": [ 45 | 2, 46 | { 47 | "allow": ["warn", "error"] 48 | } 49 | ] 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### macOS ### 2 | # General 3 | .DS_Store 4 | .AppleDouble 5 | .LSOverride 6 | 7 | # Icon must end with two \r 8 | Icon 9 | 10 | # Thumbnails 11 | ._* 12 | 13 | # Files that might appear in the root of a volume 14 | .DocumentRevisions-V100 15 | .fseventsd 16 | .Spotlight-V100 17 | .TemporaryItems 18 | .Trashes 19 | .VolumeIcon.icns 20 | .com.apple.timemachine.donotpresent 21 | 22 | # Directories potentially created on remote AFP share 23 | .AppleDB 24 | .AppleDesktop 25 | Network Trash Folder 26 | Temporary Items 27 | .apdisk 28 | 29 | ### Node ### 30 | # Logs 31 | logs 32 | *.log 33 | npm-debug.log* 34 | yarn-debug.log* 35 | yarn-error.log* 36 | lerna-debug.log* 37 | 38 | # Diagnostic reports (https://nodejs.org/api/report.html) 39 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 40 | 41 | # Runtime data 42 | pids 43 | *.pid 44 | *.seed 45 | *.pid.lock 46 | 47 | # Directory for instrumented libs generated by jscoverage/JSCover 48 | lib-cov 49 | 50 | # Coverage directory used by tools like istanbul 51 | coverage 52 | *.lcov 53 | 54 | # nyc test coverage 55 | .nyc_output 56 | 57 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 58 | .grunt 59 | 60 | # Bower dependency directory (https://bower.io/) 61 | bower_components 62 | 63 | # node-waf configuration 64 | .lock-wscript 65 | 66 | # Compiled binary addons (https://nodejs.org/api/addons.html) 67 | build/Release 68 | 69 | # Dependency directories 70 | node_modules/ 71 | jspm_packages/ 72 | 73 | # Snowpack dependency directory (https://snowpack.dev/) 74 | web_modules/ 75 | 76 | # TypeScript cache 77 | *.tsbuildinfo 78 | 79 | # Optional npm cache directory 80 | .npm 81 | 82 | # Optional eslint cache 83 | .eslintcache 84 | 85 | # Microbundle cache 86 | .rpt2_cache/ 87 | .rts2_cache_cjs/ 88 | .rts2_cache_es/ 89 | .rts2_cache_umd/ 90 | 91 | # Optional REPL history 92 | .node_repl_history 93 | 94 | # Output of 'npm pack' 95 | *.tgz 96 | 97 | # Yarn Integrity file 98 | .yarn-integrity 99 | 100 | # dotenv environment variables file 101 | .env 102 | .env.test 103 | .env.local 104 | 105 | # parcel-bundler cache (https://parceljs.org/) 106 | .cache 107 | .parcel-cache 108 | 109 | # Next.js build output 110 | .next 111 | out 112 | 113 | # Nuxt.js build / generate output 114 | .nuxt 115 | dist 116 | 117 | packages 118 | 119 | # Gatsby files 120 | .cache/ 121 | # Comment in the public line in if your project uses Gatsby and not Next.js 122 | # https://nextjs.org/blog/next-9-1#public-directory-support 123 | # public 124 | 125 | # vuepress build output 126 | .vuepress/dist 127 | 128 | # Serverless directories 129 | .serverless/ 130 | 131 | # FuseBox cache 132 | .fusebox/ 133 | 134 | # DynamoDB Local files 135 | .dynamodb/ 136 | 137 | # TernJS port file 138 | .tern-port 139 | 140 | # Stores VSCode versions used for testing VSCode extensions 141 | .vscode-test 142 | 143 | # yarn v2 144 | .yarn/cache 145 | .yarn/unplugged 146 | .yarn/build-state.yml 147 | .yarn/install-state.gz 148 | .pnp.* 149 | 150 | ### vscode ### 151 | .vscode/* 152 | !.vscode/settings.json 153 | !.vscode/tasks.json 154 | !.vscode/launch.json 155 | !.vscode/extensions.json 156 | *.code-workspace 157 | 158 | # Local History for Visual Studio Code 159 | .history/ -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 HelloSoftware 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Electron, TypeScript, MUI (formerly Material-UI), React Boilerplate 2 | 3 | Modern and lightweight boilerplate built with electron, typescript, react, webpack, and mui. This also demonstrates live-reloading and static images. 4 | 5 |  6 | 7 | ## Major technologies 8 | 9 | - [React.js 18](https://reactjs.org/) 10 | - [Electron 19](https://www.electronjs.org/) 11 | - [MUI 5](https://mui.com/) (formerly Material-UI) 12 | - [Webpack 5](https://webpack.js.org/) 13 | - Typescript, ESLint, and Prettier are used to improve the developer experience 14 | 15 | ## Requires 16 | 17 | - [Node.js 16.x](https://nodejs.org/en/) 18 | - [NPM >= 7.x](https://github.com/npm/cli) 19 | 20 | ## Recommended tools 21 | 22 | - [Visual Studio Code](https://code.visualstudio.com/) 23 | - [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) (formatting) 24 | - [ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) (error checking) 25 | - [NVM](https://github.com/nvm-sh/nvm) (mac only. helps to manage multiple node.js versions on your machine) 26 | 27 | ## Getting Started 28 | 29 | 1. Download this repo or run the following command to clone it 30 | 31 | ```sh 32 | git clone https://github.com/hellosoftware-io/electron-typescript-react-material-ui myapp 33 | ``` 34 | 35 | 2. Navigate to the project root 36 | 37 | ```sh 38 | cd myapp 39 | ``` 40 | 41 | 3. Using NPM 7+, run the following command to install dependencies 42 | 43 | ```sh 44 | npm install 45 | ``` 46 | 47 | 4. Run the following command to build and start the development version of your app with live reloading. 48 | 49 | ```sh 50 | npm run dev 51 | ``` 52 | 53 | ## Packaging 54 | 55 | Run `npm run package` to build and package your electron app. 56 | 57 | ## Common issues 58 | 59 | ### xcrun: error: invalid active developer path 60 | 61 | This is caused when elecron-builder tries to sign a build. Run `xcode-select --install` to install the necessary Xcode tools. 62 | 63 | ## Folder structure 64 | 65 | ``` 66 | myapp/ 67 | | - dist/ //- Generated by Webpack automatically 68 | | - node_modules/ 69 | | - packages/ //- Generated by build script automatically 70 | | - static/ //- Global static assets 71 | | | - electron.svg 72 | | - src/ 73 | | | - main/ //- Backend modules for the Electron app 74 | | | | - main.ts //- Entry point of 'electron-main' 75 | | | - renderer/ //- Frontend React components for the Electron app 76 | | | | - index.tsx //- Entry point of 'electron-renderer' 77 | | - webpack/ //- Webpack config files 78 | | | - electron.webpack.ts 79 | | | - react.webpack.ts 80 | | - .eslintrc //- ESLint config 81 | | - .gitignore 82 | | - package-lock.json 83 | | - package.json 84 | | - tsconfig.json //- TypeScript config 85 | | - webpack.config.js //- Webpack config 86 | ``` 87 | 88 | ## Contributing 89 | 90 | Pull requests are always welcome 😃. 91 | 92 | ## License 93 | 94 | This project is licensed under the terms of the [MIT license](LICENSE). 95 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 |