|
1 |
| -# MEAN Stack |
| 1 | +[](http://meanjs.org/) |
2 | 2 |
|
3 |
| -MEAN is a boilerplate that provides a nice starting point for [MongoDB](http://www.mongodb.org/), [Node.js](http://www.nodejs.org/), [Express](http://expressjs.com/), and [AngularJS](http://angularjs.org/) based applications. It is designed to give you quick and organized way to start developing of MEAN based web apps with useful modules like mongoose and passport pre-bundled and configured. We mainly try to take care of the connection points between existing popular frameworks and solve common integration problems. |
| 3 | +MEAN.JS is a full-stack JavaScript open-source solution, which provides a solid starting point for [MongoDB](http://www.mongodb.org/), [Node.js](http://www.nodejs.org/), [Express](http://expressjs.com/), and [AngularJS](http://angularjs.org/) based applications. The idea is to solve the common issues with connecting those frameworks, build a robust framework to support daily development needs, and help developers use better practices while working with popular JavaScript components. |
| 4 | + |
| 5 | +## Before You Begin |
| 6 | +Before you begin we recommend you read about the basic building blocks that assemble a MEAN.JS application: |
| 7 | +* MongoDB - Go through [MongoDB Official Website](http://mongodb.org/) and proceed to their [Official Manual](http://docs.mongodb.org/manual/), which should help you understand NoSQL and MongoDB better. |
| 8 | +* Express - The best way to understand express is through its [Official Website](http://expressjs.com/), particularly [The Express Guide](http://expressjs.com/guide.html); you can also go through this [StackOverflow Thread](http://stackoverflow.com/questions/8144214/learning-express-for-node-js) for more resources. |
| 9 | +* AngularJS - Angular's [Official Website](http://angularjs.org/) is a great starting point. You can also use [Thinkster Popular Guide](http://www.thinkster.io/), and the [Egghead Videos](https://egghead.io/). |
| 10 | +* Node.js - Start by going through [Node.js Official Website](http://nodejs.org/) and this [StackOverflow Thread](http://stackoverflow.com/questions/2353818/how-do-i-get-started-with-node-js), which should get you going with the Node.js platform in no time. |
4 | 11 |
|
5 |
| -## Prerequisites |
6 |
| -* Node.js - Download and Install [Node.js](http://www.nodejs.org/download/). You can also follow [this gist](https://gist.github.com/isaacs/579814) for a quick and easy way to install Node.js and npm |
7 |
| -* MongoDB - Download and Install [MongoDB](http://www.mongodb.org/downloads) - Make sure it's running on the default port (27017). |
8 | 12 |
|
9 |
| -### Tools Prerequisites |
10 |
| -* NPM - Node.js package manager, should be installed when you install node.js. |
11 |
| -* Bower - Web package manager, installing [Bower](http://bower.io/) is simple when you have npm: |
| 13 | +## Prerequisites |
| 14 | +Make sure you have installed all these prerequisites on your development machine. |
| 15 | +* Node.js - [Download & Install Node.js](http://www.nodejs.org/download/) and the npm package manager, if you encounter any problems, you can also use this [Github Gist](https://gist.github.com/isaacs/579814) to install Node.js. |
| 16 | +* MongoDB - [Download & Install MongoDB](http://www.mongodb.org/downloads), and make sure it's running on the default port (27017). |
| 17 | +* Bower - You're going to use the [Bower Package Manager](http://bower.io/) to manage your front-end packages, in order to install it make sure you've installed Node.js and npm, then install bower globally using npm: |
12 | 18 |
|
13 | 19 | ```
|
14 | 20 | $ npm install -g bower
|
15 | 21 | ```
|
16 | 22 |
|
17 |
| -### Optional |
18 |
| -* Grunt - Download and Install [Grunt](http://gruntjs.com). |
| 23 | +* Grunt - You're going to use the [Grunt Task Runner](http://gruntjs.com/) to automate your development process, in order to install it make sure you've installed Node.js and npm, then install grunt globally using npm: |
19 | 24 |
|
20 |
| -## Additional Packages |
21 |
| -* Express - Defined as npm module in the [package.json](package.json) file. |
22 |
| -* Mongoose - Defined as npm module in the [package.json](package.json) file. |
23 |
| -* Passport - Defined as npm module in the [package.json](package.json) file. |
24 |
| -* AngularJS - Defined as bower module in the [bower.json](bower.json) file. |
25 |
| -* Twitter Bootstrap - Defined as bower module in the [bower.json](bower.json) file. |
26 |
| -* UI Bootstrap - Defined as bower module in the [bower.json](bower.json) file. |
| 25 | +``` |
| 26 | +$ sudo npm install -g grunt-cli |
| 27 | +``` |
27 | 28 |
|
28 | 29 | ## Quick Install
|
29 |
| - The quickest way to get started with MEAN is to clone the project and utilize it like this: |
30 |
| - |
31 |
| - Install dependencies: |
32 |
| - |
33 |
| - $ npm install |
34 |
| - |
35 |
| - We recommend using [Grunt](https://github.com/gruntjs/grunt-cli) to start the server: |
| 30 | +Once you've installed all the prerequisites, you're just a few steps away from starting to develop you MEAN application. |
36 | 31 |
|
37 |
| - $ grunt |
38 |
| - |
39 |
| - When not using grunt you can use: |
| 32 | +The first thing you should do is install the Node.js dependencies. The boilerplate comes pre-bundled with a package.json file that contains the list of modules you need to start your application, to learn more about the modules installed visit the NPM & Package.json section. |
40 | 33 |
|
41 |
| - $ node server |
42 |
| - |
43 |
| - Then open a browser and go to: |
| 34 | +To install Node.js dependencies you're going to use npm again, in the application folder run this in the command-line: |
44 | 35 |
|
45 |
| - http://localhost:3000 |
46 |
| - |
47 |
| - |
48 |
| -## Troubleshooting |
49 |
| -During install some of you may encounter some issues, most of this issues can be solved by one of the following tips. |
50 |
| -If you went through all this and still can't solve the issue, feel free to contact me(Amos), via the repository issue tracker or the links provided below. |
51 |
| - |
52 |
| -#### Update NPM, Bower or Grunt |
53 |
| -Sometimes you may find there is a weird error during install like npm's *Error: ENOENT*, usually updating those tools to the latest version solves the issue. |
54 |
| - |
55 |
| -Updating NPM: |
56 | 36 | ```
|
57 |
| -$ npm update -g npm |
| 37 | +$ npm install |
58 | 38 | ```
|
59 | 39 |
|
60 |
| -Updating Grunt: |
61 |
| -``` |
62 |
| -$ npm update -g grunt-cli |
63 |
| -``` |
| 40 | +This command does a few things: |
| 41 | +* First it will install the dependencies needed for the application to run. |
| 42 | +* If you're running in a development environment, it will then also install development dependencies needed for testing and running your application. |
| 43 | +* Finally, when the install process is over, npm will initiate a bower installcommand to install all the front-end modules needed for the application |
64 | 44 |
|
65 |
| -Updating Bower: |
66 |
| -``` |
67 |
| -$ npm update -g bower |
68 |
| -``` |
69 |
| - |
70 |
| -#### Cleaning NPM and Bower cache |
71 |
| -NPM and Bower has a caching system for holding packages that you already installed. |
72 |
| -We found that often cleaning the cache solves some troubles this system creates. |
| 45 | +## Running Your Application |
| 46 | +After the install process is over, you'll be able to run your application using Grunt, just run grunt default task: |
73 | 47 |
|
74 |
| -NPM Clean Cache: |
75 | 48 | ```
|
76 |
| -$ npm cache clean |
77 |
| -``` |
78 |
| - |
79 |
| -Bower Clean Cache: |
| 49 | +$ grunt |
80 | 50 | ```
|
81 |
| -$ bower cache clean |
82 |
| -``` |
83 |
| - |
84 |
| - |
85 |
| -## Configuration |
86 |
| -All configuration is specified in the [config](config/) folder, particularly the [config.js](config/config.js) file and the [env](config/env/) files. Here you will need to specify your application name, database name, as well as hook up any social app keys if you want integration with Twitter, Facebook, GitHub or Google. |
87 |
| - |
88 |
| -### Environmental Settings |
89 | 51 |
|
90 |
| -There are three environments provided by default, __development__, __test__, and __production__. Each of these environments has the following configuration options: |
91 |
| -* __db__ - This is the name of the MongoDB database to use, and is set by default to __mean-dev__ for the development environment. |
92 |
| -* __app.name__ - This is the name of your app or website, and can be different for each environment. You can tell which environment you are running by looking at the TITLE attribute that your app generates. |
93 |
| -* __Social OAuth Keys__ - Facebook, GitHub, Google, Twitter. You can specify your own social application keys here for each platform: |
94 |
| - * __clientID__ |
95 |
| - * __clientSecret__ |
96 |
| - * __callbackURL__ |
| 52 | +Your application should run on the 3000 port so in your browser just go to [http://localhost:3000](http://localhost:3000) |
| 53 | + |
| 54 | +That's it! your application should be running by now, to proceed with your development check the other sections in this documentation. |
| 55 | +If you encounter any problem try the Troubleshooting section. |
97 | 56 |
|
98 |
| -To run with a different environment, just specify NODE_ENV as you call grunt: |
| 57 | +## Getting Started With MEAN.JS |
| 58 | +You have your application running but there are a lot of stuff to understand, we recommend you'll go over the [Offical Documentation](http://meanjs.org/docs.html). |
| 59 | +In the docs we'll try to explain both general concepts of MEAN components and give you some guidelines to help you improve your development procees. We tried covering as many aspects as possible, and will keep update it by your request, you can also help us develop the documentation better by checking out the *gh-pages* branch of this repository. |
99 | 60 |
|
100 |
| - $ NODE_ENV=test grunt |
101 |
| - |
102 |
| -If you are using node instead of grunt, it is very similar: |
103 |
| - |
104 |
| - $ NODE_ENV=test node server |
105 |
| - |
106 |
| -> NOTE: Running Node.js applications in the __production__ environment enables caching, which is disabled by default in all other environments. |
107 |
| -
|
108 |
| -## Getting Started |
109 |
| - We pre-included an article example, check it out: |
110 |
| - * [The Model](https://github.com/linnovate/mean/blob/master/app/models/article.js) - Where we define our object schema. |
111 |
| - * [The Controller](https://github.com/linnovate/mean/blob/master/app/controllers/articles.js) - Where we take care of our backend logic. |
112 |
| - * [NodeJS Routes](https://github.com/linnovate/mean/blob/master/config/routes.js) - Where we define our REST service routes. |
113 |
| - * [AngularJs Routes](https://github.com/linnovate/mean/blob/master/public/js/config.js) - Where we define our CRUD routes. |
114 |
| - * [The AngularJs Service](https://github.com/linnovate/mean/blob/master/public/js/services/articles.js) - Where we connect to our REST service. |
115 |
| - * [The AngularJs Controller](https://github.com/linnovate/mean/blob/master/public/js/controllers/articles.js) - Where we take care of our frontend logic. |
116 |
| - * [The AngularJs Views Folder](https://github.com/linnovate/mean/blob/master/public/views/articles) - Where we keep our CRUD views. |
117 |
| - |
118 |
| -## Heroku Quick Deployment |
119 |
| -Before you start make sure you have <a href="https://toolbelt.heroku.com/">heroku toolbelt</a> installed and an accessible mongo db instance - you can try <a href="http://www.mongohq.com/">mongohq</a> which have an easy setup ) |
120 |
| - |
121 |
| -```bash |
122 |
| -git init |
123 |
| -git add . |
124 |
| -git commit -m "initial version" |
125 |
| -heroku apps:create |
126 |
| -git push heroku master |
127 |
| -``` |
| 61 | +## Community |
| 62 | +* Use to [Offical Website](http://meanjs.org) to learn about changes and the roadmap. |
| 63 | +* Join #meanjs on freenode. |
| 64 | +* Discuss it in the new [Google Group](https://groups.google.com/d/forum/meanjs) |
| 65 | +* Ping us on [Twitter](http://twitter.com/meanjsorg) and [Facebook](http://facebook.com/meanjs) |
128 | 66 |
|
129 |
| -## More Information |
130 |
| - * Contact Amos Haviv on any issue via [E-Mail](mailto:mail@amoshaviv.com), [Facebook](http://www.facebook.com/amoshaviv), or [Twitter](http://www.twitter.com/amoshaviv). |
131 |
| - * Visit us at [Linnovate.net](http://www.linnovate.net/). |
132 |
| - * Visit our [Ninja's Zone](http://www.meanleanstartupmachine.com/) for extended support. |
| 67 | +## Live Example |
| 68 | +Browse the live MEAN.JS example on [http://meanjs.herokuapp.com](http://meanjs.herokuapp.com). |
133 | 69 |
|
134 |
| -## Credits |
135 |
| -Inspired by the great work of [Madhusudhan Srinivasa](https://github.com/madhums/) |
136 | 70 |
|
137 | 71 | ## License
|
138 | 72 | (The MIT License)
|
|
0 commit comments