1.3.0 • Published 4 years ago

boiler-room-app v1.3.0

Weekly downloads
10
License
MIT
Repository
github
Last release
4 years ago

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
1.2.0

4 years ago

1.3.0

4 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago