<commit_before># Getting started

## Table of Contents

<ul class="toc">
    <li><a href="#installation">Installation</a></li>
    <li><a href="#starting_a_project">Starting a project</a></li>
    <li><a href="#deployment">Deployment</a></li>
    <li><a href="#describing_the_data">Describing the data</a></li>
    <li><a href="#querying_the_data">Querying the data</a></li>
    <li><a href="#rendering_pages">Rendering pages</a></li>
    <li><a href="#users_and_permissions">Users and permissions</a></li>
    <li><a href="#embedded_types">Embedded types</a></li>
    <li><a href="#adding_forms">Adding forms</a></li>
    <li><a href="#going_it_alone">Going it alone</a></li>
</ul>


<h2 id="installation">Installation</h2>

Install the most recent _stable_ version of
[node](http://nodejs.org/#download), then clone
[kanso](https://github.com/caolan/kanso) from GitHub.
Fetch the relevant submodules by doing the following in the cloned directory:

<pre><code class="no-highlight">git submodule init
git submodule update</code></pre>

You are then ready to install:

<pre><code class="no-highlight">make && sudo make install</code></pre>


### Using NPM

If you already have node.js installed, and you're using npm
(Node Package Manager), then you can install by simply doing the following:

<pre><code class="no-highlight">sudo npm install -g kanso</code></pre>


### Why does Kanso need node.js?

Node.js is used for the command-line tools only. With Kanso, the end result is
a pure [CouchApp](http://couchapp.org) you can host using CouchDB alone.
Using node to write the associated tools allows us to do some powerful things
by interpreting the JavaScript of your application.


<h2 id="starting_a_project">Starting a project</h2>

For this tutorial we'll be making a fairly typical blog, with posts,
comments and users. Some familiarity with CouchDB is expected, but I'll
try to explain the concepts as we go.

To create a new project skeleton, enter the following command:

<pre><code class="no-highlight">kanso create myblog</code></pre>

This creates a number of files and directories representing a basic
project structure. We'll look more closely at the generated files later,
but for a brief overview, the directories fall into the following categories:

<pre><code class="no-highlight">myblog
  |- lib             CommonJS modules which define your app
  |- static          Static files such as jQuery and CSS
  |- templates       HTML templates used by the app
  |- kanso.json      Project configuration</code></pre>

This structure is a merely a guide and you are free to place files
wherever it makes sense, provided you update the configuration settings in
kanso.json.<commit_msg>added note on CouchDB version to getting started guide<commit_after># Getting started

## Table of Contents

<ul class="toc">
    <li><a href="#installation">Installation</a></li>
    <li><a href="#starting_a_project">Starting a project</a></li>
    <li><a href="#deployment">Deployment</a></li>
    <li><a href="#describing_the_data">Describing the data</a></li>
    <li><a href="#querying_the_data">Querying the data</a></li>
    <li><a href="#rendering_pages">Rendering pages</a></li>
    <li><a href="#users_and_permissions">Users and permissions</a></li>
    <li><a href="#embedded_types">Embedded types</a></li>
    <li><a href="#adding_forms">Adding forms</a></li>
    <li><a href="#going_it_alone">Going it alone</a></li>
</ul>


<h2 id="installation">Installation</h2>

Install the most recent _stable_ version of
[node](http://nodejs.org/#download), then clone
[kanso](https://github.com/caolan/kanso) from GitHub.
Fetch the relevant submodules by doing the following in the cloned directory:

<pre><code class="no-highlight">git submodule init
git submodule update</code></pre>

You are then ready to install:

<pre><code class="no-highlight">make && sudo make install</code></pre>


### Using NPM

If you already have node.js installed, and you're using npm
(Node Package Manager), then you can install by simply doing the following:

<pre><code class="no-highlight">sudo npm install -g kanso</code></pre>


### Why does Kanso need node.js?

Node.js is used for the command-line tools only. With Kanso, the end result is
a pure [CouchApp](http://couchapp.org) you can host using CouchDB alone.
Using node to write the associated tools allows us to do some powerful things
by interpreting the JavaScript of your application.


### CouchDB version

As of release 0.0.7, Kanso **only supports CouchDB 1.1.0 or higher**. This is due
to a number of fixes in CouchDB 1.1.0 for CommonJS modules which make Kanso
faster and helps to keep the framework code clean. If you're running an older
version of CouchDB you'll want to upgrade it before continuing with this guide.


<h2 id="starting_a_project">Starting a project</h2>

For this tutorial we'll be making a fairly typical blog, with posts,
comments and users. Some familiarity with CouchDB is expected, but I'll
try to explain the concepts as we go.

To create a new project skeleton, enter the following command:

<pre><code class="no-highlight">kanso create myblog</code></pre>

This creates a number of files and directories representing a basic
project structure. We'll look more closely at the generated files later,
but for a brief overview, the directories fall into the following categories:

<pre><code class="no-highlight">myblog
  |- lib             CommonJS modules which define your app
  |- static          Static files such as jQuery and CSS
  |- templates       HTML templates used by the app
  |- kanso.json      Project configuration</code></pre>

This structure is a merely a guide and you are free to place files
wherever it makes sense, provided you update the configuration settings in
kanso.json.
{'fraction_non_alphanumeric': 0.11478531855955679, 'fraction_numerical': 0.002943213296398892, 'mean_word_length': 4.549471661863593, 'pattern_counts': {'":': 0, '<': 135, '<?xml version=': 0, '>': 135, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '99630', 'n_tokens_mistral': 1739, 'n_tokens_neox': 1644, 'n_words': 668}