# Kinto
# «A lightweight JSON storage service with synchronisation and sharing abilities.»
# It's a FOXING DATABASE!
# For the Web.
# That syncs.
# With permissions.
# We all build JavaScript applications.
# Sometimes, these applications need to store data.
## A new idea?
- Design the API (URL and protocol)
- Implement the server parts
- Deploy, scale, etc.
- Consume the API on the client.
------
Aren't you tired of doing the same things over and over again?
## With Kinto
1. Deploy an instance (ops are happy to do it, they know it!)
2. Integrate with one of the existing clients (Kinto.js, Kinto.py)
3. ???
4. Profit !
## Use cases
- Addons blocklists (Graphic cards drivers, Addons, etc.)
- OneCRL — SSL Certificate Revocation Lists
- Fennec OTA (Hyphenation and fonts)
- Whatever you want to sync in Firefox!
## Offline first
## Features
- Synchronisation
- Permissions
- Push notifications
- Ops friendly
## Ecosystem
- Kinto.js (landed in firefox!), kinto.py
- Encrypt if you need (WebCrypto)
- Data signing (*)
- File storage (*)
## Capitalize
-----
- Do not reinvent everything each time
- Respect HTTP best practices
- Ease the job for Ops
- Keep the good ideas of Firefox Sync.
## Other solutions
- Parse / Firebase, but open source
- Remote Storage
- CouchDB / PouchDB
- Sync
## Put back the user in control.
-----
- Optional validation of the data schema
- Encryption made easy (webcrypto + kinto.js)
- Permissions → mutualise the deployment
![](./images/concepts-general.png)
```perl
/buckets/{bucket_id}
/collections/{collection_id}
/records/{record_id}
```
GET /v1/buckets/blog/collections/articles
```javascript
{
"data": {
"id": "articles",
"last_modified": 1251800520143,
"title": "Blog title",
"description": "This is a blog description",
"link": "http://www.example.com/main.html"
},
"permissions": { "write": ["userid:VonkkVZo"] }
}
```
![](./images/concepts-permissions.png)
GET /v1/buckets/blog/collections/articles/records
```javascript
{
"data": [
{
"id": "7bd204c6-1655-4c27-aeee-53f933c5395f",
"last_modified": 1252254000464,
"title": "Example entry",
"description": "Here is some text.",
"link": "http://www.example.com/blog/post/1"
}
]
}
```
GET /v1/buckets/blog/collections/articles/records
```http
HTTP/1.1 200 OK
Content-Length: 195
Content-Type: application/json; charset=UTF-8
Date: Wed, 09 Dec 2015 12:31:16 GMT
ETag: "1449664217446"
Last-Modified: Wed, 09 Dec 2015 12:30:17 GMT
Total-Records: 1
```
## Fetching what changed
```perl
GET /v1/buckets/blog/collections/articles
/records?_since=1449664217446
HTTP/1.1 200 OK
ETag: "1449664217446"
Total-Records: 0
{"data": []}
```
## Only if it changed
```perl
GET /v1/buckets/blog/collections/articles
/records?_since=1449664217446
If-None-Match: "1449664217446"
HTTP/1.1 304 Not Modified
Date: Wed, 09 Dec 2015 12:37:22 GMT
ETag: "1449664217446"
```
## Update only if it didn't change
```perl
PATCH /v1/buckets/blog/collections/articles
/records/7bd204c6-1655-4c27-aeee-53f933c5395f
If-Match: "1449664217446"
HTTP/1.1 412 Precondition Failed
ETag: "1449664217450"
```
```js
{
"code": 412,
"details": {
"existing": {
"id": "7bd204...95f",
"last_modified": 1449664217450,
"title": "Hello world!"
}
},
"errno": 114,
"error": "Precondition Failed",
"message": "Resource was modified meanwhile"
}
```
Demo time!
## Crédits
- [Hersson Piratoba, "¡Nube Voladora!"](https://www.flickr.com/photos/nossreh/16753088479)
- [Gonzalo Merat, "Really Bored Kenzo"](https://www.flickr.com/photos/gonzalomerat/4852691103)
- [Kitty Terwolbeck, "Half way looking at the road map"](https://www.flickr.com/photos/kittysfotos/6362818709)
- [Charles Dawley, "Polaris - Star Trails Iridium flare"](https://www.flickr.com/photos/odalaigh/1482685365)
- [Geraint Rowland, "Towards The Future (Oslo) Explored"](https://www.flickr.com/photos/geezaweezer/5897955778)
- [KylaBorg, "Privacy"](https://www.flickr.com/photos/kylaborg/12887906353)
- [Angie Torres, "Goal setting"](https://www.flickr.com/photos/angietorres/4564135455)
## Crédits ²
- [Benjamin Disinger, "Horizon"](https://www.flickr.com/photos/bendisinger/15383035222)
- [Uditha Wickramanayaka, "Love"](https://www.flickr.com/photos/126915310@N08/16332829367)
- [Jeremy Brooks, "Products"](https://www.flickr.com/photos/jeremybrooks/5401494223)
- [Nick Bramhall, "Light Pollution"](https://www.flickr.com/photos/black_friction/5628330687)
- [Skånska Matupplevelser, "House, Autumn"](https://www.flickr.com/photos/matupplevelser/4644386646)
- [Christoph Rupprecht, "Leaf Structure X1"](https://www.flickr.com/photos/focx/5485671820)
- [Valery Kenski, "Conversation"](https://www.flickr.com/photos/95222905@N02/10997835056)