This is a template for NodeJS projects with Express and React, using Webpack for the frontend. 🚀
-
Clone the repository:
git clone https://github.com/RodnyE/node-react-template.git
-
Rename the
buildDependencies
property inpackage.json
todevDependencies
. -
Install the dependencies:
npm install
-
Start the development server:
npm test
The project structure is as follows:
src/
: Contains the frontend React code.serv/
: Contains the backend NodeJS code.public/
: Contains the static files served by Express.dist/
: Contains the bundled files generated by Webpack.
webpack.config.js
: Webpack configuration file..babelrc
: Babel configuration file.postcss.config.js
: PostCSS configuration file.
- NodeJS
- Express
- React
- Webpack and related plugins (listed in
buildDependencies
inpackage.json
)
To start the development server:
npm test
This command will run both the backend server and the frontend development build using Webpack. Any changes made in the code will automatically trigger a rebuild.
To build the project for production:
npm run build
This command will generate the optimized production build in the dist/
directory.
To start the production server:
npm start
Make sure to set the appropriate environment variables in a .env
file or in your hosting environment.
Feel free to contribute to this project by creating issues or submitting pull requests. Your contributions are highly appreciated.