{"id":20014604,"url":"https://github.com/t-ho/mern-stack","last_synced_at":"2025-07-18T13:37:01.515Z","repository":{"id":38920386,"uuid":"233154929","full_name":"t-ho/mern-stack","owner":"t-ho","description":"MERN Stack with Docker - MongoDB - Express - React - Redux - React Native - NodeJs","archived":false,"fork":false,"pushed_at":"2023-03-04T05:49:21.000Z","size":28835,"stargazers_count":77,"open_issues_count":34,"forks_count":39,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T12:51:05.860Z","etag":null,"topics":["docker","docker-compose","express","mern-stack","mongodb","nodejs","react-native","reactjs","redux"],"latest_commit_sha":null,"homepage":"https://tdev.app/mern-stack","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/t-ho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-11T00:48:31.000Z","updated_at":"2025-01-18T22:44:00.000Z","dependencies_parsed_at":"2023-02-05T03:01:58.333Z","dependency_job_id":null,"html_url":"https://github.com/t-ho/mern-stack","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t-ho%2Fmern-stack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t-ho%2Fmern-stack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t-ho%2Fmern-stack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t-ho%2Fmern-stack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/t-ho","download_url":"https://codeload.github.com/t-ho/mern-stack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252408101,"owners_count":21743053,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","express","mern-stack","mongodb","nodejs","react-native","reactjs","redux"],"created_at":"2024-11-13T07:42:58.847Z","updated_at":"2025-07-18T13:37:01.500Z","avatar_url":"https://github.com/t-ho.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CI Testing](https://github.com/t-ho/mern-stack/workflows/CI%20Testing/badge.svg?branch=master)](https://github.com/t-ho/mern-stack/actions)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![license](https://img.shields.io/github/license/t-ho/mern-stack)](https://github.com/t-ho/mern-stack/blob/master/LICENSE)\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://github.com/t-ho/mern-stack\"\u003e\u003cimg alt=\"mern-logo\" width=\"360\" src=\"https://raw.githubusercontent.com/t-ho/mern-stack/assets/assets/mern-logo.png\"/\u003e\u003c/a\u003e\u003c/p\u003e\n\n# MERN Stack with Docker\n\n### MongoDB - Express - React - Redux - React Native - NodeJS\n\nMERN 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.\n\n[![mern-workflow](https://raw.githubusercontent.com/t-ho/mern-stack/assets/assets/mern-workflow.gif)](https://github.com/t-ho/mern-stack)\n\n## Demo\n\n- Web app [demo](https://mernstack.tdev.app)\n- Mobile app [demo](https://expo.io/@t-ho/mern-stack)\n- Dummy accounts:\n  - email: `admin@tdev.app` - password: `password`\n  - email: `user@tdev.app` - password: `password`\n\n## Project Breakdown\n\n### 1. API Server\n\n**NOTE: The full API documentation can be found [here](https://tdev.app/mern-stack/server)**\n\n- Directory `server`\n- Todo:\n  - [x] Authentication system - [passport](https://www.npmjs.com/package/passport)\n    - [x] Sign up - [bcrypt](https://www.npmjs.com/package/bcrypt)\n    - [x] Local login - [jsonwebtoken](https://www.npmjs.com/package/jsonwebtoken) - [passport-jwt](https://www.npmjs.com/package/passport-jwt)\n    - [x] Apple login - [@nicokaiser/passport-apple](https://www.npmjs.com/package/@nicokaiser/passport-apple)\n    - [x] Facebook login - [passport-facebook-token](https://www.npmjs.com/package/passport-facebook-token)\n    - [x] Google login - [passport-google-id-token](https://www.npmjs.com/package/passport-google-id-token)\n    - [x] Email verification\n    - [x] Password reset email\n  - [x] Authorization system\n    - [x] Role-based access control\n    - [x] Principle of least privilege\n  - [x] User management - CRUD operations\n  - [x] Input validation and sanitization - [joi](https://www.npmjs.com/package/joi)\n  - [x] Integration testing - [mocha](https://www.npmjs.com/package/mocha) - [chai](https://www.npmjs.com/package/chai) - [supertest](https://www.npmjs.com/package/supertest)\n  - [x] Docker support - [node:lts-buster](https://hub.docker.com/_/node)\n    - [x] Dev mode - See [server/Dockerfile](https://github.com/t-ho/mern-stack/blob/master/server/Dockerfile)\n    - [x] Prod mode - See [server/Dockerfile.prod](https://github.com/t-ho/mern-stack/blob/master/server/Dockerfile.prod)\n\n### 2. React Client\n\n- Directory `client`\n- Created by using [create-react-app](https://www.npmjs.com/package/create-react-app)\n- Todo:\n  - [x] Redux store - [react-redux](https://www.npmjs.com/package/react-redux)\n  - [x] Redux form - [redux-form](https://redux-form.com/8.3.0). NOTE: Migrate to [formik](https://jaredpalmer.com/formik) soon\n  - [x] Router - [react-router-dom](https://www.npmjs.com/package/react-router-dom) - [connected-react-router](https://www.npmjs.com/package/connected-react-router)\n  - [x] Material design - [Material-UI](https://material-ui.com)\n  - [ ] Authentication pages\n    - [x] Sign up page\n    - [x] Sign in page with email, Facebook or Google account\n    - [x] Request password reset email page\n    - [x] Request verification email page\n    - [x] Reset password page\n    - [ ] Profile page\n  - [ ] User management pages\n    - [ ] User list page\n    - [ ] User edit page\n  - [x] Docker support - [node:lts-buster](https://hub.docker.com/_/node) - [nginx:stable-alpine](https://hub.docker.com/_/nginx)\n    - [x] Dev mode - See [client/Dockerfile](https://github.com/t-ho/mern-stack/blob/master/client/Dockerfile)\n    - [x] Prod mode - See [client/Dockerfile.prod](https://github.com/t-ho/mern-stack/blob/master/client/Dockerfile.prod)\n\n### 3. React Native - Mobile\n\n- Directory `mobile`\n- Created by using [react-native-cli](https://github.com/react-native-community/cli). If you want to use Expo, please check out [expo](https://github.com/t-ho/mern-stack/tree/expo) branch and see docs [here](https://github.com/t-ho/mern-stack/blob/expo/README.md)\n- Todo:\n  - [x] Redux store - [react-redux](https://www.npmjs.com/package/react-redux)\n  - [x] Router - [react-navigation](https://reactnavigation.org)\n  - [x] Material design - [react-native-paper](https://www.npmjs.com/package/react-native-paper)\n  - [ ] Authentication screens\n    - [x] Sign up screen\n    - [x] Sign in screen with email, Facebook or Google account\n    - [x] Request password reset email screen\n    - [x] Request verification email screen\n    - [ ] Settings screen\n\n### 4. Nginx Proxy\n\n- Directory `nginx-proxy`\n- Todo:\n  - [x] Reverse proxy server - [nginx:stable](https://hub.docker.com/_/nginx)\n    - [x] Dev mode - See [nginx-proxy/Dockerfile](https://github.com/t-ho/mern-stack/blob/master/nginx-proxy/Dockerfile)\n    - [x] Prod mode - See [nginx-proxy/Dockerfile.prod](https://github.com/t-ho/mern-stack/blob/master/nginx-proxy/Dockerfile.prod)\n      - [x] Install and auto-renew SSL certificate\n      - [x] Force all HTTP traffic (domain name and IP address) to HTTPS\n      - [x] Use recommended configuration - [server-configs-nginx](https://github.com/h5bp/server-configs-nginx)\n  - [x] Configuration can be done easily by modifying the `.env` file\n\n### 5. CI and CD\n\n- Directory `.github/workflows`\n- Todo:\n  - [x] Testing workflow\n  - [x] Building and deploying workflow\n\n## Getting started\n\n### 1. Clone the `mern-stack` repository\n\n**If you want to use Expo for developing mobile app, please check out the [expo](https://github.com/t-ho/mern-stack/tree/expo) branch and see instructions [here](https://github.com/t-ho/mern-stack/blob/expo/README.md)**\n\n```bash\ngit clone https://github.com/t-ho/mern-stack.git\ncd mern-stack\ncp .env.example .env\ncp client/.env.example client/.env\ncp mobile/.env.example mobile/.env\n# Edit all three .env files to meet your requirements\n```\n\n### 2. Install package dependencies\n\nIn the `root` directory, run:\n\n```bash\nyarn install\n```\n\n### 3. Start development servers\n\nTo start `server`, `client`, and `mobile`, run:\n\n```bash\n# In the root directory (mern):\nyarn start\n# Server API is running at http://localhost:SERVER_PORT (http://localhost:8861 by default)\n# Web client is running at http://localhost:PORT (http://localhost:3000 by default)\n# Mobile - Expo DevTools is running at http://localhost:19002\n```\n\n**NOTE:**\n\n- **For the sake of simplicity, we use free service [ngrok](https://ngrok.com/) 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.**\n- **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.**\n\nTo restart yarn process (_If you don't start the mobile development process, ignore this step_):\n\n```bash\n# In your current terminal, press Ctrl + C to exit. Then run\nyarn start # start server, client and mobile dev process\n# or\nyarn run server:mobile # start server and mobile dev process\n```\n\nOr to start `server` and `client` only, run:\n\n```bash\n# In the root directory (mern):\nyarn run server:client\n# Server API is running at http://localhost:SERVER_PORT (http://localhost:8861 by default)\n# Web client is running at http://localhost:PORT (http://localhost:3000 by default)\n```\n\nOr to start `server` and `mobile` only, run:\n\n```bash\n# In the root directory (mern):\nyarn run server:mobile\n# Server API is running at http://localhost:SERVER_PORT (http://localhost:8861 by default)\n```\n\n### 4. Run the mobile app in your emulator/simulator\n\n```bash\ncd mobile\nnpx react-native run-android\n# or\nnpx react-native run-ios\n```\n\n### 5. Run the mobile app on your mobile devices\n\n- Please read the documenatation [here](https://reactnative.dev/docs/running-on-device)\n\n### 6. Debug mobile app with `react-native-debugger`\n\n- Install [react-native-debugger](https://github.com/jhen0409/react-native-debugger/releases).\n- Open React Native Debugger window instance with port `19001` (`Debugger` \u003e `New Window`).\n- Enable [Debugging mode](https://facebook.github.io/react-native/docs/debugging.html#accessing-the-in-app-developer-menu) on your iOS simulator or Android emulator.\n\n### 7. Debug web app with `Redux DevTools`\n\n- On Chrome, install [redux-devtools-extension](https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd)\n- On Firefox, install [redux-devtools-add-ons](https://addons.mozilla.org/en-US/firefox/addon/reduxdevtools/)\n\n### 8. Docker\n\nYou can start the MERN stack (`server` and `client` only) using `docker-compose`:\n\n**Development mode**\n\n```bash\ngit clone https://github.com/t-ho/mern-stack.git\ncd mern-stack\ncp .env.example .env\ncp client/.env.example client/.env\n\n# Edit the .env file to meet your requirements\ndocker-compose up\n# The mongoDB service listen on port 27018\n```\n\nThe `nginx-proxy` server will listen on port `8080` (`NGINX_PROXY_PORT`) by default.\n\n**Production mode**\n\n```bash\ngit clone https://github.com/t-ho/mern-stack.git\ncd mern-stack\ncp .env.example .env.prod\n\n# Edit the .env.prod file to meet your requirements\ndocker-compose -f docker-compose.prod.yml  --env-file ./.env.prod up -d\n```\n\n## Testing\n\nIn the root (`mern-stack`) directory, run:\n\n```bash\nnpm run test\n```\n\nTesting frameworks:\n\n- Server: [mocha](https://mochajs.org/) - [chai](https://www.chaijs.com/) - [supertest](https://github.com/visionmedia/supertest)\n- Web-client: [jest](https://jestjs.io/)\n- Mobile:\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ft-ho%2Fmern-stack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ft-ho%2Fmern-stack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ft-ho%2Fmern-stack/lists"}