# kenichi-lover/nebula architecture

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

- Interactive diagram: https://gitdiagram.com/kenichi-lover/nebula
- Repository: https://github.com/kenichi-lover/nebula

## Overview

Nebula is a FastAPI publishing platform: users browse searchable, paginated notices, or register and sign in to create, edit, and soft-delete their own content. Requests enter through the board, notice, or auth routers; those handlers coordinate authentication and notice services, which use async database sessions and SQLModel entities. Markdown is rendered for the board and detail views. The README also documents dark mode, glass styling, responsive layout, and PostgreSQL migrations; the UI relationship is documented, while some template and auth wiring is only partially sampled.

Main entry points: [`app/routers/notice.py`](https://github.com/kenichi-lover/nebula/blob/main/app/routers/notice.py) (Notice routes), [`app/config/database.py`](https://github.com/kenichi-lover/nebula/blob/main/app/config/database.py) (Async database), [`app/routers/board.py`](https://github.com/kenichi-lover/nebula/blob/main/app/routers/board.py) (Board routes), [`app/routers/auth.py`](https://github.com/kenichi-lover/nebula/blob/main/app/routers/auth.py) (Auth routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["HTTP and views"]
  node_app["FastAPI app<br/>[main.py]"]
  node_board["Board routes<br/>[board.py]"]
  node_notice_routes["Notice routes<br/>[notice.py]"]
  node_auth_routes["Auth routes<br/>[auth.py]"]
end

subgraph group_identity["User identity"]
  node_auth_dependency["Auth dependency<br/>[auth.py]"]
  node_user_service["User service<br/>[user_service.py]"]
  node_user_model["User entity<br/>[user.py]"]
  node_jwt["JWT tokens<br/>[jwt.py]"]
  node_security["Password security<br/>[security.py]"]
end

subgraph group_publishing["Notice publishing"]
  node_notice_service["Notice service<br/>[notice_service.py]"]
  node_notice_model["Notice entity<br/>[notice.py]"]
  node_notice_schema["Notice schemas<br/>[notice.py]"]
  node_markdown["Markdown renderer<br/>[md_renderer.py]"]
  node_pagination["Pagination<br/>[pagination.py]"]
  node_slug["Slug generator<br/>[slug.py]"]
end

subgraph group_persistence["Data and configuration"]
  node_database[("Async database<br/>[database.py]")]
  node_settings["App settings<br/>[settings.py]"]
end

subgraph group_presentation["Web presentation"]
  node_templates["Jinja templates"]
  node_styles["Theme and styles"]
end

node_visitor(("Visitor"))
node_postgres[("PostgreSQL")]

node_visitor -->|"sends requests"| node_app
node_app -->|"registers routes"| node_board
node_app -->|"registers routes"| node_notice_routes
node_app -->|"registers routes"| node_auth_routes
node_board -->|"queries notices"| node_notice_service
node_board -->|"resolves user"| node_auth_dependency
node_board -->|"renders summaries"| node_markdown
node_board -->|"renders board"| node_templates
node_notice_routes -->|"manages notices"| node_notice_service
node_notice_routes -->|"checks identity"| node_auth_dependency
node_notice_routes -->|"renders content"| node_markdown
node_notice_routes -->|"builds page"| node_pagination
node_notice_routes -->|"renders views"| node_templates
node_notice_routes -->|"validates data"| node_notice_schema
node_auth_routes -->|"registers users"| node_user_service
node_auth_routes -->|"checks passwords"| node_security
node_auth_routes -->|"issues tokens"| node_jwt
node_auth_routes -->|"gets current user"| node_auth_dependency
node_auth_dependency -->|"loads user"| node_user_service
node_auth_dependency -->|"decodes token"| node_jwt
node_user_service -->|"hashes passwords"| node_security
node_user_service -->|"queries users"| node_user_model
node_notice_service -->|"queries notices"| node_notice_model
node_notice_service -->|"accepts data"| node_notice_schema
node_notice_service -->|"generates slugs"| node_slug
node_database -->|"reads settings"| node_settings
node_database -->|"registers entity"| node_notice_model
node_database -->|"registers entity"| node_user_model
node_database -->|"opens connections"| node_postgres
node_board -->|"gets sessions"| node_database
node_notice_routes -->|"gets sessions"| node_database
node_auth_routes -->|"gets sessions"| node_database
node_visitor -.->|"uses interface"| node_styles

click node_app "https://github.com/kenichi-lover/nebula/blob/main/main.py"
click node_board "https://github.com/kenichi-lover/nebula/blob/main/app/routers/board.py"
click node_notice_routes "https://github.com/kenichi-lover/nebula/blob/main/app/routers/notice.py"
click node_auth_routes "https://github.com/kenichi-lover/nebula/blob/main/app/routers/auth.py"
click node_auth_dependency "https://github.com/kenichi-lover/nebula/blob/main/app/dependencies/auth.py"
click node_user_service "https://github.com/kenichi-lover/nebula/blob/main/app/services/user_service.py"
click node_user_model "https://github.com/kenichi-lover/nebula/blob/main/app/models/user.py"
click node_jwt "https://github.com/kenichi-lover/nebula/blob/main/app/utils/jwt.py"
click node_security "https://github.com/kenichi-lover/nebula/blob/main/app/utils/security.py"
click node_notice_service "https://github.com/kenichi-lover/nebula/blob/main/app/services/notice_service.py"
click node_notice_model "https://github.com/kenichi-lover/nebula/blob/main/app/models/notice.py"
click node_notice_schema "https://github.com/kenichi-lover/nebula/blob/main/app/schemas/notice.py"
click node_markdown "https://github.com/kenichi-lover/nebula/blob/main/app/utils/md_renderer.py"
click node_pagination "https://github.com/kenichi-lover/nebula/blob/main/app/utils/pagination.py"
click node_slug "https://github.com/kenichi-lover/nebula/blob/main/app/utils/slug.py"
click node_database "https://github.com/kenichi-lover/nebula/blob/main/app/config/database.py"
click node_settings "https://github.com/kenichi-lover/nebula/blob/main/app/config/settings.py"
click node_templates "https://github.com/kenichi-lover/nebula/tree/main/templates"
click node_styles "https://github.com/kenichi-lover/nebula/tree/main/static"

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_app,node_board,node_notice_routes,node_auth_routes toneBlue
class node_auth_dependency,node_user_service,node_user_model,node_jwt,node_security,node_postgres toneAmber
class node_notice_service,node_notice_model,node_notice_schema,node_markdown,node_pagination,node_slug toneMint
class node_database,node_settings toneRose
class node_templates,node_styles,node_visitor toneIndigo
```

## Components

### HTTP and views

- [FastAPI app](https://github.com/kenichi-lover/nebula/blob/main/main.py): `main.py`
- [Board routes](https://github.com/kenichi-lover/nebula/blob/main/app/routers/board.py): `app/routers/board.py`
- [Notice routes](https://github.com/kenichi-lover/nebula/blob/main/app/routers/notice.py): `app/routers/notice.py`
- [Auth routes](https://github.com/kenichi-lover/nebula/blob/main/app/routers/auth.py): `app/routers/auth.py`

### User identity

- [Auth dependency](https://github.com/kenichi-lover/nebula/blob/main/app/dependencies/auth.py): `app/dependencies/auth.py`
- [User service](https://github.com/kenichi-lover/nebula/blob/main/app/services/user_service.py): `app/services/user_service.py`
- [User entity](https://github.com/kenichi-lover/nebula/blob/main/app/models/user.py): `app/models/user.py`
- [JWT tokens](https://github.com/kenichi-lover/nebula/blob/main/app/utils/jwt.py): `app/utils/jwt.py`
- [Password security](https://github.com/kenichi-lover/nebula/blob/main/app/utils/security.py): `app/utils/security.py`

### Notice publishing

- [Notice service](https://github.com/kenichi-lover/nebula/blob/main/app/services/notice_service.py): `app/services/notice_service.py`
- [Notice entity](https://github.com/kenichi-lover/nebula/blob/main/app/models/notice.py): `app/models/notice.py`
- [Notice schemas](https://github.com/kenichi-lover/nebula/blob/main/app/schemas/notice.py): `app/schemas/notice.py`
- [Markdown renderer](https://github.com/kenichi-lover/nebula/blob/main/app/utils/md_renderer.py): `app/utils/md_renderer.py`
- [Pagination](https://github.com/kenichi-lover/nebula/blob/main/app/utils/pagination.py): `app/utils/pagination.py`
- [Slug generator](https://github.com/kenichi-lover/nebula/blob/main/app/utils/slug.py): `app/utils/slug.py`

### Data and configuration

- [Async database](https://github.com/kenichi-lover/nebula/blob/main/app/config/database.py): `app/config/database.py`
- [App settings](https://github.com/kenichi-lover/nebula/blob/main/app/config/settings.py): `app/config/settings.py`

### Web presentation

- [Jinja templates](https://github.com/kenichi-lover/nebula/tree/main/templates): `templates`
- [Theme and styles](https://github.com/kenichi-lover/nebula/tree/main/static): `static`

### Other components

- **Visitor**
- **PostgreSQL**

## Connections

- Visitor → FastAPI app: sends requests (evidence: `README.md`)
- FastAPI app → Board routes: registers routes (evidence: `main.py`)
- FastAPI app → Notice routes: registers routes (evidence: `main.py`)
- FastAPI app → Auth routes: registers routes (evidence: `main.py`)
- Board routes → Notice service: queries notices (evidence: `app/routers/board.py`)
- Board routes → Auth dependency: resolves user (evidence: `app/routers/board.py`)
- Board routes → Markdown renderer: renders summaries (evidence: `app/routers/board.py`)
- Board routes → Jinja templates: renders board (evidence: `app/routers/board.py`)
- Notice routes → Notice service: manages notices (evidence: `app/routers/notice.py`)
- Notice routes → Auth dependency: checks identity (evidence: `app/routers/notice.py`)
- Notice routes → Markdown renderer: renders content (evidence: `app/routers/notice.py`)
- Notice routes → Pagination: builds page (evidence: `app/routers/notice.py`)
- Notice routes → Jinja templates: renders views (evidence: `app/routers/notice.py`)
- Notice routes → Notice schemas: validates data (evidence: `app/routers/notice.py`)
- Auth routes → User service: registers users (evidence: `app/routers/auth.py`)
- Auth routes → Password security: checks passwords (evidence: `app/routers/auth.py`)
- Auth routes → JWT tokens: issues tokens (evidence: `app/routers/auth.py`)
- Auth routes → Auth dependency: gets current user (evidence: `app/routers/auth.py`)
- Auth dependency → User service: loads user (evidence: `app/dependencies/auth.py`)
- Auth dependency → JWT tokens: decodes token (evidence: `app/dependencies/auth.py`)
- User service → Password security: hashes passwords (evidence: `app/services/user_service.py`)
- User service → User entity: queries users (evidence: `app/services/user_service.py`)
- Notice service → Notice entity: queries notices (evidence: `app/services/notice_service.py`)
- Notice service → Notice schemas: accepts data (evidence: `app/services/notice_service.py`)
- Notice service → Slug generator: generates slugs (evidence: `app/services/notice_service.py`)
- Async database → App settings: reads settings (evidence: `app/config/database.py`)
- Async database → Notice entity: registers entity (evidence: `app/config/database.py`)
- Async database → User entity: registers entity (evidence: `app/config/database.py`)
- Async database → PostgreSQL: opens connections (evidence: `app/config/database.py`)
- Board routes → Async database: gets sessions (evidence: `app/routers/board.py`)
- Notice routes → Async database: gets sessions (evidence: `app/routers/notice.py`)
- Auth routes → Async database: gets sessions (evidence: `app/routers/auth.py`)
- Visitor → Theme and styles: uses interface (evidence: `README.md`)
