Skip to content

Instantly share code, notes, and snippets.

@jim-clark
Created September 11, 2024 12:56
Show Gist options
  • Save jim-clark/1729837920e45a869055dabf08c9f6dd to your computer and use it in GitHub Desktop.
Save jim-clark/1729837920e45a869055dabf08c9f6dd to your computer and use it in GitHub Desktop.
Instructions to set up a new MERN-Stack project by cloning the mern-project-template starter code

SET UP YOUR mern-project-template !

  • Please follow these instructions to set up the mern-project-template in your own personal GitHub account so that you can clone it for the Hoot project as well as your Project 3:
  • Move into your ~/code/ga folder: cd ~/code/ga
  • Clone my mern-project-template: git clone https://git.generalassemb.ly/SEB-0722/mern-project-template.git
  • Move into the newly created project folder: cd mern-project-template
  • Delete the current repo folder: rf -rf .git
  • Initialize a new local repo: git init
  • Make your first commit: git add -A && git commit -m "MERN Starter Code"
  • Create a new repo named mern-project-template in your personal GitHub account.
  • Copy the "Quick setup" URL in the light-blue box.
  • Back in terminal, add the remote: git remote add origin <Paste the URL>
  • Push to the remote: git push -u origin main
  • Congrats! To start a new MERN-Stack project for Hoot, etc., follow these steps:
  • Move into your ~/code/ga folder: cd ~/code/ga
  • Click the green [Code] button in the mern-project-template GitHub repo and copy the URL.
  • Clone the repo and name it for your new project: git clone <Paste the URL> <your-new-project-name>
  • Move into your newly created project folder: cd <your-new-project-name>
  • Run the build script to install the Node modules for both the backend & frontend and build the React production code (necessary for the Express server to run): npm run build
  • Add a .env file in the root of the project folder that includes a valid MONGODB_URI and a SECRET.
  • When developing, start the backend in terminal with nodemon AND...
  • In a separate terminal, cd into the frontend folder and start the React/Vite dev server with npm run dev
  • It's recommended that you rename these two terminal sessions to something like "Express" and "React" - change their colors too!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment