# sai-shashank-2005/intelligent-intranet-retrieval-system architecture

> Architecture diagram of the GitHub repository sai-shashank-2005/intelligent-intranet-retrieval-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sai-shashank-2005/intelligent-intranet-retrieval-system
- Repository: https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system

## Overview

1. **What this repo is**
   - A small, monolithic **PHP intranet application** called **IIRS (Intelligent Intranet Retrieval System)**.
   - It combines **document/link search** for employees with **search auditing** for security monitoring.
   - There is no sign of separate microservices or an external search engine; the app appears to be **server-rendered PHP + database**.

2. **Primary runtime boundary**
   - The application runs behind a standard PHP-capable web server on an internal network.
   - Browser requests hit PHP entry points, which render HTML and query the database.
   - The app is designed to be **offline/private**: all data stays inside the corporate environment.

3. **User-facing pages**
   - `index.php` is likely the main landing/search page.
   - `search.php` handles search execution and result display.
   - `logs.php` is the security/admin view for reviewing recorded searches.
   - These pages are the main navigation points for two user groups: employees and security staff.

4. **Shared presentation layer**
   - `components/navbar.php`, `components/footer.php`, and `components/search-card.php` indicate a reusable server-side UI composition pattern.
   - `assets/css/style.css` and `assets/js/script.js` provide the shared styling and client-side behavior.
   - The UI is likely assembled on the server with small reusable fragments rather than a client-side SPA.

5. **Search flow**
   - A user enters a query in the browser.
   - The search request is processed in PHP, likely in `search.php`, and matched against records stored in the database.
   - The README says the search includes **basic normalization** such as plural handling, so the backend likely adjusts terms like “forms” to “form” before querying.

6. **Result model**
   - Search results are rendered using `components/search-card.php`, which suggests each result is presented as a card-style item.
   - The indexed content appears to be **internal company documents, forms, and links**, not arbitrary web pages.
   - This implies the database acts as the application’s search corpus.

7. **Security logging subsystem**
   - Every search query is logged, including **IP address and device-related information** according to the README.
   - This logging is part of the application’s security value proposition: it supports detection of suspicious reconnaissance patterns.
   - `logs.php` is the boundary for reviewing this telemetry, likely reserved for security staff or admins.

8. **Database layer**
   - `db.php` is the database connection/configuration boundary used by the PHP pages.
   - `config.php` likely contains app settings or constants shared across the application.
   - `database/setup.sql` initializes the schema, and `database/update_1.sql` indicates at least one schema/data migration has been applied.

9. **Data flow between subsystems**
   - Browser → PHP page (`index.php` / `search.php`) → MySQL database → rendered HTML response.
   - Separately, the search request also writes an audit record to the database for later inspection in `logs.php`.
   - This means the same database supports both **search retrieval** and **security observability**.

10. **Deployment and ops**
   - `deploy.sh` suggests a simple server-side deployment workflow.
   - The README describes copying the repo to a web root, importing SQL, and updating DB credentials.
   - That points to a straightforward internal deployment model: **code + schema + config**, not containerized or cloud-native infrastructure.

11. **Important architectural boundary**
   - The app is split into three clear concerns:
     - **Presentation**: PHP page templates and shared components
     - **Search/business logic**: query handling, normalization, result formatting
     - **Persistence/audit**: database tables for searchable content and logs
   - This separation is modest but clear enough to diagram as a classic server-rendered MVC-like PHP app.

12. **What is not present**
   - No evidence of external APIs, SaaS dependencies, message queues, background workers, or a separate indexing pipeline.
   - No sign of front-end framework complexity; the app appears intentionally lightweight and internal.
   - The architecture is therefore centered on a single PHP application with a relational database backend.

