1.0.5 • Published 3 years ago
cra-template-mern-cra-template v1.0.5
mern-cra-template
A quick start Create React App template with MERN & Tailwind CSS
Usage
npx create-react-app your-app-name --template mern-cra-template
ES Modules in Node
We us ECMAScript Modules in the backend in this project. Be sure to have at least Node v14.6+ or you will need to add the "--experimental-modules" flag.
Also, when importing a file (not a package), be sure to add .js at the end or you will get a "module not found" error
Env Variables
Create a .env file in the root and add the following
NODE_ENV = development
PORT = 5000
MONGO_URI = your mongodb uri
Install Dependencies (frontend & backend)
npm install
cd frontend
npm install
Run
# Run frontend (:3000) & backend (:5000)
npm run dev
# Run backend only
npm run server
Build & Deploy
# Create frontend prod build
cd frontend
npm run build
There is a Heroku postbuild script, so if you push to Heroku, no need to build manually for deployment to Heroku
License
MIT