Git Product home page Git Product logo

mern-boilerplate's Introduction

App Boilerplate

This is a boilerplate project that uses the following stack:

  • MongoDB - database (along with mongoose)
  • Expressjs - handles the backend and server
  • AdminBro - admin panel located at /admin
  • React - bootstrapped with create-react-app
  • Typescript
  • Rebass - super low-level front end framework for styles

Getting started

Install dependencies in the root as well as the client:

yarn
cd client
yarn

Then to start the server (in root)

node server

And in a separate terminal, start the client

cd client
yarn start

The client will be available at localhost:3000, and is proxying the server at localhost:8080.

Database

Change DATABASE_NAME in /services/mongo.js to your database name, and the MONGO_ATLAS_URL to the correct cluster url.

Locally, you'll want to make sure that your mongodb is up and running, generally you can start it with

sudo mongod

but depending on your setup you may need to specifically include the path to the db, e.g.

sudo mongod --dbpath /usr/local/var/mongodb

.env

A .env file should be added to the root of the repo, the variables are made available in server.js, and should at least include the following:

PORT=8080
NODE_ENV=dev

DB_USER={MONGO_DB_USER}
DB_PASSWORD={MONGO_DB_PASSWORD}

SESSION_SECRET={SOME_LONG_HASH}
COOKIE_PASSWORD={SOME_LONG_HASH}

Admin panel

The admin panel cane be accessed at /admin. All users have access to the admin panel by default.

Builds

To build the client

cd client
yarn build

You can then test the live setup by setting NODE_ENV to production, starting the server, and going to http://localhost:{PORT}

mern-boilerplate's People

Contributors

tmarshall07 avatar

Watchers

James Cloos avatar  avatar John A Maloney avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.