# misted91/compteurdepas architecture

> Architecture diagram of the GitHub repository misted91/compteurdepas, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/misted91/compteurdepas
- Repository: https://github.com/misted91/compteurdepas

## Overview

This is a browser-based step counter. The user starts sensor listening, motion events are evaluated against peak, rotation, and cooldown thresholds, and detected steps update the displayed count and trigger persistence. Google sign-in enables per-user Firestore sync; localStorage provides fallback. A service worker caches the app shell for offline access. The README is empty, so capabilities and relationships here are limited to the supplied source excerpts; the HTML and styles are present in the tree but were not sampled.

Main entry points: [`script.js`](https://github.com/misted91/compteurdepas/blob/main/script.js) (Step counter), [`sw.js`](https://github.com/misted91/compteurdepas/blob/main/sw.js) (Service worker), [`index.html`](https://github.com/misted91/compteurdepas/blob/main/index.html) (App shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_tracking["Step tracking"]
  node_counter["Step counter<br/>[script.js]"]
end

subgraph group_persistence["Count persistence"]
  node_local[("Local storage")]
end

subgraph group_offline["Offline app"]
  node_service_worker["Service worker<br/>[sw.js]"]
  node_app_shell["App shell<br/>[index.html]"]
end

node_user(("User"))
node_motion["Motion sensors"]
node_firebase_auth["Firebase Auth"]
node_firestore[("Firestore")]

node_user -->|"starts tracking"| node_counter
node_motion -->|"sends sensor events"| node_counter
node_counter -->|"reads and writes"| node_local
node_counter -->|"authenticates with"| node_firebase_auth
node_counter -->|"loads and saves steps"| node_firestore
node_service_worker -->|"caches assets"| node_app_shell

click node_counter "https://github.com/misted91/compteurdepas/blob/main/script.js"
click node_service_worker "https://github.com/misted91/compteurdepas/blob/main/sw.js"
click node_app_shell "https://github.com/misted91/compteurdepas/blob/main/index.html"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_counter,node_user toneBlue
class node_local,node_firestore toneAmber
class node_service_worker,node_app_shell toneMint
class node_motion,node_firebase_auth toneIndigo
```

## Components

### Step tracking

- [Step counter](https://github.com/misted91/compteurdepas/blob/main/script.js): `script.js`

### Count persistence

- **Local storage**

### Offline app

- [Service worker](https://github.com/misted91/compteurdepas/blob/main/sw.js): `sw.js`
- [App shell](https://github.com/misted91/compteurdepas/blob/main/index.html): `index.html`

### Other components

- **User**
- **Motion sensors**
- **Firebase Auth**
- **Firestore**

## Connections

- User → Step counter: starts tracking (evidence: `script.js`)
- Motion sensors → Step counter: sends sensor events (evidence: `script.js`)
- Step counter → Local storage: reads and writes (evidence: `script.js`)
- Step counter → Firebase Auth: authenticates with (evidence: `script.js`)
- Step counter → Firestore: loads and saves steps (evidence: `script.js`)
- Service worker → App shell: caches assets (evidence: `sw.js`)
