# platformer444/explorermaniac architecture

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

- Interactive diagram: https://gitdiagram.com/platformer444/explorermaniac
- Repository: https://github.com/platformer444/explorermaniac

## Overview

ExplorerManiac is a creature-collection application with a React web client and a Fastify API backed by PostgreSQL. The visible user workflow is registration or login, followed by authenticated user and creature-collection operations; the API also exposes creature catalog operations. The excerpts show the login and registration forms calling the API and database-backed API routes. The README is empty, and the server excerpt omits some route and middleware details, so uncertain links are not shown.

Main entry points: [`server/src/server.ts`](https://github.com/platformer444/explorermaniac/blob/master/server/src/server.ts) (Account routes), [`web/src/App.tsx`](https://github.com/platformer444/explorermaniac/blob/master/web/src/App.tsx) (Page routes), [`web/src/main.tsx`](https://github.com/platformer444/explorermaniac/blob/master/web/src/main.tsx) (Web entry), [`web/src/components/user/Register.tsx`](https://github.com/platformer444/explorermaniac/blob/master/web/src/components/user/Register.tsx) (Registration form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web client"]
  node_web_entry["Web entry<br/>[main.tsx]"]
  node_web_routes["Page routes<br/>[App.tsx]"]
  node_register_form["Registration form<br/>[Register.tsx]"]
  node_login_form["Login form<br/>[Login.tsx]"]
end

subgraph group_api["API"]
  node_api["Fastify API<br/>[server.ts]"]
  node_account_routes["Account routes<br/>[server.ts]"]
  node_session_auth["Session validation<br/>[server.ts]"]
end

subgraph group_domain["Creature domain"]
  node_creature_routes["Creature routes<br/>[server.ts]"]
  node_collection_routes["User collection routes<br/>[server.ts]"]
end

subgraph group_data["Persistence"]
  node_postgres[("PostgreSQL")]
  node_users_table["User schema<br/>[Users.ts]"]
  node_sessions_table["Session schema<br/>[Sessions.ts]"]
  node_creatures_table["Creature schema<br/>[creatures.ts]"]
  node_user_creatures_table["Collection schema<br/>[user-creatures.ts]"]
end

node_visitor(("User"))

node_visitor -->|"opens"| node_web_entry
node_web_entry -->|"renders"| node_web_routes
node_web_routes -->|"routes to"| node_register_form
node_web_routes -->|"routes to"| node_login_form
node_register_form -->|"POST register"| node_account_routes
node_login_form -->|"POST login"| node_account_routes
node_account_routes -->|"handled by"| node_api
node_creature_routes -->|"handled by"| node_api
node_collection_routes -->|"handled by"| node_api
node_api -->|"queries"| node_postgres
node_account_routes -->|"reads/writes"| node_postgres
node_session_auth -->|"checks sessions"| node_postgres
node_creature_routes -->|"reads/writes"| node_postgres
node_collection_routes -->|"reads/writes"| node_postgres
node_postgres -->|"stores"| node_users_table
node_postgres -->|"stores"| node_sessions_table
node_postgres -->|"stores"| node_creatures_table
node_postgres -->|"stores"| node_user_creatures_table

click node_web_entry "https://github.com/platformer444/explorermaniac/blob/master/web/src/main.tsx"
click node_web_routes "https://github.com/platformer444/explorermaniac/blob/master/web/src/App.tsx"
click node_register_form "https://github.com/platformer444/explorermaniac/blob/master/web/src/components/user/Register.tsx"
click node_login_form "https://github.com/platformer444/explorermaniac/blob/master/web/src/components/user/Login.tsx"
click node_api "https://github.com/platformer444/explorermaniac/blob/master/server/src/server.ts"
click node_account_routes "https://github.com/platformer444/explorermaniac/blob/master/server/src/server.ts"
click node_session_auth "https://github.com/platformer444/explorermaniac/blob/master/server/src/server.ts"
click node_creature_routes "https://github.com/platformer444/explorermaniac/blob/master/server/src/server.ts"
click node_collection_routes "https://github.com/platformer444/explorermaniac/blob/master/server/src/server.ts"
click node_users_table "https://github.com/platformer444/explorermaniac/blob/master/server/src/schema/Users.ts"
click node_sessions_table "https://github.com/platformer444/explorermaniac/blob/master/server/src/schema/Sessions.ts"
click node_creatures_table "https://github.com/platformer444/explorermaniac/blob/master/server/src/schema/creatures.ts"
click node_user_creatures_table "https://github.com/platformer444/explorermaniac/blob/master/server/src/schema/user-creatures.ts"

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_web_entry,node_web_routes,node_register_form,node_login_form,node_visitor toneBlue
class node_api,node_account_routes,node_session_auth toneAmber
class node_creature_routes,node_collection_routes toneMint
class node_postgres,node_users_table,node_sessions_table,node_creatures_table,node_user_creatures_table toneRose
```

## Components

### Web client

- [Web entry](https://github.com/platformer444/explorermaniac/blob/master/web/src/main.tsx): `web/src/main.tsx`
- [Page routes](https://github.com/platformer444/explorermaniac/blob/master/web/src/App.tsx): `web/src/App.tsx`
- [Registration form](https://github.com/platformer444/explorermaniac/blob/master/web/src/components/user/Register.tsx): `web/src/components/user/Register.tsx`
- [Login form](https://github.com/platformer444/explorermaniac/blob/master/web/src/components/user/Login.tsx): `web/src/components/user/Login.tsx`

### API

- [Fastify API](https://github.com/platformer444/explorermaniac/blob/master/server/src/server.ts): `server/src/server.ts`
- [Account routes](https://github.com/platformer444/explorermaniac/blob/master/server/src/server.ts): `server/src/server.ts`
- [Session validation](https://github.com/platformer444/explorermaniac/blob/master/server/src/server.ts): `server/src/server.ts`

### Creature domain

- [Creature routes](https://github.com/platformer444/explorermaniac/blob/master/server/src/server.ts): `server/src/server.ts`
- [User collection routes](https://github.com/platformer444/explorermaniac/blob/master/server/src/server.ts): `server/src/server.ts`

### Persistence

- **PostgreSQL**
- [User schema](https://github.com/platformer444/explorermaniac/blob/master/server/src/schema/Users.ts): `server/src/schema/Users.ts`
- [Session schema](https://github.com/platformer444/explorermaniac/blob/master/server/src/schema/Sessions.ts): `server/src/schema/Sessions.ts`
- [Creature schema](https://github.com/platformer444/explorermaniac/blob/master/server/src/schema/creatures.ts): `server/src/schema/creatures.ts`
- [Collection schema](https://github.com/platformer444/explorermaniac/blob/master/server/src/schema/user-creatures.ts): `server/src/schema/user-creatures.ts`

### Other components

- **User**

## Connections

- User → Web entry: opens
- Web entry → Page routes: renders
- Page routes → Registration form: routes to
- Page routes → Login form: routes to
- Registration form → Account routes: POST register
- Login form → Account routes: POST login
- Account routes → Fastify API: handled by
- Creature routes → Fastify API: handled by
- User collection routes → Fastify API: handled by
- Fastify API → PostgreSQL: queries
- Account routes → PostgreSQL: reads/writes
- Session validation → PostgreSQL: checks sessions
- Creature routes → PostgreSQL: reads/writes
- User collection routes → PostgreSQL: reads/writes
- PostgreSQL → User schema: stores
- PostgreSQL → Session schema: stores
- PostgreSQL → Creature schema: stores
- PostgreSQL → Collection schema: stores
