# fichiex/spirit-feeder architecture

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

- Interactive diagram: https://gitdiagram.com/fichiex/spirit-feeder
- Repository: https://github.com/fichiex/spirit-feeder

## Overview

Spirit Feeder is a Bible-learning pet game with account management, a study room, scripture reading and memorization, pet care, and competitive play. The principal path is player → mobile study experience → API-backed account, pet, and reading operations, alongside local study progress and room customization. Ranked battles, serpent battles, and friend invitations are distinct game branches. The excerpts establish selected client calls and server registration, but not all API handlers or storage details; unverified links are omitted.

Main entry points: [`mobile/src/app/study.tsx`](https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/app/study.tsx) (Study room), [`main.py`](https://github.com/fichiex/spirit-feeder/blob/main/main.py) (API application), [`mobile/src/components/study/MemorizeScreen.tsx`](https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/components/study/MemorizeScreen.tsx) (Verse practice), [`mobile/src/api/auth.ts`](https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/api/auth.ts) (Auth and game API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Mobile app"]
  node_authui["Sign in and register<br/>[RegisterForm.tsx]"]
  node_studyroute["Study room<br/>[study.tsx]"]
  node_session["Player session<br/>[session.ts]"]
  node_accountapi["Account API client<br/>[account.ts]"]
  node_authapi["Auth and game API<br/>[auth.ts]"]
end

subgraph group_study["Study and pet"]
  node_reader["Bible reader<br/>[BibleReader.tsx]"]
  node_memorizescreen["Verse practice<br/>[MemorizeScreen.tsx]"]
  node_memorydata[("Memory progress<br/>[verses.ts]")]
  node_decorui["Room customization<br/>[DecorMenu.tsx]"]
  node_decorstate[("Decoration inventory<br/>[items.ts]")]
  node_petart["Pet animation forms<br/>[forms.ts]"]
  node_food["Feed and care<br/>[FoodTray.tsx]"]
  node_testingui["Study tests<br/>[TestPanel.tsx]"]
end

subgraph group_play["Battles and friends"]
  node_battleui["Live battle screens<br/>[pvp.tsx]"]
  node_battlequestions["Battle questions<br/>[questions.ts]"]
  node_friendsui["Friends and invites<br/>[friends.ts]"]
  node_invitewatcher["Invite watcher<br/>[InviteWatcher.tsx]"]
end

subgraph group_server["Backend services"]
  node_serverapp["API application<br/>[main.py]"]
  node_accountservice["Account service<br/>[account.py]"]
  node_memorizeservice["Memorization service<br/>[memorize.py]"]
  node_testingservice["Testing service<br/>[testing.py]"]
  node_pvpservice["Ranked battle service<br/>[pvp.py]"]
  node_pvpquestions["Battle question bank<br/>[pvp_questions.py]"]
  node_friendservice["Friend service<br/>[friends.py]"]
  node_serpentservice["Serpent battle service<br/>[serpent.py]"]
end

node_player(("Player"))

node_player -->|"signs in"| node_authui
node_player -->|"studies"| node_studyroute
node_authui -->|"submits credentials"| node_authapi
node_authapi -->|"calls API"| node_serverapp
node_studyroute -->|"loads readings"| node_authapi
node_studyroute -->|"loads account"| node_accountapi
node_studyroute -->|"sets player"| node_session
node_studyroute -->|"opens scripture"| node_reader
node_studyroute -.->|"opens practice"| node_memorizescreen
node_studyroute -->|"opens decor"| node_decorui
node_studyroute -.->|"opens feeding"| node_food
node_studyroute -.->|"opens tests"| node_testingui
node_studyroute -->|"renders pet"| node_petart
node_memorizescreen -->|"loads progress"| node_memorydata
node_memorizescreen -->|"fetches XP"| node_serverapp
node_decorui -->|"loads inventory"| node_decorstate
node_serverapp -->|"registers routes"| node_accountservice
node_serverapp -->|"registers routes"| node_testingservice
node_serverapp -->|"registers routes"| node_memorizeservice
node_battleui -.->|"uses questions"| node_battlequestions
node_battleui -.->|"connects to game API"| node_serverapp
node_serverapp -.->|"optional setup"| node_pvpservice
node_pvpservice -->|"uses questions"| node_pvpquestions
node_friendsui -.->|"calls friend API"| node_serverapp
node_invitewatcher -->|"polls invites"| node_friendsui
node_serverapp -.->|"optional setup"| node_friendservice
node_friendservice -->|"delegates battle response"| node_pvpservice
node_serverapp -.->|"optional setup"| node_serpentservice

click node_authui "https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/components/auth/RegisterForm.tsx"
click node_studyroute "https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/app/study.tsx"
click node_session "https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/session.ts"
click node_accountapi "https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/api/account.ts"
click node_authapi "https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/api/auth.ts"
click node_reader "https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/components/study/BibleReader.tsx"
click node_memorizescreen "https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/components/study/MemorizeScreen.tsx"
click node_memorydata "https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/memorize/verses.ts"
click node_decorui "https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/components/study/DecorMenu.tsx"
click node_decorstate "https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/decor/items.ts"
click node_petart "https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/pets/forms.ts"
click node_food "https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/components/study/FoodTray.tsx"
click node_testingui "https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/components/study/TestPanel.tsx"
click node_battleui "https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/app/pvp.tsx"
click node_battlequestions "https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/battle/questions.ts"
click node_friendsui "https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/api/friends.ts"
click node_invitewatcher "https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/components/InviteWatcher.tsx"
click node_serverapp "https://github.com/fichiex/spirit-feeder/blob/main/main.py"
click node_accountservice "https://github.com/fichiex/spirit-feeder/blob/main/account.py"
click node_memorizeservice "https://github.com/fichiex/spirit-feeder/blob/main/memorize.py"
click node_testingservice "https://github.com/fichiex/spirit-feeder/blob/main/testing.py"
click node_pvpservice "https://github.com/fichiex/spirit-feeder/blob/main/pvp.py"
click node_pvpquestions "https://github.com/fichiex/spirit-feeder/blob/main/pvp_questions.py"
click node_friendservice "https://github.com/fichiex/spirit-feeder/blob/main/friends.py"
click node_serpentservice "https://github.com/fichiex/spirit-feeder/blob/main/serpent.py"

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_authui,node_studyroute,node_session,node_accountapi,node_authapi toneBlue
class node_reader,node_memorizescreen,node_memorydata,node_decorui,node_decorstate,node_petart,node_food,node_testingui toneAmber
class node_battleui,node_battlequestions,node_friendsui,node_invitewatcher toneMint
class node_serverapp,node_accountservice,node_memorizeservice,node_testingservice,node_pvpservice,node_pvpquestions,node_friendservice,node_serpentservice toneRose
class node_player toneIndigo
```

## Components

### Mobile app

- [Sign in and register](https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/components/auth/RegisterForm.tsx): `mobile/src/components/auth/RegisterForm.tsx`
- [Study room](https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/app/study.tsx): `mobile/src/app/study.tsx`
- [Player session](https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/session.ts): `mobile/src/session.ts`
- [Account API client](https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/api/account.ts): `mobile/src/api/account.ts`
- [Auth and game API](https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/api/auth.ts): `mobile/src/api/auth.ts`

### Study and pet

- [Bible reader](https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/components/study/BibleReader.tsx): `mobile/src/components/study/BibleReader.tsx`
- [Verse practice](https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/components/study/MemorizeScreen.tsx): `mobile/src/components/study/MemorizeScreen.tsx`
- [Memory progress](https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/memorize/verses.ts): `mobile/src/memorize/verses.ts`
- [Room customization](https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/components/study/DecorMenu.tsx): `mobile/src/components/study/DecorMenu.tsx`
- [Decoration inventory](https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/decor/items.ts): `mobile/src/decor/items.ts`
- [Pet animation forms](https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/pets/forms.ts): `mobile/src/pets/forms.ts`
- [Feed and care](https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/components/study/FoodTray.tsx): `mobile/src/components/study/FoodTray.tsx`
- [Study tests](https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/components/study/TestPanel.tsx): `mobile/src/components/study/TestPanel.tsx`

### Battles and friends

- [Live battle screens](https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/app/pvp.tsx): `mobile/src/app/pvp.tsx`
- [Battle questions](https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/battle/questions.ts): `mobile/src/battle/questions.ts`
- [Friends and invites](https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/api/friends.ts): `mobile/src/api/friends.ts`
- [Invite watcher](https://github.com/fichiex/spirit-feeder/blob/main/mobile/src/components/InviteWatcher.tsx): `mobile/src/components/InviteWatcher.tsx`

### Backend services

- [API application](https://github.com/fichiex/spirit-feeder/blob/main/main.py): `main.py`
- [Account service](https://github.com/fichiex/spirit-feeder/blob/main/account.py): `account.py`
- [Memorization service](https://github.com/fichiex/spirit-feeder/blob/main/memorize.py): `memorize.py`
- [Testing service](https://github.com/fichiex/spirit-feeder/blob/main/testing.py): `testing.py`
- [Ranked battle service](https://github.com/fichiex/spirit-feeder/blob/main/pvp.py): `pvp.py`
- [Battle question bank](https://github.com/fichiex/spirit-feeder/blob/main/pvp_questions.py): `pvp_questions.py`
- [Friend service](https://github.com/fichiex/spirit-feeder/blob/main/friends.py): `friends.py`
- [Serpent battle service](https://github.com/fichiex/spirit-feeder/blob/main/serpent.py): `serpent.py`

### Other components

- **Player**

## Connections

- Player → Sign in and register: signs in (evidence: `mobile/src/components/auth/RegisterForm.tsx`)
- Player → Study room: studies (evidence: `mobile/src/app/study.tsx`)
- Sign in and register → Auth and game API: submits credentials (evidence: `mobile/src/components/auth/RegisterForm.tsx`)
- Auth and game API → API application: calls API (evidence: `mobile/src/api/auth.ts`)
- Study room → Auth and game API: loads readings (evidence: `mobile/src/app/study.tsx`)
- Study room → Account API client: loads account (evidence: `mobile/src/app/study.tsx`)
- Study room → Player session: sets player (evidence: `mobile/src/app/study.tsx`)
- Study room → Bible reader: opens scripture (evidence: `mobile/src/app/study.tsx`)
- Study room → Verse practice: opens practice (evidence: `mobile/src/app/study.tsx`)
- Study room → Room customization: opens decor (evidence: `mobile/src/app/study.tsx`)
- Study room → Feed and care: opens feeding (evidence: `mobile/src/app/study.tsx`)
- Study room → Study tests: opens tests (evidence: `mobile/src/app/study.tsx`)
- Study room → Pet animation forms: renders pet (evidence: `mobile/src/app/study.tsx`)
- Verse practice → Memory progress: loads progress (evidence: `mobile/src/components/study/MemorizeScreen.tsx`)
- Verse practice → API application: fetches XP (evidence: `mobile/src/components/study/MemorizeScreen.tsx`)
- Room customization → Decoration inventory: loads inventory (evidence: `mobile/src/components/study/DecorMenu.tsx`)
- API application → Account service: registers routes (evidence: `main.py`)
- API application → Testing service: registers routes (evidence: `main.py`)
- API application → Memorization service: registers routes (evidence: `main.py`)
- Live battle screens → Battle questions: uses questions
- Live battle screens → API application: connects to game API
- API application → Ranked battle service: optional setup (evidence: `pvp.py`)
- Ranked battle service → Battle question bank: uses questions (evidence: `pvp.py`)
- Friends and invites → API application: calls friend API
- Invite watcher → Friends and invites: polls invites (evidence: `mobile/src/components/InviteWatcher.tsx`)
- API application → Friend service: optional setup (evidence: `friends.py`)
- Friend service → Ranked battle service: delegates battle response (evidence: `friends.py`)
- API application → Serpent battle service: optional setup (evidence: `main.py`)
