Getting MEAN: Getting Started

Assuming that you have followed the suggestions in the previous section (Prerequisites) you should now have everything you need and you are ready to get cracking.

Creating a project directory

First step is to create a directory for your project (yeah yeah, Microsoft ended up calling them folders, but they are directories in my world).  There are two approaches to this and which one to choose depends on if you are using git or not.

If you are not using git, simply create a directory.  I keep all development projects below a directory called “src” which in turn is below my home directory.  So creating this directory would be something like:

lth@ncpws04:~/src$ mkdir notes
lth@ncpws04:~/src$ cd notes

If you decide to use git it is slightly easier if you create the repository on Github first.  Once you have created your repository, simply clone it using the URL that Github provided.  For me that would mean something like:

lth@ncpws04:~/src$ git clone
Cloning into 'notes'...
remote: Counting objects: 30, done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 30 (delta 9), reused 28 (delta 7), pack-reused 0
Receiving objects: 100% (30/30), 6.93 KiB | 0 bytes/s, done.
Resolving deltas: 100% (9/9), done.

Either way, you should end up with a directory and that directory is either empty or it has a file called (which Github creates when you create a new repository).

Creating project branch

Throughout this site we will be using git to keep track of our progress. This involves creating a branch for every step.  We do this so that we can “roll back” to a previous section and make changes there.  In reality if you decide to follow the steps, you would probably just stick to one main or master branch and stick with that.  You may also choose not to bother with git at all.

In our case, we will create a branch for the project initialization:

lth@ncpws04:~/src/notes$ git branch init
lth@ncpws04:~/src/notes$ git checkout init
Switched to branch 'init'

Initializing Project

As mentioned in the previous section we will be using npm to manage project dependencies, so let us use npm init to create our first project configuration:

lth@ncpws04:~/src/notes$ npm init
This utility will walk you through creating a package.json file.                                                                                                                                                     
It only covers the most common items, and tries to guess sensible defaults.                                                                                                                                          
See `npm help json` for definitive documentation on these fields                                                                                                                                                     
and exactly what they do.                                                                                                                                                                                            
Use `npm install <pkg>` afterwards to install a package and                                                                                                                                                          
save it as a dependency in the package.json file.                                                                                                                                                                    
Press ^C at any time to quit.                                                                                                                                                                                        
package name: (notes) 
version: (1.0.0) 0.0.1
description: Notes Application
entry point: (index.js) 
test command: 
git repository: ( 
keywords: notes
author: Lars Boegild Thomsen <>
license: (ISC) 
About to write to /home/lth/src/notes/package.json:

  "name": "notes",
  "version": "0.0.1",
  "description": "Notes Application",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  "repository": {
    "type": "git",
    "url": "git+"
  "keywords": [
  "author": "Lars Boegild Thomsen <>",
  "license": "ISC",
  "bugs": {
    "url": ""
  "homepage": ""

Is this ok? (yes) 

The result of this is a file named package.json with the contents indicated above.

Committing to git

Finally (that is if you are using git) the generated package.json should be committed:

lth@ncpws04:~/src/notes$ ls -l
total 8
-rw-r--r-- 1 lth lth 522 Oct 19 14:17 package.json
-rw-r--r-- 1 lth lth  21 Oct 19 14:13

lth@ncpws04:~/src/notes$ git add package.json 

lth@ncpws04:~/src/notes$ git commit -a -m "Added package.json"
[init 46501e2] Added package.json
 1 file changed, 22 insertions(+)
 create mode 100644 package.json

lth@ncpws04:~/src/notes$ git push --set-upstream origin init
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 570 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
 * [new branch]      init -> init
Branch init set up to track remote branch init from origin.


We are now ready to begin.

1 thought on “Getting MEAN: Getting Started

Leave a Comment