<commit_before>[back to hoodie](../README.md)

# hoodie/server

After [installing hoodie](../#setup), `npm start` will run [cli/index.js](../cli/start.js)
which reads out [configuration](../#usage) from all the different places using
the [rc](https://www.npmjs.com/package/rc) package, then passes it as options to
[server/index.js](../server/index.js), the Hoodie core [hapi plugin](http://hapijs.com).

In [server/index.js](../server/index.js) the passed options are amended with defaults and parsed
into configuration for the Hapi server. It passes the configuration on to [hoodie-server]('#hoodie-server'),
which combines the core server modules. It also bundles the Hoodie client on first request to `/hoodie/client.js`
and passes in the configuration for the client. It also makes the app’s `public` folder accessible at
the `/` root path, and Hoodie’s Core UIs at `/hoodie/admin`, `/hoodie/account` and `/hoodie/store`.

Hoodie uses [CouchDB](https://couchdb.apache.org/) for data persistence and
authentication. If `options.dbUrl` is not set, it falls back to [PouchDB](https://pouchdb.com/).

Once all configuration is taken care of, the internal plugins are initialised
(see [server/plugins/index.js](plugins/index.js)). We define simple Hapi plugins
for [logging](plugins/log.js) and for [serving the app’s public assets and the Hoodie client](plugins/public.js).

Once everything is setup, the server is then started at the end of [cli/start.js](../cli/start.js)
and the URL where hoodie is running is logged to the terminal.

## Architecture

Hoodie is a server built on top of [hapi](http://hapijs.com) with frontend APIs
for account and store related tasks.

1. ## server [:octocat:](https://github.com/hoodiehq/hoodie-server#readme) [![Build Status](https://travis-ci.org/hoodiehq/hoodie-server.svg?branch=master)](https://travis-ci.org/hoodiehq/hoodie-server) [![Coverage Status](https://coveralls.io/repos/hoodiehq/hoodie-server/badge.svg?branch=master)](https://coveralls.io/r/hoodiehq/hoodie-server?branch=master) [![Dependency Status](https://david-dm.org/hoodiehq/hoodie-server.svg)](https://david-dm.org/hoodiehq/hoodie-server)

   > Hoodie’s core server logic as hapi plugin. It integrates Hoodie’s server
     core modules: [account-server](https://github.com/hoodiehq/hoodie-account-server), [store-server](https://github.com/hoodiehq/hoodie-store-server)

   1. ### account-server [:octocat:](https://github.com/hoodiehq/hoodie-account-server#readme) [![Build Status](https://api.travis-ci.org/hoodiehq/hoodie-account-server.svg?branch=master)](https://travis-ci.org/hoodiehq/hoodie-account-server) [![Coverage Status](https://coveralls.io/repos/hoodiehq/hoodie-account-server/badge.svg?branch=master)](https://coveralls.io/r/hoodiehq/hoodie-account-server?branch=master) [![Dependency Status](https://david-dm.org/hoodiehq/hoodie-account-server.svg)](https://david-dm.org/hoodiehq/hoodie-account-server)

      > [Hapi](http://hapijs.com/) plugin that implements the
        [Account JSON API](http://docs.accountjsonapi.apiary.io) routes and
        exposes a corresponding API at `server.plugins.account.api.*`,
        persisting user accounts using [PouchDB](https://pouchdb.com).

   2. ### store-server [:octocat:](https://github.com/hoodiehq/hoodie-store-server#readme) [![Build Status](https://travis-ci.org/hoodiehq/hoodie-store-server.svg?branch=master)](https://travis-ci.org/hoodiehq/hoodie-store-server) [![Coverage Status](https://coveralls.io/repos/hoodiehq/hoodie-store-server/badge.svg?branch=master)](https://coveralls.io/r/hoodiehq/hoodie-store-server?branch=master) [![Dependency Status](https://david-dm.org/hoodiehq/hoodie-store-server.svg)](https://david-dm.org/hoodiehq/hoodie-store-server)

      > [Hapi](http://hapijs.com/) plugin that implements [CouchDB’s Document API](https://wiki.apache.org/couchdb/HTTP_Document_API).
        Compatible with [CouchDB](https://couchdb.apache.org/)
        and [PouchDB](https://pouchdb.com/) for persistence.

2. ## client [:octocat:](https://github.com/hoodiehq/hoodie-client#readme) [![Build Status](https://travis-ci.org/hoodiehq/hoodie-client.svg?branch=master)](https://travis-ci.org/hoodiehq/hoodie-client) [![Coverage Status](https://coveralls.io/repos/hoodiehq/hoodie-client/badge.svg?branch=master)](https://coveralls.io/r/hoodiehq/hoodie-client?branch=master) [![Dependency Status](https://david-dm.org/hoodiehq/hoodie-client.svg)](https://david-dm.org/hoodiehq/hoodie-client)

   > Hoodie’s front-end client for the browser. It integrates Hoodie’s client<commit_msg>docs(server): add @hoodie/account-server-api to architecture<commit_after>[back to hoodie](../README.md)

# hoodie/server

After [installing hoodie](../#setup), `npm start` will run [cli/index.js](../cli/start.js)
which reads out [configuration](../#usage) from all the different places using
the [rc](https://www.npmjs.com/package/rc) package, then passes it as options to
[server/index.js](../server/index.js), the Hoodie core [hapi plugin](http://hapijs.com).

In [server/index.js](../server/index.js) the passed options are amended with defaults and parsed
into configuration for the Hapi server. It passes the configuration on to [hoodie-server]('#hoodie-server'),
which combines the core server modules. It also bundles the Hoodie client on first request to `/hoodie/client.js`
and passes in the configuration for the client. It also makes the app’s `public` folder accessible at
the `/` root path, and Hoodie’s Core UIs at `/hoodie/admin`, `/hoodie/account` and `/hoodie/store`.

Hoodie uses [CouchDB](https://couchdb.apache.org/) for data persistence and
authentication. If `options.dbUrl` is not set, it falls back to [PouchDB](https://pouchdb.com/).

Once all configuration is taken care of, the internal plugins are initialised
(see [server/plugins/index.js](plugins/index.js)). We define simple Hapi plugins
for [logging](plugins/log.js) and for [serving the app’s public assets and the Hoodie client](plugins/public.js).

Once everything is setup, the server is then started at the end of [cli/start.js](../cli/start.js)
and the URL where hoodie is running is logged to the terminal.

## Architecture

Hoodie is a server built on top of [hapi](http://hapijs.com) with frontend APIs
for account and store related tasks.

1. ## server [:octocat:](https://github.com/hoodiehq/hoodie-server#readme) [![Build Status](https://travis-ci.org/hoodiehq/hoodie-server.svg?branch=master)](https://travis-ci.org/hoodiehq/hoodie-server) [![Coverage Status](https://coveralls.io/repos/hoodiehq/hoodie-server/badge.svg?branch=master)](https://coveralls.io/r/hoodiehq/hoodie-server?branch=master) [![Dependency Status](https://david-dm.org/hoodiehq/hoodie-server.svg)](https://david-dm.org/hoodiehq/hoodie-server)

   > Hoodie’s core server logic as hapi plugin. It integrates Hoodie’s server
     core modules: [account-server](https://github.com/hoodiehq/hoodie-account-server), [store-server](https://github.com/hoodiehq/hoodie-store-server)

   1. ### account-server [:octocat:](https://github.com/hoodiehq/hoodie-account-server#readme) [![Build Status](https://api.travis-ci.org/hoodiehq/hoodie-account-server.svg?branch=master)](https://travis-ci.org/hoodiehq/hoodie-account-server) [![Coverage Status](https://coveralls.io/repos/hoodiehq/hoodie-account-server/badge.svg?branch=master)](https://coveralls.io/r/hoodiehq/hoodie-account-server?branch=master) [![Dependency Status](https://david-dm.org/hoodiehq/hoodie-account-server.svg)](https://david-dm.org/hoodiehq/hoodie-account-server)

      > [Hapi](http://hapijs.com/) plugin that implements the
        [Account JSON API](http://docs.accountjsonapi.apiary.io) routes and
        exposes a corresponding API at `server.plugins.account.api.*`.

        1. #### account-server-api [:octocat:](https://github.com/hoodiehq/hoodie-account-server-api#readme) [![Build Status](https://api.travis-ci.org/hoodiehq/hoodie-account-server-api.svg?branch=master)](https://travis-ci.org/hoodiehq/hoodie-account-server-api) [![Coverage Status](https://coveralls.io/repos/hoodiehq/hoodie-account-server-api/badge.svg?branch=master)](https://coveralls.io/r/hoodiehq/hoodie-account-server-api?branch=master) [![Dependency Status](https://david-dm.org/hoodiehq/hoodie-account-server-api.svg)](https://david-dm.org/hoodiehq/hoodie-account-server-api)

        > JavaScript API for accounts and sessions backed by [PouchDB](https://pouchdb.com)

   2. ### store-server [:octocat:](https://github.com/hoodiehq/hoodie-store-server#readme) [![Build Status](https://travis-ci.org/hoodiehq/hoodie-store-server.svg?branch=master)](https://travis-ci.org/hoodiehq/hoodie-store-server) [![Coverage Status](https://coveralls.io/repos/hoodiehq/hoodie-store-server/badge.svg?branch=master)](https://coveralls.io/r/hoodiehq/hoodie-store-server?branch=master) [![Dependency Status](https://david-dm.org/hoodiehq/hoodie-store-server.svg)](https://david-dm.org/hoodiehq/hoodie-store-server)

      > [Hapi](http://hapijs.com/) plugin that implements [CouchDB’s Document API](https://wiki.apache.org/couchdb/HTTP_Document_API).
        Compatible with [CouchDB](https://couchdb.apache.org/)
        and [PouchDB](https://pouchdb.com/) for persistence.

2. ## client [:octocat:](https://github.com/hoodiehq/hoodie-client#readme) [![Build Status](https://travis-ci.org/hoodiehq/hoodie-client.svg?branch=master)](https://travis-ci.org/hoodiehq/hoodie-client) [![Coverage Status](https://coveralls.io/repos/hoodiehq/hoodie-client/badge.svg?branch=master)](https://coveralls.io/r/hoodiehq/hoodie-client?branch=master) [![Dependency Status](https://david-dm.org/hoodiehq/hoodie-client.svg)](https://david-dm.org/hoodiehq/hoodie-client)

   > Hoodie’s front-end client for the browser. It integrates Hoodie’s client
{'fraction_non_alphanumeric': 0.16552709460148995, 'fraction_numerical': 0.0009184610674558628, 'mean_word_length': 4.950212507589557, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 81, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7344033', 'n_tokens_mistral': 3382, 'n_tokens_neox': 3301, 'n_words': 612}