# kesthav/appartex architecture

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

## Overview

Appartex is a real-estate management web application for independent property owners, with tenant-facing access and public apartment browsing. The primary workflow is to authenticate, browse or manage properties, and maintain related tenants, contracts, bills, repairs, tasks, messages, and status histories. The React client calls a Koa API; MongoDB persists application records. The graph retains the major capabilities documented by the routes and file tree. Several route implementations were not sampled, so their detailed handler-to-model wiring is not inferred.

Main entry points: [`server/routes/index.js`](https://github.com/kesthav/appartex/blob/master/server/routes/index.js) (API route registry), [`server/middlewares`](https://github.com/kesthav/appartex/tree/master/server/middlewares) (JWT and role checks), [`server/routes/auth.js`](https://github.com/kesthav/appartex/blob/master/server/routes/auth.js) (Authentication API), [`client/src/middlewares/ContextAPI.jsx`](https://github.com/kesthav/appartex/blob/master/client/src/middlewares/ContextAPI.jsx) (Client data context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["React application<br/>[App.js]"]
  node_publicbrowse["Apartment browsing<br/>[main.jsx]"]
  node_ownerpages["Owner workspace"]
  node_tenantpages["Tenant workspace<br/>[tenantboard.jsx]"]
  node_authui["Login and signup"]
  node_context["Client data context<br/>[ContextAPI.jsx]"]
  node_authroutes["Route access<br/>[AuthRoutes.jsx]"]
end

subgraph group_api["API and access"]
  node_apiindex["API route registry<br/>[index.js]"]
  node_server["Koa server<br/>[server.js]"]
  node_authapi["Authentication API<br/>[auth.js]"]
  node_access["JWT and role checks"]
end

subgraph group_property["Property management"]
  node_propertyroutes["Property records API"]
  node_propertymodels["Buildings and apartments"]
  node_tenantcontract["Tenant and contract API"]
  node_tenantmodels["Tenant and contract records"]
end

subgraph group_operations["Work and records"]
  node_finance["Bills and histories"]
  node_work["Tasks and repairs"]
  node_messaging["Messages and comments<br/>[messages.js]"]
  node_statuses["Status histories"]
  node_workmodels["Work record models"]
end

subgraph group_storage["Persistence"]
  node_mongo[("MongoDB")]
end

node_visitor(("Visitor / user"))

node_visitor -->|"opens"| node_app
node_app -->|"routes through"| node_authroutes
node_visitor -->|"browses"| node_publicbrowse
node_publicbrowse -->|"reads listings"| node_context
node_visitor -->|"authenticates"| node_authui
node_authui -->|"submits credentials"| node_authapi
node_ownerpages -->|"requests data"| node_context
node_tenantpages -->|"uses tenant data"| node_context
node_context -->|"sends API requests"| node_server
node_server -->|"dispatches routes"| node_apiindex
node_apiindex -->|"registers"| node_authapi
node_apiindex -->|"registers"| node_propertyroutes
node_apiindex -->|"registers"| node_tenantcontract
node_apiindex -->|"registers"| node_finance
node_apiindex -->|"registers"| node_work
node_apiindex -->|"registers"| node_messaging
node_apiindex -->|"registers"| node_statuses
node_authapi -->|"uses auth checks"| node_access
node_propertyroutes -->|"uses access checks"| node_access
node_tenantcontract -->|"uses access checks"| node_access
node_finance -->|"uses access checks"| node_access
node_work -->|"uses access checks"| node_access
node_messaging -->|"uses access checks"| node_access
node_statuses -->|"uses access checks"| node_access
node_propertyroutes -->|"manages records"| node_propertymodels
node_tenantcontract -->|"manages records"| node_tenantmodels
node_finance -->|"uses record models"| node_workmodels
node_work -->|"manages records"| node_workmodels
node_statuses -->|"records histories"| node_workmodels
node_authapi -->|"persists accounts"| node_mongo
node_propertymodels -->|"persists property data"| node_mongo
node_tenantmodels -->|"persists tenant data"| node_mongo
node_workmodels -->|"persists work data"| node_mongo

click node_app "https://github.com/kesthav/appartex/blob/master/client/src/App.js"
click node_publicbrowse "https://github.com/kesthav/appartex/blob/master/client/src/pages/main.jsx"
click node_ownerpages "https://github.com/kesthav/appartex/tree/master/client/src/pages/ownerpages"
click node_tenantpages "https://github.com/kesthav/appartex/blob/master/client/src/pages/tenantpages/tenantboard.jsx"
click node_authui "https://github.com/kesthav/appartex/tree/master/client/src/components/landingPage"
click node_context "https://github.com/kesthav/appartex/blob/master/client/src/middlewares/ContextAPI.jsx"
click node_authroutes "https://github.com/kesthav/appartex/blob/master/client/src/middlewares/AuthRoutes.jsx"
click node_apiindex "https://github.com/kesthav/appartex/blob/master/server/routes/index.js"
click node_server "https://github.com/kesthav/appartex/blob/master/server/server.js"
click node_authapi "https://github.com/kesthav/appartex/blob/master/server/routes/auth.js"
click node_access "https://github.com/kesthav/appartex/tree/master/server/middlewares"
click node_propertyroutes "https://github.com/kesthav/appartex/tree/master/server/routes"
click node_propertymodels "https://github.com/kesthav/appartex/tree/master/server/models"
click node_tenantcontract "https://github.com/kesthav/appartex/tree/master/server/routes"
click node_tenantmodels "https://github.com/kesthav/appartex/tree/master/server/models"
click node_finance "https://github.com/kesthav/appartex/tree/master/server/routes"
click node_work "https://github.com/kesthav/appartex/tree/master/server/routes"
click node_messaging "https://github.com/kesthav/appartex/blob/master/server/routes/messages.js"
click node_statuses "https://github.com/kesthav/appartex/tree/master/server/routes"
click node_workmodels "https://github.com/kesthav/appartex/tree/master/server/models"

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_publicbrowse,node_ownerpages,node_tenantpages,node_authui,node_context,node_authroutes,node_visitor toneBlue
class node_apiindex,node_server,node_authapi,node_access toneAmber
class node_propertyroutes,node_propertymodels,node_tenantcontract,node_tenantmodels toneMint
class node_finance,node_work,node_messaging,node_statuses,node_workmodels toneRose
class node_mongo toneIndigo
```

## Components

### Web client

- [React application](https://github.com/kesthav/appartex/blob/master/client/src/App.js): `client/src/App.js`
- [Apartment browsing](https://github.com/kesthav/appartex/blob/master/client/src/pages/main.jsx): `client/src/pages/main.jsx`
- [Owner workspace](https://github.com/kesthav/appartex/tree/master/client/src/pages/ownerpages): `client/src/pages/ownerpages`
- [Tenant workspace](https://github.com/kesthav/appartex/blob/master/client/src/pages/tenantpages/tenantboard.jsx): `client/src/pages/tenantpages/tenantboard.jsx`
- [Login and signup](https://github.com/kesthav/appartex/tree/master/client/src/components/landingPage): `client/src/components/landingPage`
- [Client data context](https://github.com/kesthav/appartex/blob/master/client/src/middlewares/ContextAPI.jsx): `client/src/middlewares/ContextAPI.jsx`
- [Route access](https://github.com/kesthav/appartex/blob/master/client/src/middlewares/AuthRoutes.jsx): `client/src/middlewares/AuthRoutes.jsx`

### API and access

- [API route registry](https://github.com/kesthav/appartex/blob/master/server/routes/index.js): `server/routes/index.js`
- [Koa server](https://github.com/kesthav/appartex/blob/master/server/server.js): `server/server.js`
- [Authentication API](https://github.com/kesthav/appartex/blob/master/server/routes/auth.js): `server/routes/auth.js`
- [JWT and role checks](https://github.com/kesthav/appartex/tree/master/server/middlewares): `server/middlewares`

### Property management

- [Property records API](https://github.com/kesthav/appartex/tree/master/server/routes): `server/routes`
- [Buildings and apartments](https://github.com/kesthav/appartex/tree/master/server/models): `server/models`
- [Tenant and contract API](https://github.com/kesthav/appartex/tree/master/server/routes): `server/routes`
- [Tenant and contract records](https://github.com/kesthav/appartex/tree/master/server/models): `server/models`

### Work and records

- [Bills and histories](https://github.com/kesthav/appartex/tree/master/server/routes): `server/routes`
- [Tasks and repairs](https://github.com/kesthav/appartex/tree/master/server/routes): `server/routes`
- [Messages and comments](https://github.com/kesthav/appartex/blob/master/server/routes/messages.js): `server/routes/messages.js`
- [Status histories](https://github.com/kesthav/appartex/tree/master/server/routes): `server/routes`
- [Work record models](https://github.com/kesthav/appartex/tree/master/server/models): `server/models`

### Persistence

- **MongoDB**

### Other components

- **Visitor / user**

## Connections

- Visitor / user → React application: opens
- React application → Route access: routes through
- Visitor / user → Apartment browsing: browses
- Apartment browsing → Client data context: reads listings
- Visitor / user → Login and signup: authenticates
- Login and signup → Authentication API: submits credentials
- Owner workspace → Client data context: requests data
- Tenant workspace → Client data context: uses tenant data
- Client data context → Koa server: sends API requests
- Koa server → API route registry: dispatches routes
- API route registry → Authentication API: registers
- API route registry → Property records API: registers
- API route registry → Tenant and contract API: registers
- API route registry → Bills and histories: registers
- API route registry → Tasks and repairs: registers
- API route registry → Messages and comments: registers
- API route registry → Status histories: registers
- Authentication API → JWT and role checks: uses auth checks
- Property records API → JWT and role checks: uses access checks
- Tenant and contract API → JWT and role checks: uses access checks
- Bills and histories → JWT and role checks: uses access checks
- Tasks and repairs → JWT and role checks: uses access checks
- Messages and comments → JWT and role checks: uses access checks
- Status histories → JWT and role checks: uses access checks
- Property records API → Buildings and apartments: manages records
- Tenant and contract API → Tenant and contract records: manages records
- Bills and histories → Work record models: uses record models
- Tasks and repairs → Work record models: manages records
- Status histories → Work record models: records histories
- Authentication API → MongoDB: persists accounts
- Buildings and apartments → MongoDB: persists property data
- Tenant and contract records → MongoDB: persists tenant data
- Work record models → MongoDB: persists work data
