# sswegy/votproekt architecture

> Architecture diagram of the GitHub repository sswegy/votproekt, 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/sswegy/votproekt
- Repository: https://github.com/sswegy/votproekt

## Overview

VOTProekt is a Reddit-like mobile app with a backend, Keycloak authentication, and MySQL storage behind a load balancer. The main documented workflow is signing in, browsing and publishing posts, with profile access through the app’s main tabs. Sampled code confirms login and the backend post endpoints; registration currently returns 501. Home, post-entry, profile, and database-pool internals were not sampled, so their wiring is left unspecified where it cannot be verified.

Main entry points: [`frontend/App.js`](https://github.com/sswegy/votproekt/blob/main/frontend/App.js) (Navigation), [`frontend/screens/MainScreen.js`](https://github.com/sswegy/votproekt/blob/main/frontend/screens/MainScreen.js) (Main tabs), [`backend/src/App.mjs`](https://github.com/sswegy/votproekt/blob/main/backend/src/App.mjs) (HTTP server), [`frontend/screens/LoginScreen.js`](https://github.com/sswegy/votproekt/blob/main/frontend/screens/LoginScreen.js) (Login screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile app"]
  node_app["Navigation<br/>[App.js]"]
  node_login["Login screen<br/>[LoginScreen.js]"]
  node_register["Register screen<br/>[RegisterScreen.js]"]
  node_main["Main tabs<br/>[MainScreen.js]"]
  node_home["Post feed<br/>[HomeScreen.js]"]
  node_newpost["New post<br/>[NewPostScreen.js]"]
  node_profile["Profile<br/>[ProfileScreen.js]"]
end

subgraph group_api["Backend API"]
  node_apiapp["HTTP server<br/>[App.mjs]"]
  node_authrouter["Auth routes<br/>[AuthRouter.mjs]"]
  node_postsrouter["Post routes<br/>[PostsRouter.mjs]"]
  node_postscontroller["Post operations"]
end

subgraph group_identity["Identity"]
  node_keycloak["Keycloak<br/>[realm-export.json]"]
  node_keycloakconfig["Identity config<br/>[KeycloakConfig.js]"]
end

subgraph group_data["Database"]
  node_dbpool["DB connection<br/>[DBConnector.mjs]"]
  node_proxy["SQL load balancer<br/>[proxysql.cnf]"]
  node_mysql[("MySQL cluster<br/>[source-my.cnf]")]
end

node_user(("App user"))

node_user -->|"uses"| node_app
node_app -->|"shows"| node_login
node_app -->|"shows"| node_register
node_app -->|"navigates"| node_main
node_main -->|"shows"| node_home
node_main -->|"shows"| node_profile
node_main -->|"opens"| node_newpost
node_login -->|"login request"| node_apiapp
node_register -->|"register request"| node_apiapp
node_apiapp -->|"dispatches"| node_authrouter
node_apiapp -->|"dispatches"| node_postsrouter
node_authrouter -->|"obtains grant"| node_keycloak
node_keycloakconfig -->|"configures"| node_keycloak
node_postsrouter -->|"calls"| node_postscontroller
node_postscontroller -->|"queries"| node_dbpool
node_dbpool -->|"SQL connection"| node_proxy
node_proxy -->|"routes queries"| node_mysql

click node_app "https://github.com/sswegy/votproekt/blob/main/frontend/App.js"
click node_login "https://github.com/sswegy/votproekt/blob/main/frontend/screens/LoginScreen.js"
click node_register "https://github.com/sswegy/votproekt/blob/main/frontend/screens/RegisterScreen.js"
click node_main "https://github.com/sswegy/votproekt/blob/main/frontend/screens/MainScreen.js"
click node_home "https://github.com/sswegy/votproekt/blob/main/frontend/screens/HomeScreen.js"
click node_newpost "https://github.com/sswegy/votproekt/blob/main/frontend/screens/NewPostScreen.js"
click node_profile "https://github.com/sswegy/votproekt/blob/main/frontend/screens/ProfileScreen.js"
click node_apiapp "https://github.com/sswegy/votproekt/blob/main/backend/src/App.mjs"
click node_authrouter "https://github.com/sswegy/votproekt/blob/main/backend/src/routers/AuthRouter.mjs"
click node_postsrouter "https://github.com/sswegy/votproekt/blob/main/backend/src/routers/PostsRouter.mjs"
click node_postscontroller "https://github.com/sswegy/votproekt/blob/main/backend/src/controllers/PostsController.mjs"
click node_keycloak "https://github.com/sswegy/votproekt/blob/main/keycloak/realm-export.json"
click node_keycloakconfig "https://github.com/sswegy/votproekt/blob/main/backend/src/KeycloakConfig.js"
click node_dbpool "https://github.com/sswegy/votproekt/blob/main/backend/src/controllers/DBConnector.mjs"
click node_proxy "https://github.com/sswegy/votproekt/blob/main/database/proxysql.cnf"
click node_mysql "https://github.com/sswegy/votproekt/blob/main/database/source-my.cnf"

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_login,node_register,node_main,node_home,node_newpost,node_profile,node_user toneBlue
class node_apiapp,node_authrouter,node_postsrouter,node_postscontroller toneAmber
class node_keycloak,node_keycloakconfig toneMint
class node_dbpool,node_proxy,node_mysql toneRose
```

## Components

### Mobile app

- [Navigation](https://github.com/sswegy/votproekt/blob/main/frontend/App.js): `frontend/App.js`
- [Login screen](https://github.com/sswegy/votproekt/blob/main/frontend/screens/LoginScreen.js): `frontend/screens/LoginScreen.js`
- [Register screen](https://github.com/sswegy/votproekt/blob/main/frontend/screens/RegisterScreen.js): `frontend/screens/RegisterScreen.js`
- [Main tabs](https://github.com/sswegy/votproekt/blob/main/frontend/screens/MainScreen.js): `frontend/screens/MainScreen.js`
- [Post feed](https://github.com/sswegy/votproekt/blob/main/frontend/screens/HomeScreen.js): `frontend/screens/HomeScreen.js`
- [New post](https://github.com/sswegy/votproekt/blob/main/frontend/screens/NewPostScreen.js): `frontend/screens/NewPostScreen.js`
- [Profile](https://github.com/sswegy/votproekt/blob/main/frontend/screens/ProfileScreen.js): `frontend/screens/ProfileScreen.js`

### Backend API

- [HTTP server](https://github.com/sswegy/votproekt/blob/main/backend/src/App.mjs): `backend/src/App.mjs`
- [Auth routes](https://github.com/sswegy/votproekt/blob/main/backend/src/routers/AuthRouter.mjs): `backend/src/routers/AuthRouter.mjs`
- [Post routes](https://github.com/sswegy/votproekt/blob/main/backend/src/routers/PostsRouter.mjs): `backend/src/routers/PostsRouter.mjs`
- [Post operations](https://github.com/sswegy/votproekt/blob/main/backend/src/controllers/PostsController.mjs): `backend/src/controllers/PostsController.mjs`

### Identity

- [Keycloak](https://github.com/sswegy/votproekt/blob/main/keycloak/realm-export.json): `keycloak/realm-export.json`
- [Identity config](https://github.com/sswegy/votproekt/blob/main/backend/src/KeycloakConfig.js): `backend/src/KeycloakConfig.js`

### Database

- [DB connection](https://github.com/sswegy/votproekt/blob/main/backend/src/controllers/DBConnector.mjs): `backend/src/controllers/DBConnector.mjs`
- [SQL load balancer](https://github.com/sswegy/votproekt/blob/main/database/proxysql.cnf): `database/proxysql.cnf`
- [MySQL cluster](https://github.com/sswegy/votproekt/blob/main/database/source-my.cnf): `database/source-my.cnf`

### Other components

- **App user**

## Connections

- App user → Navigation: uses
- Navigation → Login screen: shows
- Navigation → Register screen: shows
- Navigation → Main tabs: navigates
- Main tabs → Post feed: shows
- Main tabs → Profile: shows
- Main tabs → New post: opens
- Login screen → HTTP server: login request
- Register screen → HTTP server: register request
- HTTP server → Auth routes: dispatches
- HTTP server → Post routes: dispatches
- Auth routes → Keycloak: obtains grant
- Identity config → Keycloak: configures
- Post routes → Post operations: calls
- Post operations → DB connection: queries
- DB connection → SQL load balancer: SQL connection
- SQL load balancer → MySQL cluster: routes queries
