boiler-room-app v1.3.0
Boiler Room App
Create MERN (Mongo, Express, React, Node) applications on the command line.
Boiler Room App creates production ready boilerplate MERN applications āļø
Quickstart ā”
Install:
npm install -g boiler-room-app
Once installed, navigate to your chosen directory and run:
boiler-room-app --init myGreatApp
That's all there is to it.
To run your app:
cd myGreatApp
npm run dev
The client will automatically launch on port 3000
and the server on port 5000
Usage š
Supported project types
After running boiler-room-app init myGreatApp
you will be prompted to choose a project type:
React, Node, Express, MongoDB
This creates a full MERN application ready to connect to a MongoAtlas database. See here to set up a MongoAtlas account and obtain your connection string.
React, Node, Express (no database)
This creates the same application as above without the additional code required to connect to MongoDB. This template is perfect to choose if connecting to a different database.
Node, Express, MongoDB
This creates a production ready API application ready to connect to a MongoAtlas database. See here to set up a MongoAtlas account and obtain your connection string.
Environment variables
Once the app is created, create a .env
file in the root of your new project and add the following:
// .env
NODE_ENV = development
DB_URI = mongoAtlasConnectionString // note only add this variable if running the defualt with database project template.
Additional commands
Start the development server and client concurrently:
npm run dev
Start only the server:
npm run server
Start only the client:
npm run client
Bundle the client app into static files for production:
npm run build
Deploying to production
If the application template contains a client folder:
Run
npm run build
This generates a build folder of static assets in the client directory.
Set NODE_ENV
to production
This instructs the express application to serve the newly generated static client files as per:
// server.js file
if (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'staging') {
app.use(express.static(path.join(__dirname, 'client/build')));
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname, 'client/build', 'index.html'));
});
};
What's included? š
Each project type contains a sample API call. This can be viewed in both the client console and server console.
The express application is structured Route > Controller > Service
Logging is handled by winston
Both the client and server support hot reloads when working in development
Contributing š¤¼
Boiler Room App welcomes PRs
Folder structure š
MERN
.
āāā client/
ā āāā public/
ā ā āāā favicon.ico
ā ā āāā index.html
ā ā āāā manifest.json
ā ā āāā robots.txt
ā āāā src/
ā ā āāā Routes/
ā ā ā āāā Home/
ā ā ā āāā Home.js
ā ā āāā App.css
ā ā āāā App.js
ā ā āāā App.test.js
ā ā āāā index.css
ā ā āāā index.js
ā āāā .gitignore
ā āāā package.json
āāā config/
ā āāā configVariables/
ā ā āāā index.js
ā āāā constants/
ā ā āāā index.js
ā āāā database/
ā āāā index.js
āāā controllers/
ā āāā v1/
ā āāā sampleControllers/
ā ā āāā sample.js
ā āāā sample.controller.js
āāā routes/
ā āāā api/
ā āāā v1/
ā āāā index.js
ā āāā sampleRoutes.js
āāā services/
ā āāā v1/
ā āāā sampleServices/
ā ā āāā sample.js
ā āāā sample.service.js
āāā utils/
ā āāā error/
ā ā āāā index.js
ā āāā logger/
ā āāā index.js
āāā .env
āāā .gitignore
āāā package.json
āāā server.js
React, Node, Express (no database)
.
āāā client/
ā āāā public/
ā ā āāā favicon.ico
ā ā āāā index.html
ā ā āāā manifest.json
ā ā āāā robots.txt
ā āāā src/
ā ā āāā Routes/
ā ā ā āāā Home/
ā ā ā āāā Home.js
ā ā āāā App.css
ā ā āāā App.js
ā ā āāā App.test.js
ā ā āāā index.css
ā ā āāā index.js
ā āāā .gitignore
ā āāā package.json
āāā config/
ā āāā configVariables/
ā ā āāā index.js
ā āāā constants/
ā ā āāā index.js
āāā controllers/
ā āāā v1/
ā āāā sampleControllers/
ā ā āāā sample.js
ā āāā sample.controller.js
āāā routes/
ā āāā api/
ā āāā v1/
ā āāā index.js
ā āāā sampleRoutes.js
āāā services/
ā āāā v1/
ā āāā sampleServices/
ā ā āāā sample.js
ā āāā sample.service.js
āāā utils/
ā āāā error/
ā ā āāā index.js
ā āāā logger/
ā āāā index.js
āāā .env
āāā .gitignore
āāā package.json
āāā server.js