# vanter-tech/null architecture

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

- Interactive diagram: https://gitdiagram.com/vanter-tech/null
- Repository: https://github.com/vanter-tech/null

## Overview

1. **Repository shape**
   - This is a **monorepo** with three deployable pieces:
     - `null_services_frontend`: Angular client, also wrapped by **Tauri** for desktop packaging.
     - `null_services_backend`: Spring Boot monolith exposing the domain API and real-time services.
     - `null_services_gateway`: a separate Spring Boot gateway/edge service.

2. **Top-level request path**
   - Client traffic starts at the **gateway** or directly at the backend depending on deployment.
   - The backend is the system of record for auth, chat, social graph, and voice/session state.
   - The frontend talks to the backend through generated REST clients, plus WebSocket connections for live updates.

3. **Backend architecture**
   - The backend follows a classic **controller → service → repository** structure.
   - Domain packages are split by feature: `auth`, `user`, `role`, `server`, `conversation`, `message`, `friends`, `voice`, `email`, `kafka`, `websocket`, `security`, and `handler`.
   - Persistence is handled through repository interfaces, with **MongoDB** as the main datastore.

4. **Identity and security boundary**
   - Authentication is JWT-based.
   - `SecurityConfig`, `JwtFilter`, `JwtService`, and `UserDetailServiceImpl` form the security layer.
   - `auth` handles registration, login, and activation flows; `user`, `role`, and `token` model account state and issued tokens.
   - `GlobalExceptionHandler` and business error codes centralize API error responses.

5. **Core chat domain**
   - The chat model is split into:
     - **Servers** and **Channels** for Discord-style communities.
     - **Conversations** for direct or scoped dialogs.
     - **Messages** for persisted chat content.
     - **Friends** for social relationships and requests.
   - Controllers expose CRUD and workflow endpoints, while services enforce business rules and membership/access checks.

6. **Real-time communication**
   - The backend contains a dedicated `websocket` package with configuration and event listeners.
   - This is the live-update path for presence, messaging, and likely channel/server state changes.
   - The frontend has a WebSocket client service, so the architecture supports both REST for state changes and WebSockets for push updates.

7. **Asynchronous/event-driven path**
   - Kafka is used as an internal decoupling layer via `MessageProducer` and `MessageConsumer`.
   - This likely supports notifications, email dispatch, and other side effects that should not block user-facing requests.
   - The design separates command handling in the API from async processing in the event pipeline.

8. **Email and account activation**
   - The backend includes an `EmailService` and HTML template resources for activation mail.
   - The README indicates OTP/account activation emails are sent as part of the registration flow.
   - This is a side-channel workflow triggered by auth events, not by direct UI polling.

9. **Voice subsystem**
   - Voice support is modeled separately from text chat.
   - The backend has `VoiceController`, `VoicePresenceController`, `VoicePresenceService`, and `LiveKitService`.
   - This suggests an external or dedicated **LiveKit**-style service handles media transport, while the backend manages join/presence/control state.

10. **Frontend structure**
    - The Angular client is feature-oriented:
      - `pages/login`, `pages/register`, `pages/activate-account` for auth entry.
      - `modules/chat` for the main application surface.
    - Chat is further split into server, DM, member, user-panel, and modal components, which mirrors the backend domain boundaries.

11. **Frontend integration layer**
    - The frontend includes a generated API client under `src/app/services/api`.
    - That client contains typed models and services for authentication, users, servers, conversations, friends, messages, and voice.
    - Supporting services include:
      - HTTP token interception,
      - route guarding,
      - local auth/token management,
      - modal and navigation helpers,
      - WebSocket client integration.

12. **Packaging and runtime**
    - Angular is the primary UI runtime; Tauri suggests a desktop wrapper around the same frontend.
    - The backend and gateway are standard Maven/Spring Boot applications.
    - Local development is container-oriented, with `docker-compose.yml` used to coordinate supporting infrastructure.

13. **Infrastructure dependencies**
    - The README and file tree point to **MongoDB**, **Kafka**, and a local SMTP environment such as Maildev/Mailhog.
    - Those services form the non-application backbone for persistence, async processing, and email verification.
    - The architecture is therefore: UI client → gateway/backend → MongoDB/Kafka/SMTP/voice service, with WebSockets for live state propagation.

