<commit_before>Cozy Cloud
==========

What is Cozy Cloud?
-------------------

Cozy Cloud is a personal platform as a service with a focus on data.
Cozy Cloud can be seen as 4 layers, from inside to outside:

1. A place to keep your personnal data
2. A core API to handle the data
3. Your web apps, and also the mobile & desktop clients
4. A coherent User Experience

It's also a set of values: Simple, Versatile, Yours. These values mean a lot
for Cozy Cloud in all aspects. From an architectural point, it declines to:

- Simple to deploy and understand, not built as a galaxy of optimized
  microservices managed by kubernetes that only experts can debug.
- Versatile, can be hosted on a Raspberry Pi for geeks to massive scale on
  multiple servers by specialized hosting.
- Yours, you own your data and you control them. If you want to take back your
  data to go elsewhere, you can.


Overview
--------

![Architecture for a self-hosted](self-hosted.png)

![Architecture for a big instance](big-instance.png)

**TODO**

- explain the many couchdb databases
- List konnectors / jobs
- say a word on metrics
- explain auth for users + apps + context
- explain permissions
- how to add a cozy instance to a farm
- context for sharing a photos album
- migration from current
- import/export data ("you will stay because you can leave")

----

A single executable
Stateless
Elastic
- can be self-hosted
- farms of 1000 - 10000 cozys
CouchDB for data
Open Stack for files
A jobs service (scheduler + queues)
Apps that run in the browser


Services
--------

The cozy stack came with several services. They run on the server, inside the
golang processus and have an HTTP interface.

### Authentication `/auth`

The cozy stack can authenticate the owner of a cozy instance. This can happen
in the classical web style, with a form and a cookie, but also with OAuth2 for
remote interactions like cozy-mobile and cozy-desktop.

### Applications `/apps`

It's possible to manage serverless applications from the cozy stack and serve
them via cozy stack. The stack does the routing and serve the HTML and the
assets for the applications.

### Data `/data`
<commit_msg>Write an overview of the architecture<commit_after>Cozy Cloud
==========

What is Cozy Cloud?
-------------------

Cozy Cloud is a personal platform as a service with a focus on data.
Cozy Cloud can be seen as 4 layers, from inside to outside:

1. A place to keep your personnal data
2. A core API to handle the data
3. Your web apps, and also the mobile & desktop clients
4. A coherent User Experience

It's also a set of values: Simple, Versatile, Yours. These values mean a lot
for Cozy Cloud in all aspects. From an architectural point, it declines to:

- Simple to deploy and understand, not built as a galaxy of optimized
  microservices managed by kubernetes that only experts can debug.
- Versatile, can be hosted on a Raspberry Pi for geeks to massive scale on
  multiple servers by specialized hosting.
- Yours, you own your data and you control them. If you want to take back your
  data to go elsewhere, you can.


Overview
--------

The architecture of Cozy Cloud is composed of:

- a reverse proxy that can accept https connexions and forward them
- the cozy stack
- a couchdb instance to persist the JSON documents
- a space for storing files.

All of this can run on a personal server, self-hosted at home, like a
Raspberry Pi:

![Architecture for a self-hosted](self-hosted.png)

But it's also possible to deploy a farm of servers for hosting thousands of
cozy instances. It will looks like this:

![Architecture for a big instance](big-instance.png)

This elasticity comes with some constraints:

- most applications are run in the browser, not in the server
- what must run on the server is mutualized inside the cozy stack
- the cozy stack is stateless
- the data are stored in couchdb and a space for files
- a couchdb database is specific to an instance (no mix of data from 2 users
  in the same database).


The Cozy Stack
--------------

**TODO**

- explain the many couchdb databases
- List konnectors / jobs
- say a word on metrics
- explain auth for users + apps + context
- explain permissions
- how to add a cozy instance to a farm
- context for sharing a photos album
- migration from current
- import/export data ("you will stay because you can leave")
- A single executable


Services
--------

The cozy stack came with several services. They run on the server, inside the
golang processus and have an HTTP interface.

### Authentication `/auth`

The cozy stack can authenticate the owner of a cozy instance. This can happen
in the classical web style, with a form and a cookie, but also with OAuth2 for
remote interactions like cozy-mobile and cozy-desktop.

### Applications `/apps`

It's possible to manage serverless applications from the cozy stack and serve
them via cozy stack. The stack does the routing and serve the HTML and the
assets for the applications.

### Data `/data`

{'fraction_non_alphanumeric': 0.06726907630522089, 'fraction_numerical': 0.004417670682730923, 'mean_word_length': 3.515865820489574, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3994126', 'n_tokens_mistral': 1360, 'n_tokens_neox': 1279, 'n_words': 790}