Creating a first Node.js app using GeddyJS framework on Windows

Node.js is an open source, cross-platform runtime environment for easily building fast, server-side and scalable networking applications. Node.js provides an event-driven architecture and a non-blocking I/O API that optimizes an application’s throughput and scalability and that is perfect for data-intensive real-time applications.

Geddy is a simple, structured web framework for Node and a No-Brainer MVC Node.js Framework .

Here, I will show how to create a basic Node.js app using Geddy. My working environment is Windows 7.

1. Install Node

Get the node installer from and install it. It will add the node path in environment variable that makes you run the node command globally.

After installation, you could try node --version in the Windows command line to check if it is working. You will get the node version you installed if it is correctly installed.

C:\Users\~Username> node --version

You could also try node without options that enables you to execute codes in the command line.

C:\Users\~Username> node
> console.log("Hello World");
Hello World

2. Install Geddy globally

C:\Users\~Username> npm install -g geddy

You could try geddy --version to check if it is correctly installed. The latest version would be printed out. At this time of writing, the latest version is 13.0.7.

C:\Users\~Username> geddy --version

3. Generate an app

Generate an app using the command geddy gen app <appname>. Before you generate, you may change the directory where you want to put your node application, for example, D:\nodeapps\

C:\Users\~Username> cd\
D:>cd nodeapps
D:\nodeapps> geddy gen app helloworld

This will create a directory D:\nodeapps\helloworld and generate your first geddy app.

Usage: geddy gen app <appname> [options]

  -t, --trace         Output detailed error information for failures
  -rt, --realtime     When generating or scaffolding, take realtime into account
  -j, --jade          add Jade template engine (defaults to EJS)
  -h, --H             add Handlebars template engine
  -m, --mustache      add Mustache template engine
  -s, --swigg         add Swigg template engine
  • To install geddy with default ejs template geddy gen app <appname>
  • To install geddy with jade template geddy gen app <appname> -j
  • To install geddy with handlebars template geddy gen app <appname> -H

5. Run app at localhost:4000

By default, Geddy will listen to the port 4000. You would need to cd to your app directory, helloworld in this example, and then run the command geddy

D:\nodeapps\helloworld> geddy

Visit http://localhost:4000 in your browser. You can configure the port in .\helloworld\config\development.js and .\helloword\config\production.js

6. Auto-restart the server with nodemon

You have to restart the geddy server whenever you change the code in your node.js application. during your development. nodemon will rescue you and it reloads automatically. It is a monitor for any changes in your node.js application and automatically restart the server. It is perfect for development.

6.1 Install nodemon globally (if you already have it installed, skip this step)

Install nodemon globally using the option -g.

D:\nodeapps\helloworld> npm install -g nodemon

6.2 Install Geddy locally

You have to install Geddy locally. Local installation means the geddy module has to be downloaded in the node_modules directory of the app,  .\helloworld\node_modules in this case.

D:\nodeapps\helloworld> npm install geddy

The alternative is to update package.json in the project root with "dependencies": { "geddy": "latest" } and then run

D:\nodeapps\helloworld> npm install

6.3 Create server.js

Create server.js in the project root (.\helloworld\server.js) with the following content.

var geddy = require('geddy');
   port: '4000',
   environment: 'development'

6.4 Add server.js in package.json

Add "main": "server.js" in package.json

6.5 Create nodemon.json

Create nodemon.json in the project root with the following content, otherwise it keeps restarting and it goes forever.

    "ignore": ["log/*", "public/js/core/*"]

6.6 Finally run your app with “nodemon” instead of “geddy”

D:\nodeapps\helloworld> nodemon

Update your code and check http://localhost:4000. You will see the changes without restarting the server.

Note: If you skip the step 6.4, you would need to use command nodemon server.js

Disabling the default Geddy log system

By default Geddy logs every access of your web pages in the directory log/. Sometimes you may not need it to save your disk space.

Simply put the line logDir: null in the config setting of  \config\development.js or \config\production.js.

Official Links & Resources


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s