<commit_before>---
title: Develop
---

DemocracyOS development guide
==========================

We'll be using `1.0.0` branch of DemocracyOS.

# Stack

#### Node.js and NPM
We support the [latest version](https://nodejs.org/en/blog/release/v4.2.1/) of [Node.js](https://nodejs.org/en) so you must have it installed.

There are many options out there to get it installed:

* [Official site](https://nodejs.org/en/download/): both Node.js and NPM come bundled with this installation.

* [NVM](https://github.com/creationix/nvm): Node Version Manager - Simple bash script to manage multiple active node.js versions

* [tj/n](https://github.com/tj/n): another -yet simpler- node version manager


#### MongoDB

We also support the [latest version](http://blog.mongodb.org/post/130823293808/mongodb-319-is-released) of [MongoDB](https://www.mongodb.org/).

So [download](https://www.mongodb.org/downloads) the version for your system and follow the installation instructions to get it running.

```
Note: we are planning on using Docker for both development and production so start developing on a new machine is easy as pie and we can run the app with the same environment that in production.
```

#### Browserify

We use [Browserify](http://browserify.org) to bundle all our client side code, but we use it as a dependency so you don't need to install anything.

#### Operating System

We currently don't support Windows, so if you're running it please install VirtualBox with a Linux distribution. We prefer Ubuntu as we know DemocracyOS runs on it.

# Configuration

All the configuration variables are on the `/config/defaults.json` file. If you want to override any of them, you should create a new file called `development.json` on the same directory and re-write the name and the value you want.

Also, to pass configuration variables to the client we use the `client` key, which accepts an array of other configuration variable names.

So if you want to add a new variable called `example` and pass it to the client, the steps are:
1. Add the key-value pair to the `defaults.json` file, the key should be `example` and the value whatever you want. It must have a default value, even if it is an empty string.
2. If you want to pass that variable to the client, then add `'example'` to the client array in that same file.
3. If you want to test with a different value for the `example` variable, create a `development.json` file in the same directory and override the default value.

Configuration variable names must be `camelCased` as in production we match Environment Variables with Configuration Variables in this way:

In defaults.json:
```
{
  ...
  myVariable: 'default',
  myOtherVariable: {
    someProperty: 10
  }
  ...

}
In production, those environment variables must be:
```
MY_VARIABLE="not default"
MY_OTHER_VARIABLE_SOME_PROPERTY=20
```
As you can see, we match camelCase and nested objects with underscores, and we infer the type using the `defaults.json` file (`myVariable` is a `string` and `someProperty` is a number in this case).

# Running the app

DemocracyOS can be run in many ways, but we prefer just using `make` on the project root folder.

Another way can be running `gulp bws` for development, that will wait for changes on the project files to rebuild every time. For that, we must have `gulp` installed:

```
npm install -g gulp
```

# Models

All our data is stored in MongoDB and to connect with it we use [mongoose](http://mongoosejs.com/), an elegant mongodb object modeling for node.js.<commit_msg>[docs] - Fix markdown bug<commit_after>---
title: Develop
---

DemocracyOS development guide
==========================

We'll be using `1.0.0` branch of DemocracyOS.

# Stack

#### Node.js and NPM
We support the [latest version](https://nodejs.org/en/blog/release/v4.2.1/) of [Node.js](https://nodejs.org/en) so you must have it installed.

There are many options out there to get it installed:

* [Official site](https://nodejs.org/en/download/): both Node.js and NPM come bundled with this installation.

* [NVM](https://github.com/creationix/nvm): Node Version Manager - Simple bash script to manage multiple active node.js versions

* [tj/n](https://github.com/tj/n): another -yet simpler- node version manager


#### MongoDB

We also support the [latest version](http://blog.mongodb.org/post/130823293808/mongodb-319-is-released) of [MongoDB](https://www.mongodb.org/).

So [download](https://www.mongodb.org/downloads) the version for your system and follow the installation instructions to get it running.

```
Note: we are planning on using Docker for both development and production so start developing on a new machine is easy as pie and we can run the app with the same environment that in production.
```

#### Browserify

We use [Browserify](http://browserify.org) to bundle all our client side code, but we use it as a dependency so you don't need to install anything.

#### Operating System

We currently don't support Windows, so if you're running it please install VirtualBox with a Linux distribution. We prefer Ubuntu as we know DemocracyOS runs on it.

# Configuration

All the configuration variables are on the `/config/defaults.json` file. If you want to override any of them, you should create a new file called `development.json` on the same directory and re-write the name and the value you want.

Also, to pass configuration variables to the client we use the `client` key, which accepts an array of other configuration variable names.

So if you want to add a new variable called `example` and pass it to the client, the steps are:
1. Add the key-value pair to the `defaults.json` file, the key should be `example` and the value whatever you want. It must have a default value, even if it is an empty string.
2. If you want to pass that variable to the client, then add `'example'` to the client array in that same file.
3. If you want to test with a different value for the `example` variable, create a `development.json` file in the same directory and override the default value.

Configuration variable names must be `camelCased` as in production we match Environment Variables with Configuration Variables in this way:

In defaults.json:
```
{
  ...
  myVariable: 'default',
  myOtherVariable: {
    someProperty: 10
  }
  ...

}
```
In production, those environment variables must be:
```
MY_VARIABLE="not default"
MY_OTHER_VARIABLE_SOME_PROPERTY=20
```
As you can see, we match camelCase and nested objects with underscores, and we infer the type using the `defaults.json` file (`myVariable` is a `string` and `someProperty` is a number in this case).

# Running the app

DemocracyOS can be run in many ways, but we prefer just using `make` on the project root folder.

Another way can be running `gulp bws` for development, that will wait for changes on the project files to rebuild every time. For that, we must have `gulp` installed:

```
npm install -g gulp
```

# Models

All our data is stored in MongoDB and to connect with it we use [mongoose](http://mongoosejs.com/), an elegant mongodb object modeling for node.js.
{'fraction_non_alphanumeric': 0.09180512531681216, 'fraction_numerical': 0.007885102787947058, 'mean_word_length': 4.203663003663004, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 14, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6234816', 'n_tokens_mistral': 2038, 'n_tokens_neox': 1917, 'n_words': 992}