Boilerplate app for full-stack MERN app with Create React App client tool chain. Includes React, JWT authentication, Mongoose/MongoDB, Apollo Server/Client, and ExpressJS.
serverdirectory to run locally. Use
server/.env.exampleas a template.
npm startscript: Production startup. Only runs backend server.
npm run developscript: Uses
concurrentlyto run the back-end with
nodemonand launches the
create-react-appdevelopment server for front-end development.
concurrentlyruns these within the same terminal. Logging is tagged with
npm run clientscript: Launches the
create-react-appdevelopment server for the client only. Will not start back-end.
npm run serverscript: Starts the back-end server with
nodemonfor easy development without launching the client.
npm installscript: Installs all dependencies for root as wells as
npm run buildscript: Runs
create-react-appbuild script to create client bundles and assets.
Deploying to Heroku
Requires a MongoDB server. MongoDB Atlas is a fairly easy choice for this requirement. Create an Atlas account and setup a database.
Add the following values to the Heroku config for the app:
SECRET- used for signing and verifying tokens
MONGODB_URI- used for connecting to MongoDB service
Push your code to GitHub
Connect your Heroku app with GitHub or push code directly to Heroku. (See Deploying Node.js Apps on Heroku)
This project uses
apollo-server-express v 3.x which means GraphQL Playground (deprecated) is not included. Instead, Apollo Server 3 uses Apollo Studio as a development tool for building your api. If you would like to use GraphQL Playground, refer to this guide to enable the tool.
Create React App
The client for this project is built with the
create-react-app tool chain. The README file generated by
create-react-app has been preserved. See client/README.md for details about the tools.