Main entry points: [`search.php`](https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/search.php) (Search), [`index.php`](https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/index.php) (Home), [`database/setup.sql`](https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/database/setup.sql) (Schema setup), [`logs.php`](https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/logs.php) (Logs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Presentation"]
  node_index["Home<br/>PHP page<br/>[index.php]"]
  node_navbar["Navbar<br/>UI fragment<br/>[navbar.php]"]
  node_footer["Footer<br/>UI fragment<br/>[footer.php]"]
  node_search_card["Result card<br/>UI fragment<br/>[search-card.php]"]
  node_style["Styles<br/>CSS<br/>[style.css]"]
  node_script["Script<br/>JS<br/>[script.js]"]
end

subgraph group_search["Search & audit"]
  node_search_page["Search<br/>PHP page<br/>[search.php]"]
  node_logs_page["Logs<br/>PHP page<br/>[logs.php]"]
end

subgraph group_persistence["Persistence"]
  node_config["Config<br/>settings<br/>[config.php]"]
  node_db["DB access<br/>PHP connector<br/>[db.php]"]
  node_schema["Schema setup<br/>SQL init<br/>[setup.sql]"]
  node_migration["Update script<br/>SQL migration<br/>[update_1.sql]"]
  node_content_store[("Content store<br/>relational data")]
  node_search_logs[("Audit log<br/>relational data")]
end

node_deploy["Deploy<br/>shell ops<br/>[deploy.sh]"]

node_index -->|"uses"| node_navbar
node_index -->|"uses"| node_footer
node_index -->|"loads"| node_style
node_index -->|"loads"| node_script
node_index -->|"submits"| node_search_page
node_search_page -->|"queries"| node_db
node_search_page -->|"searches"| node_content_store
node_search_page -->|"writes"| node_search_logs
node_search_page -->|"renders"| node_search_card
node_search_page -->|"uses"| node_navbar
node_search_page -->|"uses"| node_footer
node_search_page -->|"loads"| node_style
node_search_page -->|"loads"| node_script
node_search_page -->|"reads"| node_config
node_logs_page -->|"queries"| node_db
node_logs_page -->|"reads"| node_search_logs
node_logs_page -->|"uses"| node_navbar
node_logs_page -->|"uses"| node_footer
node_db -->|"depends on"| node_schema
node_schema -->|"defines"| node_content_store
node_schema -->|"defines"| node_search_logs
node_migration -->|"evolves"| node_schema
node_deploy -->|"configures"| node_db
node_deploy -->|"imports"| node_schema
node_deploy -->|"publishes"| node_index

click node_index "https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/index.php"
click node_search_page "https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/search.php"
click node_logs_page "https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/logs.php"
click node_navbar "https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/components/navbar.php"
click node_footer "https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/components/footer.php"
click node_search_card "https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/components/search-card.php"
click node_style "https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/assests/css/style.css"
click node_script "https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/assests/js/script.js"
click node_config "https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/config.php"
click node_db "https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/db.php"
click node_schema "https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/database/setup.sql"
click node_migration "https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/database/update_1.sql"
click node_deploy "https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/deploy.sh"

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_index,node_navbar,node_footer,node_search_card,node_style,node_script toneBlue
class node_search_page,node_logs_page toneAmber
class node_config,node_db,node_schema,node_migration,node_content_store,node_search_logs toneMint
class node_deploy toneNeutral
```

## Components

### Presentation

Server-rendered pages and shared UI fragments.

- [Home](https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/index.php): PHP page · Landing page and search entry point. · `index.php`
- [Navbar](https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/components/navbar.php): UI fragment · Shared top navigation component. · `components/navbar.php`
- [Footer](https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/components/footer.php): UI fragment · Shared page footer component. · `components/footer.php`
- [Result card](https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/components/search-card.php): UI fragment · Reusable search result rendering. · `components/search-card.php`
- [Styles](https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/assests/css/style.css): CSS · Shared application styling. · `assests/css/style.css`
- [Script](https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/assests/js/script.js): JS · Client-side behavior for the UI. · `assests/js/script.js`

### Search & audit

Query handling, normalization, and logging flows.

- [Search](https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/search.php): PHP page · Processes queries and renders results. · `search.php`
- [Logs](https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/logs.php): PHP page · Security view for audited searches. · `logs.php`

### Persistence

Database schema and access layer.

- [Config](https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/config.php): settings · Shared application constants and settings. · `config.php`
- [DB access](https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/db.php): PHP connector · Database connection boundary used by pages. · `db.php`
- [Schema setup](https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/database/setup.sql): SQL init · Initial database tables and seed structure. · `database/setup.sql`
- [Update script](https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/database/update_1.sql): SQL migration · Database update and schema evolution script. · `database/update_1.sql`
- **Content store**: relational data · Internal documents, forms, and links indexed for search.
- **Audit log**: relational data · Recorded searches with IP and device metadata.

### Other components

- [Deploy](https://github.com/sai-shashank-2005/intelligent-intranet-retrieval-system/blob/main/deploy.sh): shell ops · Simple internal deployment workflow. · `deploy.sh`

## Connections

- Home → Navbar: uses · Main page composes shared navigation.
- Home → Footer: uses · Main page composes shared footer.
- Home → Styles: loads · Landing page uses shared styling.
- Home → Script: loads · Landing page uses client-side behavior.
- Home → Search: submits · Search form routes into query handling.
- Search → DB access: queries · Search execution reads from the database.
- Search → Content store: searches · Matches queries against internal content records.
- Search → Audit log: writes · Audits each search request.
- Search → Result card: renders · Results are presented with reusable cards.
- Search → Navbar: uses · Search page composes shared navigation.
- Search → Footer: uses · Search page composes shared footer.
- Search → Styles: loads · Search page uses shared styling.
- Search → Script: loads · Search page uses client-side behavior.
- Search → Config: reads · Uses application settings and constants.
- Logs → DB access: queries · Log review reads audit records from the database.
- Logs → Audit log: reads · Displays recorded search telemetry.
- Logs → Navbar: uses · Log view composes shared navigation.
- Logs → Footer: uses · Log view composes shared footer.
- DB access → Schema setup: depends on · Connection layer assumes initialized schema.
- Schema setup → Content store: defines · Schema creates the searchable content tables.
- Schema setup → Audit log: defines · Schema creates audit logging tables.
- Update script → Schema setup: evolves · Update script extends the base schema.
- Deploy → DB access: configures · Deployment updates database credentials and wiring.
- Deploy → Schema setup: imports · Deployment includes database setup.
- Deploy → Home: publishes · Deployment places the PHP app into web root.