14. **Diagramming summary**
    - A useful architecture diagram should show:
      - the **Angular/Tauri client** as the user-facing shell,
      - the **gateway** as the edge entrypoint,
      - the **Spring Boot backend** as the domain core,
      - **MongoDB** as persistent storage,
      - **Kafka** as async event bus,
      - **SMTP** for activation mail,
      - **WebSocket/LiveKit** paths for real-time chat and voice.

Main entry points: [`null_services_backend/src/main/java/com/example/demo/NullApplication.java`](https://github.com/vanter-tech/null/blob/main/null_services_backend/src/main/java/com/example/demo/NullApplication.java) (Backend App), [`null_services_frontend/src/app`](https://github.com/vanter-tech/null/tree/main/null_services_frontend/src/app) (Angular UI), [`null_services_frontend/src/app/services/api`](https://github.com/vanter-tech/null/tree/main/null_services_frontend/src/app/services/api) (API Client), [`null_services_backend/src/main/java/com/example/demo/email`](https://github.com/vanter-tech/null/tree/main/null_services_backend/src/main/java/com/example/demo/email) (Email Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_frontend_shell["Angular UI<br/>angular client"]
  node_frontend_chat["Chat Module<br/>feature module"]
  node_frontend_api["API Client<br/>generated REST client"]
  node_frontend_tauri["Tauri Shell<br/>desktop wrapper"]
  node_frontend_auth_pages["Auth Pages<br/>ui pages"]
end

subgraph group_gateway["Gateway"]
  node_gateway_app["Gateway App<br/>spring boot edge"]
end

subgraph group_backend["Backend"]
  node_backend_app["Backend App<br/>spring boot monolith"]
  node_backend_security["Security"]
  node_backend_auth["Auth API<br/>authentication flow"]
  node_backend_identity["Identity<br/>account state"]
  node_backend_chat["Chat Domain<br/>messaging domain"]
  node_backend_presence["Realtime<br/>websocket events"]
  node_backend_async["Kafka Flow<br/>async pipeline"]
  node_backend_email["Email Service<br/>activation mail"]
  node_backend_voice["Voice"]
  node_backend_api_errors["API Errors<br/>exception handling"]
end

subgraph group_infra["Infrastructure"]
  node_mongo[("MongoDB<br/>datastore")]
  node_kafka["Kafka<br/>event bus"]
  node_smtp["SMTP<br/>mail relay"]
  node_livekit["LiveKit<br/>media service"]
end

node_frontend_shell -->|"routes to"| node_frontend_auth_pages
node_frontend_shell -->|"hosts"| node_frontend_chat
node_frontend_shell -->|"uses"| node_frontend_api
node_frontend_shell -.->|"packaged by"| node_frontend_tauri
node_frontend_api -->|"calls"| node_gateway_app
node_frontend_api -->|"calls"| node_backend_app
node_frontend_api -->|"websocket"| node_backend_presence
node_gateway_app -->|"routes to"| node_backend_app
node_backend_app -->|"protects with"| node_backend_security
node_backend_app -->|"exposes"| node_backend_auth
node_backend_app -->|"manages"| node_backend_identity
node_backend_app -->|"owns"| node_backend_chat
node_backend_app -->|"pushes"| node_backend_presence
node_backend_app -->|"emits"| node_backend_async
node_backend_app -->|"triggers"| node_backend_email
node_backend_app -->|"coordinates"| node_backend_voice
node_backend_app -->|"formats errors"| node_backend_api_errors
node_backend_identity -->|"persists to"| node_mongo
node_backend_chat -->|"persists to"| node_mongo
node_backend_auth -->|"sends via"| node_backend_email
node_backend_async -->|"publishes/consumes"| node_kafka
node_backend_email -->|"delivers via"| node_smtp
node_backend_voice -->|"integrates with"| node_livekit

click node_frontend_shell "https://github.com/vanter-tech/null/tree/main/null_services_frontend/src/app"
click node_frontend_chat "https://github.com/vanter-tech/null/tree/main/null_services_frontend/src/app/modules/chat"
click node_frontend_api "https://github.com/vanter-tech/null/tree/main/null_services_frontend/src/app/services/api"
click node_frontend_tauri "https://github.com/vanter-tech/null/tree/main/null_services_frontend/src-tauri"
click node_frontend_auth_pages "https://github.com/vanter-tech/null/tree/main/null_services_frontend/src/app/pages"
click node_gateway_app "https://github.com/vanter-tech/null/blob/main/null_services_gateway/src/main/java/com/fer/null_services_gateway/NullServicesGatewayApplication.java"
click node_backend_app "https://github.com/vanter-tech/null/blob/main/null_services_backend/src/main/java/com/example/demo/NullApplication.java"
click node_backend_security "https://github.com/vanter-tech/null/tree/main/null_services_backend/src/main/java/com/example/demo/security"
click node_backend_auth "https://github.com/vanter-tech/null/tree/main/null_services_backend/src/main/java/com/example/demo/auth"
click node_backend_identity "https://github.com/vanter-tech/null/tree/main/null_services_backend/src/main/java/com/example/demo/user"
click node_backend_chat "https://github.com/vanter-tech/null/tree/main/null_services_backend/src/main/java/com/example/demo/server"
click node_backend_presence "https://github.com/vanter-tech/null/tree/main/null_services_backend/src/main/java/com/example/demo/websocket"
click node_backend_async "https://github.com/vanter-tech/null/tree/main/null_services_backend/src/main/java/com/example/demo/kafka"
click node_backend_email "https://github.com/vanter-tech/null/tree/main/null_services_backend/src/main/java/com/example/demo/email"
click node_backend_voice "https://github.com/vanter-tech/null/tree/main/null_services_backend/src/main/java/com/example/demo/voice"
click node_backend_api_errors "https://github.com/vanter-tech/null/tree/main/null_services_backend/src/main/java/com/example/demo/handler"

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_frontend_shell,node_frontend_chat,node_frontend_api,node_frontend_tauri,node_frontend_auth_pages toneBlue
class node_gateway_app toneAmber
class node_backend_app,node_backend_security,node_backend_auth,node_backend_identity,node_backend_chat,node_backend_presence,node_backend_async,node_backend_email,node_backend_voice,node_backend_api_errors toneMint
class node_mongo,node_kafka,node_smtp,node_livekit toneRose
```

## Components

### Frontend

Angular client packaged with Tauri for desktop use.

- [Angular UI](https://github.com/vanter-tech/null/tree/main/null_services_frontend/src/app): angular client · Primary user-facing application shell and route entry. · `null_services_frontend/src/app`
- [Chat Module](https://github.com/vanter-tech/null/tree/main/null_services_frontend/src/app/modules/chat): feature module · Main chat experience with server, DM, member, and voice views. · `null_services_frontend/src/app/modules/chat`
- [API Client](https://github.com/vanter-tech/null/tree/main/null_services_frontend/src/app/services/api): generated REST client · Typed client layer for backend endpoints, models, auth, and websocket integration. · `null_services_frontend/src/app/services/api`
- [Tauri Shell](https://github.com/vanter-tech/null/tree/main/null_services_frontend/src-tauri): desktop wrapper · Native desktop packaging around the Angular frontend. · `null_services_frontend/src-tauri`
- [Auth Pages](https://github.com/vanter-tech/null/tree/main/null_services_frontend/src/app/pages): ui pages · Login, register, and account activation entry screens. · `null_services_frontend/src/app/pages`

### Gateway

Edge Spring Boot service for routing and deployment entry.

- [Gateway App](https://github.com/vanter-tech/null/blob/main/null_services_gateway/src/main/java/com/fer/null_services_gateway/NullServicesGatewayApplication.java): spring boot edge · Separate Spring Boot gateway used as an edge entrypoint. · `null_services_gateway/src/main/java/com/fer/null_services_gateway/NullServicesGatewayApplication.java`

### Backend

Domain Spring Boot monolith with REST, realtime, and async processing.

- [Backend App](https://github.com/vanter-tech/null/blob/main/null_services_backend/src/main/java/com/example/demo/NullApplication.java): spring boot monolith · Domain core that serves REST APIs, realtime events, and async handlers. · `null_services_backend/src/main/java/com/example/demo/NullApplication.java`
- [Security](https://github.com/vanter-tech/null/tree/main/null_services_backend/src/main/java/com/example/demo/security): jwt security · JWT filter, token service, user details, and security configuration. · `null_services_backend/src/main/java/com/example/demo/security`
- [Auth API](https://github.com/vanter-tech/null/tree/main/null_services_backend/src/main/java/com/example/demo/auth): authentication flow · Registration, login, and activation workflows. · `null_services_backend/src/main/java/com/example/demo/auth`
- [Identity](https://github.com/vanter-tech/null/tree/main/null_services_backend/src/main/java/com/example/demo/user): account state · User, role, token, and status persistence for identity management. · `null_services_backend/src/main/java/com/example/demo/user`
- [Chat Domain](https://github.com/vanter-tech/null/tree/main/null_services_backend/src/main/java/com/example/demo/server): messaging domain · Servers, channels, conversations, messages, and friends boundaries. · `null_services_backend/src/main/java/com/example/demo/server`
- [Realtime](https://github.com/vanter-tech/null/tree/main/null_services_backend/src/main/java/com/example/demo/websocket): websocket events · WebSocket configuration and event listeners for live updates. · `null_services_backend/src/main/java/com/example/demo/websocket`
- [Kafka Flow](https://github.com/vanter-tech/null/tree/main/null_services_backend/src/main/java/com/example/demo/kafka): async pipeline · Producer and consumer for internal decoupling and side effects. · `null_services_backend/src/main/java/com/example/demo/kafka`
- [Email Service](https://github.com/vanter-tech/null/tree/main/null_services_backend/src/main/java/com/example/demo/email): activation mail · HTML template-driven email delivery for account activation and notifications. · `null_services_backend/src/main/java/com/example/demo/email`
- [Voice](https://github.com/vanter-tech/null/tree/main/null_services_backend/src/main/java/com/example/demo/voice): voice control · Voice join, presence, and LiveKit integration for media sessions. · `null_services_backend/src/main/java/com/example/demo/voice`
- [API Errors](https://github.com/vanter-tech/null/tree/main/null_services_backend/src/main/java/com/example/demo/handler): exception handling · Centralized business error codes and global exception mapping. · `null_services_backend/src/main/java/com/example/demo/handler`

### Infrastructure

External datastores and side services used by the applications.

- **MongoDB**: datastore · Primary persistence for users, chat state, tokens, and related domain records.
- **Kafka**: event bus · Internal asynchronous message transport.
- **SMTP**: mail relay · Outbound email channel for activation and related messages.
- **LiveKit**: media service · External voice/media transport used by the backend voice subsystem.

## Connections

- Angular UI → Auth Pages: routes to · Authentication entry screens are part of the UI flow.
- Angular UI → Chat Module: hosts · Main application shell contains the chat workspace.
- Angular UI → API Client: uses · UI calls backend through generated API services and models.
- Angular UI → Tauri Shell: packaged by · Same Angular app can be wrapped for desktop runtime.
- API Client → Gateway App: calls · Client can talk to the gateway as edge entrypoint.
- API Client → Backend App: calls · Client can also talk directly to backend depending on deployment.
- API Client → Realtime: websocket · Frontend websocket client connects for live updates.
- Gateway App → Backend App: routes to · Gateway forwards domain traffic to the backend core.
- Backend App → Security: protects with · Security layer gates API access with JWT validation.
- Backend App → Auth API: exposes · Authentication controller and service handle signup/login/activation.
- Backend App → Identity: manages · User, role, token, and status state are persisted here.
- Backend App → Chat Domain: owns · Servers, channels, conversations, messages, and friends live in the domain core.
- Backend App → Realtime: pushes · WebSocket layer publishes live state changes and events.
- Backend App → Kafka Flow: emits · Domain actions can be handed off to async processing.
- Backend App → Email Service: triggers · Registration and activation flows send mail through this service.
- Backend App → Voice: coordinates · Voice join and presence control are handled separately from text chat.
- Backend App → API Errors: formats errors · Central handler maps business failures into API responses.
- Identity → MongoDB: persists to · Users, roles, and tokens are stored in MongoDB.
- Chat Domain → MongoDB: persists to · Chat and social graph data is stored in MongoDB.
- Auth API → Email Service: sends via · Activation flow relies on email delivery.
- Kafka Flow → Kafka: publishes/consumes · Producer and consumer connect the backend to Kafka.
- Email Service → SMTP: delivers via · Emails are sent through SMTP infrastructure.
- Voice → LiveKit: integrates with · Media transport is handled by an external LiveKit-style service.
