From 7d6cd684e5adcec3eeb7624dde364a4d3315ad3b Mon Sep 17 00:00:00 2001
From: Hugo Trentesaux <hugo@trentesaux.fr>
Date: Mon, 15 Apr 2024 12:16:34 +0200
Subject: [PATCH] refac doc

---
 README.md                 |  56 +++----
 doc/cesium-plus-import.md |  25 +++
 doc/scheme.svg            | 315 ++++++++++++++++++++++++++++++++++++++
 doc/start-indexer.md      |   9 ++
 doc/using-dev-tool.md     |   7 +
 5 files changed, 385 insertions(+), 27 deletions(-)
 create mode 100644 doc/cesium-plus-import.md
 create mode 100644 doc/scheme.svg
 create mode 100644 doc/start-indexer.md
 create mode 100644 doc/using-dev-tool.md

diff --git a/README.md b/README.md
index 90eae60..08d6936 100644
--- a/README.md
+++ b/README.md
@@ -1,46 +1,48 @@
-# ddd-indexer
+# Duniter Datapod
 
-"ddd-indexer" for Duniter Datapods Demo indexer
+Duniter Datapod is designed for offchain storage of Ğ1 data but does not depend on Duniter and could be used independantly. It contains multiple components:
 
-```sh
-pnpm install
-pnpm dev # for vue dev UI
-```
+- a "collector" which listens on pubsub and puts index requests in a timestamped [AMT](https://en.wikipedia.org/w/index.php?title=Array_mapped_trie&redirect=no)
+- an "indexer" which takes index requests of specific kinds and put them in a Postgres database to serve contente with Hasura GraphQL API
+- a dev tool in Vue to understand the architecture, explore the data, and debug
 
-## Import Cesium+ data
+![scheme](./doc/scheme.svg)
+> sheme of data flow in Duniter Datapod 
 
-After exporting the data to json files with the Rust script from `v2s-datapod`.
+## Use
 
-```sh
-# doImport()
-# takes about 200 seconds (4 minutes)
-time npx tsx src/scripts/cesium-plus-import.ts
-```
+TODO use in prod with docker
+
+## Dev
 
-You can then manually pin the cid according to the command output.
+To install dev dependencies
 
 ```sh
-ipfs pin add -r bafyreie74jtf23zzz2tdgsz7axfrm4pidje43ypqn25v4gkdtfjbcj62km
+# use node version 20
+nvm use 20
+# install dependencies
+pnpm install
 ```
 
-This will make easier to insert this data in any AMT or other data structure.
+Then start a kubo node with pubsub
 
 ```sh
-# doAllCplusCidsToAMT()
-# takes about 180 seconds
-time npx tsx src/scripts/cesium-plus-import.ts
-# bafyreiffn3kkrakf7qj5m3wepsoxjwcojmesfyoexsvsovx23nhbfqu6bq
+# start kubo node TODO put this in the docker
+ipfs daemon --enable-pubsub-experiment
+# start postgres / hasura
+docker compose up -d
 ```
 
-## Start collector and indexer
+Then start what you want (indexer, dev tool, c+ import) according to the following doc.
 
-To start pubsub collector to IPFS and database indexer
+## Doc
 
-```sh
-docker compose up -d
-npx tsx src/indexer/start.ts 
-```
+- [start the indexer](./doc/start-indexer.md) (dev mode)
+- [using dev tool](./doc/using-dev-tool.md) (for debugging)
+- [importing cesium plus data](./doc/cesium-plus-import.md) (advanced)
 
 ## TODO
 
-Insert pubkey instead of ss58 address if we want data to be compatible across networks
+- [ ] pubkey instead of ss58 address if we want data to be compatible across networks
+- [ ] document database change with tracking hasura console and squashing migrations
+- [ ] manage unpin requests when user/admin wants to delete data, see refcount
diff --git a/doc/cesium-plus-import.md b/doc/cesium-plus-import.md
new file mode 100644
index 0000000..65df4e3
--- /dev/null
+++ b/doc/cesium-plus-import.md
@@ -0,0 +1,25 @@
+
+## Import Cesium+ data
+
+After exporting the data to json files with the Rust script from `v2s-datapod`.
+
+```sh
+# doImport()
+# takes about 200 seconds (4 minutes)
+time npx tsx src/scripts/cesium-plus-import.ts
+```
+
+You can then manually pin the cid according to the command output.
+
+```sh
+ipfs pin add -r bafyreie74jtf23zzz2tdgsz7axfrm4pidje43ypqn25v4gkdtfjbcj62km
+```
+
+This will make easier to insert this data in any AMT or other data structure.
+
+```sh
+# doAllCplusCidsToAMT()
+# takes about 180 seconds
+time npx tsx src/scripts/cesium-plus-import.ts
+# bafyreiffn3kkrakf7qj5m3wepsoxjwcojmesfyoexsvsovx23nhbfqu6bq
+```
\ No newline at end of file
diff --git a/doc/scheme.svg b/doc/scheme.svg
new file mode 100644
index 0000000..bd12274
--- /dev/null
+++ b/doc/scheme.svg
@@ -0,0 +1,315 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   width="375.5303mm"
+   height="121.20483mm"
+   viewBox="0 0 375.5303 121.20482"
+   version="1.1"
+   id="svg1"
+   inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)"
+   sodipodi:docname="scheme.svg"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:svg="http://www.w3.org/2000/svg">
+  <sodipodi:namedview
+     id="namedview1"
+     pagecolor="#505050"
+     bordercolor="#eeeeee"
+     borderopacity="1"
+     inkscape:showpageshadow="0"
+     inkscape:pageopacity="0"
+     inkscape:pagecheckerboard="0"
+     inkscape:deskcolor="#505050"
+     inkscape:document-units="mm"
+     inkscape:zoom="0.72945683"
+     inkscape:cx="502.42863"
+     inkscape:cy="205.63246"
+     inkscape:window-width="2560"
+     inkscape:window-height="1371"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1"
+     inkscape:current-layer="layer1"
+     showgrid="false">
+    <inkscape:grid
+       id="grid12"
+       units="mm"
+       originx="-40.630054"
+       originy="-57.555912"
+       spacingx="1"
+       spacingy="1"
+       empcolor="#0099e5"
+       empopacity="0.30196078"
+       color="#0099e5"
+       opacity="0.14901961"
+       empspacing="5"
+       dotted="false"
+       gridanglex="30"
+       gridanglez="30"
+       visible="false" />
+  </sodipodi:namedview>
+  <defs
+     id="defs1">
+    <marker
+       style="overflow:visible"
+       id="marker12"
+       refX="0"
+       refY="0"
+       orient="auto-start-reverse"
+       inkscape:stockid="Wide arrow"
+       markerWidth="1"
+       markerHeight="1"
+       viewBox="0 0 1 1"
+       inkscape:isstock="true"
+       inkscape:collect="always"
+       preserveAspectRatio="xMidYMid">
+      <path
+         style="fill:none;stroke:context-stroke;stroke-width:1;stroke-linecap:butt"
+         d="M 3,-3 0,0 3,3"
+         transform="rotate(180,0.125,0)"
+         sodipodi:nodetypes="ccc"
+         id="path12" />
+    </marker>
+    <marker
+       style="overflow:visible"
+       id="ArrowWide"
+       refX="0"
+       refY="0"
+       orient="auto-start-reverse"
+       inkscape:stockid="Wide arrow"
+       markerWidth="1"
+       markerHeight="1"
+       viewBox="0 0 1 1"
+       inkscape:isstock="true"
+       inkscape:collect="always"
+       preserveAspectRatio="xMidYMid">
+      <path
+         style="fill:none;stroke:context-stroke;stroke-width:1;stroke-linecap:butt"
+         d="M 3,-3 0,0 3,3"
+         transform="rotate(180,0.125,0)"
+         sodipodi:nodetypes="ccc"
+         id="path2" />
+    </marker>
+  </defs>
+  <g
+     inkscape:label="Calque 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(2.5327683,-66.073998)">
+    <rect
+       style="font-variation-settings:normal;opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.529167;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;marker-end:url(#ArrowWide);stop-color:#000000;stop-opacity:1"
+       id="rect9"
+       width="375.5303"
+       height="121.20483"
+       x="-2.5327682"
+       y="66.073997" />
+    <text
+       xml:space="preserve"
+       style="font-size:7.05556px;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono, Normal';fill:none;stroke:#ff0000;stroke-width:1.269;stroke-linecap:round;stroke-linejoin:round"
+       x="18.213852"
+       y="114.05097"
+       id="text1"><tspan
+         sodipodi:role="line"
+         id="tspan1"
+         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.269"
+         x="18.213852"
+         y="114.05097">IN</tspan></text>
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.529167;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#ArrowWide)"
+       d="m 27.300618,112.13186 44.344417,1e-5"
+       id="path1"
+       sodipodi:nodetypes="cc" />
+    <rect
+       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.529167;stroke-dasharray:none;stroke-opacity:1"
+       id="rect2"
+       width="38.940617"
+       height="15.460637"
+       x="77.062294"
+       y="104.81455" />
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:26.6667px;line-height:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono, Normal';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.79622;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1"
+       x="337.3952"
+       y="430.5126"
+       id="text2"
+       transform="matrix(0.26458333,0,0,0.26458333,-8.013686,0.61372023)"><tspan
+         sodipodi:role="line"
+         id="tspan2"
+         x="337.3952"
+         y="430.5126">collector</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:26.6667px;line-height:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono, Normal';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.79622;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1"
+       x="154.32072"
+       y="395.14948"
+       id="text3"
+       transform="matrix(0.26458333,0,0,0.26458333,-1.7973375,1.8626738)"><tspan
+         sodipodi:role="line"
+         id="tspan3"
+         x="154.32072"
+         y="395.14948">pubsub</tspan></text>
+    <rect
+       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.529167;stroke-dasharray:none;stroke-opacity:1"
+       id="rect3"
+       width="38.940617"
+       height="15.460637"
+       x="167.02065"
+       y="104.81455" />
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:26.6667px;line-height:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono, Normal';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.79622;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1"
+       x="337.3952"
+       y="430.5126"
+       id="text4"
+       transform="matrix(0.26458333,0,0,0.26458333,81.944652,0.61372023)"><tspan
+         sodipodi:role="line"
+         id="tspan4"
+         x="337.3952"
+         y="430.5126">IPFS AMT</tspan></text>
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.529167;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#ArrowWide)"
+       d="m 119.37565,112.13186 44.34444,1e-5"
+       id="path4"
+       sodipodi:nodetypes="cc" />
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:26.6667px;line-height:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono, Normal';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.79622;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1"
+       x="154.32072"
+       y="395.14948"
+       id="text5"
+       transform="matrix(0.26458333,0,0,0.26458333,86.573503,1.8626738)"><tspan
+         sodipodi:role="line"
+         id="tspan5"
+         x="154.32072"
+         y="395.14948">kubo API</tspan></text>
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.529167;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#ArrowWide)"
+       d="M 180.17326,101.52313 V 80.356465"
+       id="path5"
+       sodipodi:nodetypes="cc" />
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:26.6667px;line-height:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono, Normal';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.79622;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1"
+       x="701.10736"
+       y="347.19754"
+       id="text6"
+       transform="matrix(0.26458333,0,0,0.26458333,-0.06350418,3.2134088)"><tspan
+         sodipodi:role="line"
+         id="tspan6"
+         x="701.10736"
+         y="347.19754">IPNS</tspan></text>
+    <rect
+       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.529167;stroke-dasharray:none;stroke-opacity:1"
+       id="rect6"
+       width="33.514088"
+       height="15.725221"
+       x="235.81238"
+       y="104.81455" />
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:26.6667px;line-height:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono, Normal';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.79622;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1"
+       x="337.3952"
+       y="430.5126"
+       id="text7"
+       transform="matrix(0.26458333,0,0,0.26458333,150.73635,0.61372023)"><tspan
+         sodipodi:role="line"
+         id="tspan7"
+         x="337.3952"
+         y="430.5126">Postgre</tspan></text>
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.529167;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#ArrowWide)"
+       d="m 209.33404,112.13186 21.69048,1e-5"
+       id="path7"
+       sodipodi:nodetypes="cc" />
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:26.6667px;line-height:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono, Normal';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.79622;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1"
+       x="154.32072"
+       y="395.14948"
+       id="text8"
+       transform="matrix(0.26458333,0,0,0.26458333,174.4152,1.8626738)"><tspan
+         sodipodi:role="line"
+         id="tspan8"
+         x="154.32072"
+         y="395.14948">SQL</tspan></text>
+    <rect
+       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.529167;stroke-dasharray:none;stroke-opacity:1"
+       id="rect8"
+       width="27.361441"
+       height="15.72522"
+       x="271.79568"
+       y="104.81455" />
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:26.6667px;line-height:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono, Normal';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.79622;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1"
+       x="337.3952"
+       y="430.5126"
+       id="text9"
+       transform="matrix(0.26458333,0,0,0.26458333,186.19053,0.61372023)"><tspan
+         sodipodi:role="line"
+         id="tspan9"
+         x="337.3952"
+         y="430.5126">Hasura</tspan></text>
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.529167;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#ArrowWide)"
+       d="m 304.5841,112.13186 34.98617,1e-5"
+       id="path9"
+       sodipodi:nodetypes="cc" />
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:26.6667px;line-height:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono, Normal';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.79622;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1"
+       x="154.32072"
+       y="395.14948"
+       id="text10"
+       transform="matrix(0.26458333,0,0,0.26458333,269.66526,1.8626738)"><tspan
+         sodipodi:role="line"
+         id="tspan10"
+         x="154.32072"
+         y="395.14948">GraphQL</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:26.6667px;line-height:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono, Normal';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.79622;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1"
+       x="1487.6732"
+       y="398.31827"
+       id="text11"
+       transform="matrix(0.26458333,0,0,0.26458333,-46.3904,8.9307213)"><tspan
+         sodipodi:role="line"
+         id="tspan11"
+         x="1487.6732"
+         y="398.31827">OUT</tspan></text>
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.529167;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:0.529167, 1.5875;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#marker12)"
+       d="m 96.837177,123.51808 -0.304575,14.96381 155.304578,0.0362 v -15"
+       id="path11"
+       sodipodi:nodetypes="cccc" />
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:26.6667px;line-height:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono, Normal';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.79622;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1"
+       x="154.32072"
+       y="395.14948"
+       id="text12"
+       transform="matrix(0.26458333,0,0,0.26458333,120.05885,43.332749)"><tspan
+         sodipodi:role="line"
+         id="tspan12"
+         x="154.32072"
+         y="395.14948">shortcut</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:26.6667px;line-height:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono, Normal';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.79622;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1"
+       x="604.0329"
+       y="550.3053"
+       id="text13"
+       transform="matrix(0.26458333,0,0,0.26458333,-27.198165,25.914284)"><tspan
+         sodipodi:role="line"
+         id="tspan13"
+         x="604.0329"
+         y="550.3053">Data flow in Duniter Datapod</tspan></text>
+    <path
+       style="font-variation-settings:normal;opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.529167;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1"
+       d="m 132.73173,174.25638 h 98.23899"
+       id="path13"
+       sodipodi:nodetypes="cc" />
+  </g>
+</svg>
diff --git a/doc/start-indexer.md b/doc/start-indexer.md
new file mode 100644
index 0000000..56df593
--- /dev/null
+++ b/doc/start-indexer.md
@@ -0,0 +1,9 @@
+## Start collector and indexer
+
+You first need to start a kubo node and postgres/hasura.
+Then start pubsub collector and database indexer with:
+
+```sh
+# start the collector and indexer
+npx tsx src/indexer/start.ts 
+```
diff --git a/doc/using-dev-tool.md b/doc/using-dev-tool.md
new file mode 100644
index 0000000..a6caeb3
--- /dev/null
+++ b/doc/using-dev-tool.md
@@ -0,0 +1,7 @@
+## Using dev tool
+
+The Duniter Datapod dev tool is a Vue app that helps understand how the system works, explore the data, and debug the indexer.
+
+```sh
+pnpm dev # for Vue dev tool UI
+```
\ No newline at end of file
-- 
GitLab