Giter Site home page Giter Site logo

iconifyit / mern-stack Goto Github PK

View Code? Open in Web Editor NEW

This project forked from t-ho/mern-stack

0.0 1.0 0.0 28.96 MB

MERN Stack with Docker - MongoDB - Express - React - Redux - React Native - NodeJs

Home Page: https://tdev.app/mern-stack

License: MIT License

JavaScript 90.72% HTML 5.03% CSS 0.11% Dockerfile 0.11% Shell 0.32% Starlark 0.18% Java 1.82% Swift 0.03% Ruby 0.23% C 0.03% Objective-C 1.42%

mern-stack's Introduction

CI Testing code style: prettier license

mern-logo

MERN Stack with Docker

MongoDB - Express - React - Redux - React Native - NodeJS

MERN stack is intended to provide a starting point for building full-stack JavaScript applications, including dynamic web and mobile apps. The stack is made of MongoDB, Express, React, Redux, React Native and NodeJS.

mern-workflow

Demo

Project Breakdown

1. API Server

NOTE: The full API documentation can be found here

2. React Client

3. React Native - Mobile

  • Directory mobile
  • Created by using react-native-cli. If you want to use Expo, please check out expo branch and see docs here
  • Todo:
    • Redux store - react-redux
    • Router - react-navigation
    • Material design - react-native-paper
    • Authentication screens
      • Sign up screen
      • Sign in screen with email, Facebook or Google account
      • Request password reset email screen
      • Request verification email screen
      • Settings screen

4. Nginx Proxy

5. CI and CD

  • Directory .github/workflows
  • Todo:
    • Testing workflow
    • Building and deploying workflow

Getting started

1. Clone the mern-stack repository

If you want to use Expo for developing mobile app, please check out the expo branch and see instructions here

git clone https://github.com/t-ho/mern-stack.git
cd mern-stack
cp .env.example .env
cp client/.env.example client/.env
cp mobile/.env.example mobile/.env
# Edit all three .env files to meet your requirements

2. Install package dependencies

In the root directory, run:

npm install

3. Start development servers

To start server, client, and mobile, run:

# In the root directory (mern):
npm start
# Server API is running at http://localhost:SERVER_PORT (http://localhost:8861 by default)
# Web client is running at http://localhost:PORT (http://localhost:3000 by default)
# Mobile - Expo DevTools is running at http://localhost:19002

NOTE:

  • For the sake of simplicity, we use free service ngrok to create a public API URL for mobile development. The downside of this approach is that the public URL is only available for 8 hours, so we need to restart the npm process every 8 hours.
  • After 8 hours, the mobile process will be terminated, and a warning message will be displayed in your terminal to remind you to restart npm process.

To restart npm process (If you don't start the mobile development process, ignore this step):

# In your current terminal, press Ctrl + C to exit. Then run
npm start # start server, client and mobile dev process
# or
npm run server:mobile # start server and mobile dev process

Or to start server and client only, run:

# In the root directory (mern):
npm run server:client
# Server API is running at http://localhost:SERVER_PORT (http://localhost:8861 by default)
# Web client is running at http://localhost:PORT (http://localhost:3000 by default)

Or to start server and mobile only, run:

# In the root directory (mern):
npm run server:mobile
# Server API is running at http://localhost:SERVER_PORT (http://localhost:8861 by default)

4. Run the mobile app in your emulator/simulator

cd mobile
npx react-native run-android
# or
npx react-native run-ios

5. Run the mobile app on your mobile devices

  • Please read the documenatation here

6. Debug mobile app with react-native-debugger

  • Install react-native-debugger.
  • Open React Native Debugger window instance with port 19001 (Debugger > New Window).
  • Enable Debugging mode on your iOS simulator or Android emulator.

7. Debug web app with Redux DevTools

8. Docker

You can start the MERN stack (server and client only) using docker-compose:

Development mode

git clone https://github.com/t-ho/mern-stack.git
cd mern-stack
cp .env.example .env
cp client/.env.example client/.env

# Edit the .env file to meet your requirements
docker-compose up
# The mongoDB service listen on port 27018

The nginx-proxy server will listen on port 8080 (NGINX_PROXY_PORT) by default.

Production mode

git clone https://github.com/t-ho/mern-stack.git
cd mern-stack
cp .env.example .env.prod

# Edit the .env.prod file to meet your requirements
docker-compose -f docker-compose.prod.yml  --env-file ./.env.prod up -d

Testing

In the root (mern-stack) directory, run:

npm run test

Testing frameworks:

mern-stack's People

Contributors

t-ho avatar

Watchers

James Cloos 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.