A full-stack JavaScript solution, which provides a starting point for MongoDB, Node.js, Express, and Angular based applications.
Before you begin I recommend you read about the basic building blocks that assemble a MEAN.JS application:
- MongoDB - Go through MongoDB Official Website and proceed to their Official Manual, which should help you understand NoSQL and MongoDB better.
- Node.js - Start by going through Node.js Official Website.
- Express - The best way to understand express is through its Official Website, which has a Getting Started guide, as well as an ExpressJS guide for general express topics.
- Angular - Angular's Official Website is a great starting point.
- Angular CLI - Go through Angular CLI Official Website and check their Overview Page
Make sure you have installed all of the following prerequisites on your development machine:
- Git - Download & Install Git. OSX and Linux machines typically have this already installed.
- Node.js - Download & Install Node.js and the npm package manager.
- Docker - You're going to use the Docker and Docker Compose to install MongoDB and setup the production environment.
- Angular CLI - Install Angular CLI
Use git to directly clone this repository:
git clone https://github.com/gymitoso/mean-stack.git
To install the dependencies, run this in the application folder from the command-line:
npm install
And then install MongoDB with docker compose and execute the database migration:
docker-compose -f ./docker/mongo.yml up -d
npm run migrate-db
The first command will setup the MongoDB on port 27018 and the second will create a user (sys-admin@mean.com - admin) in MongoDB.
Run your application using npm:
npm start
Your Angular application runs on port 4200 with the development environment configuration, so in your browser just go to http://localhost:4200. The Node.js API runs on port 4000, so in your browser just go to http://localhost:4000/api/health and the browser should display 'OK'.
To run your application with production environment configuration:
docker-compose up -d --build
This will setup your Angular and Node.js application in port 4000. This application uses Nginx to proxy requests in production.
This app includes a static code analysis setup with ESLint. I recommend that you install the relevant IDE extensions for ESLint. Once you do, every time you press save, all your code will be formatted and reviewed for quality automatically. I also set up a git hook to automatically analyze your code before it is committed.