# kevinvdweert/subspace architecture

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

- Interactive diagram: https://gitdiagram.com/kevinvdweert/subspace
- Repository: https://github.com/kevinvdweert/subspace

## Overview

Subspace is a PHP/MySQL social platform. Users register or sign in, then browse a feed, publish posts, interact with posts, find people and content, and participate in themed spaces; profiles and administrative moderation support that activity. The sampled feed and space handlers directly query and update persistent data, while shared authentication and helper code provides session identity and reusable functions. Major features such as follows, comments, and reporting are documented but their implementation was not sampled, so their wiring is intentionally not inferred.

Main entry points: [`includes/auth.php`](https://github.com/kevinvdweert/subspace/blob/main/includes/auth.php) (Authentication and Blocks), [`database/base.sql`](https://github.com/kevinvdweert/subspace/blob/main/database/base.sql) (MySQL Data), [`index.php`](https://github.com/kevinvdweert/subspace/blob/main/index.php) (Home Feed), [`space.php`](https://github.com/kevinvdweert/subspace/blob/main/space.php) (Spaces)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and Profiles"]
  node_registration["Registration<br/>[register.php]"]
  node_login["Login<br/>[login.php]"]
  node_logout["Logout<br/>[logout.php]"]
  node_profile["User Profiles<br/>[profile.php]"]
end

subgraph group_social["Social Content"]
  node_feed["Home Feed<br/>[index.php]"]
  node_postdetail["Post View<br/>[post.php]"]
  node_social_actions["Comments and Follows"]
end

subgraph group_discovery["Discovery and Spaces"]
  node_spaces["Spaces<br/>[space.php]"]
  node_search["Search<br/>[search.php]"]
end

subgraph group_operations["Administration and Policy"]
  node_admin_dashboard["Admin Dashboard<br/>[index.php]"]
  node_post_moderation["Post Moderation<br/>[posts.php]"]
  node_user_moderation["User Moderation<br/>[users.php]"]
  node_policies["Policies and Contact"]
end

subgraph group_core["Shared Runtime"]
  node_auth["Authentication and Blocks<br/>[auth.php]"]
  node_helpers["Shared Helpers<br/>[helpers.php]"]
  node_database_access["Database Access<br/>[db.php]"]
end

node_visitor(("Visitor / User"))
node_mysql[("MySQL Data<br/>[base.sql]")]

node_visitor -->|"creates account"| node_registration
node_visitor -->|"signs in"| node_login
node_visitor -->|"browses and posts"| node_feed
node_visitor -->|"views profile"| node_profile
node_visitor -->|"joins and creates"| node_spaces
node_visitor -->|"searches"| node_search
node_registration -->|"uses identity"| node_auth
node_login -->|"authenticates"| node_auth
node_logout -->|"ends session"| node_auth
node_profile -->|"checks identity"| node_auth
node_feed -->|"checks access"| node_auth
node_spaces -->|"checks access"| node_auth
node_feed -->|"reads and writes"| node_mysql
node_postdetail -->|"loads post"| node_mysql
node_spaces -->|"reads and writes"| node_mysql
node_search -->|"searches records"| node_mysql
node_profile -->|"loads profile"| node_mysql
node_social_actions -->|"stores interactions"| node_mysql
node_auth -->|"requests connection"| node_database_access
node_database_access -->|"queries"| node_mysql
node_feed -->|"uses utilities"| node_helpers
node_spaces -->|"uses utilities"| node_helpers
node_search -->|"uses utilities"| node_helpers
node_admin_dashboard -->|"requires admin"| node_auth
node_post_moderation -->|"requires admin"| node_auth
node_user_moderation -->|"requires admin"| node_auth
node_admin_dashboard -->|"reads statistics"| node_mysql
node_post_moderation -->|"hides posts"| node_mysql
node_user_moderation -->|"blocks accounts"| node_mysql
node_visitor -->|"reads policies"| node_policies

click node_registration "https://github.com/kevinvdweert/subspace/blob/main/register.php"
click node_login "https://github.com/kevinvdweert/subspace/blob/main/login.php"
click node_logout "https://github.com/kevinvdweert/subspace/blob/main/logout.php"
click node_profile "https://github.com/kevinvdweert/subspace/blob/main/profile.php"
click node_feed "https://github.com/kevinvdweert/subspace/blob/main/index.php"
click node_postdetail "https://github.com/kevinvdweert/subspace/blob/main/post.php"
click node_spaces "https://github.com/kevinvdweert/subspace/blob/main/space.php"
click node_search "https://github.com/kevinvdweert/subspace/blob/main/search.php"
click node_admin_dashboard "https://github.com/kevinvdweert/subspace/blob/main/admin/index.php"
click node_post_moderation "https://github.com/kevinvdweert/subspace/blob/main/admin/posts.php"
click node_user_moderation "https://github.com/kevinvdweert/subspace/blob/main/admin/users.php"
click node_policies "https://github.com/kevinvdweert/subspace/tree/main/components"
click node_auth "https://github.com/kevinvdweert/subspace/blob/main/includes/auth.php"
click node_helpers "https://github.com/kevinvdweert/subspace/blob/main/includes/helpers.php"
click node_database_access "https://github.com/kevinvdweert/subspace/blob/main/includes/db.php"
click node_mysql "https://github.com/kevinvdweert/subspace/blob/main/database/base.sql"

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_registration,node_login,node_logout,node_profile,node_visitor toneBlue
class node_feed,node_postdetail,node_social_actions,node_mysql toneAmber
class node_spaces,node_search toneMint
class node_admin_dashboard,node_post_moderation,node_user_moderation,node_policies toneRose
class node_auth,node_helpers,node_database_access toneIndigo
```

## Components

### Identity and Profiles

- [Registration](https://github.com/kevinvdweert/subspace/blob/main/register.php): `register.php`
- [Login](https://github.com/kevinvdweert/subspace/blob/main/login.php): `login.php`
- [Logout](https://github.com/kevinvdweert/subspace/blob/main/logout.php): `logout.php`
- [User Profiles](https://github.com/kevinvdweert/subspace/blob/main/profile.php): `profile.php`

### Social Content

- [Home Feed](https://github.com/kevinvdweert/subspace/blob/main/index.php): `index.php`
- [Post View](https://github.com/kevinvdweert/subspace/blob/main/post.php): `post.php`
- **Comments and Follows**

### Discovery and Spaces

- [Spaces](https://github.com/kevinvdweert/subspace/blob/main/space.php): `space.php`
- [Search](https://github.com/kevinvdweert/subspace/blob/main/search.php): `search.php`

### Administration and Policy

- [Admin Dashboard](https://github.com/kevinvdweert/subspace/blob/main/admin/index.php): `admin/index.php`
- [Post Moderation](https://github.com/kevinvdweert/subspace/blob/main/admin/posts.php): `admin/posts.php`
- [User Moderation](https://github.com/kevinvdweert/subspace/blob/main/admin/users.php): `admin/users.php`
- [Policies and Contact](https://github.com/kevinvdweert/subspace/tree/main/components): `components`

### Shared Runtime

- [Authentication and Blocks](https://github.com/kevinvdweert/subspace/blob/main/includes/auth.php): `includes/auth.php`
- [Shared Helpers](https://github.com/kevinvdweert/subspace/blob/main/includes/helpers.php): `includes/helpers.php`
- [Database Access](https://github.com/kevinvdweert/subspace/blob/main/includes/db.php): `includes/db.php`

### Other components

- **Visitor / User**
- [MySQL Data](https://github.com/kevinvdweert/subspace/blob/main/database/base.sql): `database/base.sql`

## Connections

- Visitor / User → Registration: creates account
- Visitor / User → Login: signs in
- Visitor / User → Home Feed: browses and posts
- Visitor / User → User Profiles: views profile
- Visitor / User → Spaces: joins and creates
- Visitor / User → Search: searches
- Registration → Authentication and Blocks: uses identity
- Login → Authentication and Blocks: authenticates
- Logout → Authentication and Blocks: ends session
- User Profiles → Authentication and Blocks: checks identity
- Home Feed → Authentication and Blocks: checks access
- Spaces → Authentication and Blocks: checks access
- Home Feed → MySQL Data: reads and writes
- Post View → MySQL Data: loads post
- Spaces → MySQL Data: reads and writes
- Search → MySQL Data: searches records
- User Profiles → MySQL Data: loads profile
- Comments and Follows → MySQL Data: stores interactions
- Authentication and Blocks → Database Access: requests connection
- Database Access → MySQL Data: queries
- Home Feed → Shared Helpers: uses utilities
- Spaces → Shared Helpers: uses utilities
- Search → Shared Helpers: uses utilities
- Admin Dashboard → Authentication and Blocks: requires admin
- Post Moderation → Authentication and Blocks: requires admin
- User Moderation → Authentication and Blocks: requires admin
- Admin Dashboard → MySQL Data: reads statistics
- Post Moderation → MySQL Data: hides posts
- User Moderation → MySQL Data: blocks accounts
- Visitor / User → Policies and Contact: reads policies
