# dasileker/kali-test architecture

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

- Interactive diagram: https://gitdiagram.com/dasileker/kali-test
- Repository: https://github.com/dasileker/kali-test

## Overview

This Rails API supports appointment booking: clients can register or log in, use JWT authentication, browse doctors, and create or manage appointments. Requests enter through the versioned routes and controllers; authentication is handled by shared controller logic and command objects, while Active Record models persist users, doctors, and appointments. The tree and excerpts establish the main routes and controller calls. Other domain behavior is represented at its exact directory where implementation details were not sampled.

Main entry points: [`config/routes.rb`](https://github.com/dasileker/kali-test/blob/main/config/routes.rb) (API routes), [`app/models/user.rb`](https://github.com/dasileker/kali-test/blob/main/app/models/user.rb) (User records), [`config/application.rb`](https://github.com/dasileker/kali-test/blob/main/config/application.rb) (Rails API app), [`app/controllers/api/v1/appointments_controller.rb`](https://github.com/dasileker/kali-test/blob/main/app/controllers/api/v1/appointments_controller.rb) (Appointment API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API endpoints"]
  node_routes["API routes<br/>[routes.rb]"]
  node_auth_controller["Auth endpoints"]
  node_users_controller["User registration"]
  node_doctors_controller["Doctor catalog"]
  node_appointments_controller["Appointment API"]
end

subgraph group_auth["Authentication"]
  node_application_controller["Request guard"]
  node_authenticate_user["Credential login"]
  node_authorize_api_request["Token validation"]
  node_jwt["JWT encoding<br/>[json_web_token.rb]"]
end

subgraph group_domain["Booking domain"]
  node_user["User records<br/>[user.rb]"]
  node_doctor["Doctor records<br/>[doctor.rb]"]
  node_appointment["Appointment records<br/>[appointment.rb]"]
  node_database[("Application database<br/>[schema.rb]")]
end

subgraph group_platform["Rails platform"]
  node_application["Rails API app<br/>[application.rb]"]
  node_channels["Cable connection<br/>[connection.rb]"]
  node_channel["Cable channel<br/>[channel.rb]"]
  node_jobs["Job base<br/>[application_job.rb]"]
  node_mailers["Mailer base"]
end

node_client(("API client"))

node_client -->|"sends requests"| node_routes
node_routes -->|"routes auth"| node_auth_controller
node_routes -->|"routes users"| node_users_controller
node_routes -->|"routes doctors"| node_doctors_controller
node_routes -->|"routes bookings"| node_appointments_controller
node_auth_controller -->|"checks credentials"| node_authenticate_user
node_users_controller -->|"issues token"| node_authenticate_user
node_application_controller -->|"checks request"| node_authorize_api_request
node_authorize_api_request -->|"decodes token"| node_jwt
node_authorize_api_request -->|"loads identity"| node_user
node_application_controller -->|"checks ownership"| node_user
node_appointments_controller -->|"uses guard"| node_application_controller
node_appointments_controller -->|"reads and writes"| node_appointment
node_appointments_controller -->|"loads user bookings"| node_user
node_doctors_controller -->|"reads doctors"| node_doctor
node_users_controller -->|"creates user"| node_user
node_appointment -.->|"persists records"| node_database
node_user -.->|"persists records"| node_database
node_doctor -.->|"persists records"| node_database
node_application -->|"loads framework"| node_channels
node_application -->|"loads framework"| node_channel
node_application -->|"loads framework"| node_jobs
node_application -->|"loads framework"| node_mailers

click node_routes "https://github.com/dasileker/kali-test/blob/main/config/routes.rb"
click node_auth_controller "https://github.com/dasileker/kali-test/blob/main/app/controllers/authentication_controller.rb"
click node_users_controller "https://github.com/dasileker/kali-test/blob/main/app/controllers/api/v1/users_controller.rb"
click node_doctors_controller "https://github.com/dasileker/kali-test/blob/main/app/controllers/api/v1/doctors_controller.rb"
click node_appointments_controller "https://github.com/dasileker/kali-test/blob/main/app/controllers/api/v1/appointments_controller.rb"
click node_application_controller "https://github.com/dasileker/kali-test/blob/main/app/controllers/application_controller.rb"
click node_authenticate_user "https://github.com/dasileker/kali-test/blob/main/app/commands/authenticate_user.rb"
click node_authorize_api_request "https://github.com/dasileker/kali-test/blob/main/app/commands/authorize_api_request.rb"
click node_jwt "https://github.com/dasileker/kali-test/blob/main/lib/json_web_token.rb"
click node_user "https://github.com/dasileker/kali-test/blob/main/app/models/user.rb"
click node_doctor "https://github.com/dasileker/kali-test/blob/main/app/models/doctor.rb"
click node_appointment "https://github.com/dasileker/kali-test/blob/main/app/models/appointment.rb"
click node_database "https://github.com/dasileker/kali-test/blob/main/db/schema.rb"
click node_application "https://github.com/dasileker/kali-test/blob/main/config/application.rb"
click node_channels "https://github.com/dasileker/kali-test/blob/main/app/channels/application_cable/connection.rb"
click node_channel "https://github.com/dasileker/kali-test/blob/main/app/channels/application_cable/channel.rb"
click node_jobs "https://github.com/dasileker/kali-test/blob/main/app/jobs/application_job.rb"
click node_mailers "https://github.com/dasileker/kali-test/blob/main/app/mailers/application_mailer.rb"

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_routes,node_auth_controller,node_users_controller,node_doctors_controller,node_appointments_controller,node_client toneBlue
class node_application_controller,node_authenticate_user,node_authorize_api_request,node_jwt toneAmber
class node_user,node_doctor,node_appointment,node_database toneMint
class node_application,node_channels,node_channel,node_jobs,node_mailers toneRose
```

## Components

### API endpoints

- [API routes](https://github.com/dasileker/kali-test/blob/main/config/routes.rb): `config/routes.rb`
- [Auth endpoints](https://github.com/dasileker/kali-test/blob/main/app/controllers/authentication_controller.rb): `app/controllers/authentication_controller.rb`
- [User registration](https://github.com/dasileker/kali-test/blob/main/app/controllers/api/v1/users_controller.rb): `app/controllers/api/v1/users_controller.rb`
- [Doctor catalog](https://github.com/dasileker/kali-test/blob/main/app/controllers/api/v1/doctors_controller.rb): `app/controllers/api/v1/doctors_controller.rb`
- [Appointment API](https://github.com/dasileker/kali-test/blob/main/app/controllers/api/v1/appointments_controller.rb): `app/controllers/api/v1/appointments_controller.rb`

### Authentication

- [Request guard](https://github.com/dasileker/kali-test/blob/main/app/controllers/application_controller.rb): `app/controllers/application_controller.rb`
- [Credential login](https://github.com/dasileker/kali-test/blob/main/app/commands/authenticate_user.rb): `app/commands/authenticate_user.rb`
- [Token validation](https://github.com/dasileker/kali-test/blob/main/app/commands/authorize_api_request.rb): `app/commands/authorize_api_request.rb`
- [JWT encoding](https://github.com/dasileker/kali-test/blob/main/lib/json_web_token.rb): `lib/json_web_token.rb`

### Booking domain

- [User records](https://github.com/dasileker/kali-test/blob/main/app/models/user.rb): `app/models/user.rb`
- [Doctor records](https://github.com/dasileker/kali-test/blob/main/app/models/doctor.rb): `app/models/doctor.rb`
- [Appointment records](https://github.com/dasileker/kali-test/blob/main/app/models/appointment.rb): `app/models/appointment.rb`
- [Application database](https://github.com/dasileker/kali-test/blob/main/db/schema.rb): `db/schema.rb`

### Rails platform

- [Rails API app](https://github.com/dasileker/kali-test/blob/main/config/application.rb): `config/application.rb`
- [Cable connection](https://github.com/dasileker/kali-test/blob/main/app/channels/application_cable/connection.rb): `app/channels/application_cable/connection.rb`
- [Cable channel](https://github.com/dasileker/kali-test/blob/main/app/channels/application_cable/channel.rb): `app/channels/application_cable/channel.rb`
- [Job base](https://github.com/dasileker/kali-test/blob/main/app/jobs/application_job.rb): `app/jobs/application_job.rb`
- [Mailer base](https://github.com/dasileker/kali-test/blob/main/app/mailers/application_mailer.rb): `app/mailers/application_mailer.rb`

### Other components

- **API client**

## Connections

- API client → API routes: sends requests (evidence: `config/routes.rb`)
- API routes → Auth endpoints: routes auth (evidence: `config/routes.rb`)
- API routes → User registration: routes users (evidence: `config/routes.rb`)
- API routes → Doctor catalog: routes doctors (evidence: `config/routes.rb`)
- API routes → Appointment API: routes bookings (evidence: `config/routes.rb`)
- Auth endpoints → Credential login: checks credentials (evidence: `app/controllers/authentication_controller.rb`)
- User registration → Credential login: issues token (evidence: `app/controllers/api/v1/users_controller.rb`)
- Request guard → Token validation: checks request (evidence: `app/controllers/application_controller.rb`)
- Token validation → JWT encoding: decodes token (evidence: `app/commands/authorize_api_request.rb`)
- Token validation → User records: loads identity (evidence: `app/commands/authorize_api_request.rb`)
- Request guard → User records: checks ownership (evidence: `app/controllers/application_controller.rb`)
- Appointment API → Request guard: uses guard (evidence: `app/controllers/api/v1/appointments_controller.rb`)
- Appointment API → Appointment records: reads and writes (evidence: `app/controllers/api/v1/appointments_controller.rb`)
- Appointment API → User records: loads user bookings (evidence: `app/controllers/api/v1/appointments_controller.rb`)
- Doctor catalog → Doctor records: reads doctors (evidence: `app/controllers/api/v1/doctors_controller.rb`)
- User registration → User records: creates user (evidence: `app/controllers/api/v1/users_controller.rb`)
- Appointment records → Application database: persists records
- User records → Application database: persists records
- Doctor records → Application database: persists records
- Rails API app → Cable connection: loads framework (evidence: `config/application.rb`)
- Rails API app → Cable channel: loads framework (evidence: `config/application.rb`)
- Rails API app → Job base: loads framework (evidence: `config/application.rb`)
- Rails API app → Mailer base: loads framework (evidence: `config/application.rb`)
