# rajeshekambaramm/shipyard architecture

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

- Interactive diagram: https://gitdiagram.com/rajeshekambaramm/shipyard
- Repository: https://github.com/rajeshekambaramm/shipyard

## Overview

##### What this project is (type + purpose)
From the file tree and README, this is a **classic server-rendered PHP website** (no obvious framework) backed by a **MySQL database**.

Signals:
- Many top-level `*.php` pages (`index.php`, `about.php`, `contact.php`, `rooms.php`, `hotels.php`, etc.) → **page-per-route** style PHP app.
- `db.php` → central DB connection/utility include.
- `cwmsdb.sql` → database schema + seed data dump.
- `login.php`, `logout.php`, `signup.php` → authentication flows.
- `tender.php`, `submit_tender.php` → tender listing + tender submission workflow.
- README only provides admin credentials → implies an **admin role** exists, likely gated by login and DB roles/flags.

##### How to read the file structure into architecture
- common DB access via `db.php`
- session/auth state via PHP sessions (implied by login/logout)
- shared schema in `cwmsdb.sql`

##### Suggested functional groupings (to turn flat files into components)
**Public site / informational pages**
- `index.php`, `about.php`, `contact.php`, `location.php`
- possibly `one.php`…`five.php`, `two.php`, `three.php`, `four.php` (these look like static sections or feature pages)

**Domain feature pages (shipyard content)**
- `drydocks.php`, `vigilence.php`, `sr-expertise.php`, `sr-facilities.php`, `sb-facility.php`, `sb-technology.php`, `sp.php`
- `hotels.php`, `rooms.php` (may be ancillary or reused template content; still represent as “Content/Services pages”)

**Identity & access**
- `login.php`, `logout.php`, `signup.php`
- Admin account exists (README), so there is likely an “admin-only” branch of pages/behaviors.

**Tender workflow**
- `tender.php` (view tenders / tender portal)
- `submit_tender.php` (POST handler / form processing)
- `storage.php` (if used to store tender documents or manage uploads)

**Infrastructure / integration**
- `db.php` → DB connector (and possibly shared query helpers)
- `cwmsdb.sql` → DB schema (tables for users/admin, tenders, maybe messages/contact forms, content)
- `Dummy.pdf`, `Readmore.pdf` → static assets (served by web server)

##### Filesystem storage (if `storage.php`/tenders store documents)

Relationships:
- Browser → Web Server/PHP (HTTP requests to `*.php`)
- PHP runtime → MySQL (queries via credentials defined in/through `db.php`)
- PHP runtime → Filesystem (uploads/downloads)

- “PHP Sessions” (for auth)
- “Server-rendered HTML” (response type)
- “Form POSTs” (for login/signup/tender submission)

Goal: separate “as many components as possible” even though it’s not structured—do it conceptually.

Components as:
- Auth Pages: `login.php`, `signup.php`, `logout.php`
- Tender Pages: `tender.php`, `submit_tender.php`
- Content Pages: `index.php`, `about.php`, `contact.php`, etc.
- Specialized service pages: `drydocks.php`, `sr-*`, `sb-*`, `vigilence.php`, etc.
- **Shared DB layer**:
- `db.php` as “DB Connection / Query Helper”
- **Domain services (conceptual)**:
- “User Service” (register/auth/session)
- “Tender Service” (create/view tenders, validate, store docs)
- “Content/Pages” (static/dynamic content)
- “File Storage Service” (if files are uploaded/downloaded via `storage.php`)

Data flows to show:
- Login: Browser → `login.php` → `db.php` → MySQL → session set → response/redirect
- Signup: Browser → `signup.php` → `db.php` → MySQL
- Tender submit: Browser → `submit_tender.php` → validation → (MySQL insert) + (optional file write) → redirect to `tender.php`
- Admin: Browser(Admin) → admin-only actions (identify which pages once confirmed) → MySQL updates

##### Architectural patterns/design principles to highlight (what matters here)
Even without frameworks, the architecture typically follows:
- **Server-side rendered pages** (PHP generates HTML)
- **Shared include for database connectivity** (`db.php`) → single point of DB configuration
- **Session-based authentication** (login/logout)
- **Monolithic deployment** (all PHP pages deployed together)
- **Direct DB access from page controllers** (common in simple PHP sites)

- **Trust boundaries**: Internet ↔ Web server; internal network ↔ DB
- **State**: Sessions stored server-side (file-based or in-memory depending on PHP config; note as “PHP session storage (default filesystem)” unless you confirm otherwise)
- **Validation/security choke points**: login, signup, tender submission, file handling

- Visitor / User / Admin → Shipyard PHP Web App → MySQL (+ optional filesystem)

- Browser
- Web Server (Apache/Nginx) + PHP runtime (sessions)
- MySQL (cwmsdb)
- Filesystem (uploads/static PDFs)

- Auth module (login/signup/logout)
- Tender module (tender/submit_tender/storage)
- Content module (index/about/contact/location + service pages)
- DB connection (`db.php`)
- Data store (MySQL tables; annotate once confirmed by reading `cwmsdb.sql`)

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% =======================
  %% Level 1 — Context
  %% =======================
  subgraph "Level 1 — System Context"
    direction TB

    Visitor["Visitor (Unauthenticated)"]:::actor
    User["Registered User (Authenticated)"]:::actor
    Admin["Admin (Privileged)"]:::actor

    WebApp["Shipyard Web Application (PHP)"]:::app

    DB[("MySQL Database (cwmsdb)")]:::db
    FS[["Server Filesystem\n(Uploads/Downloads)"]]:::storage
    StaticPDFs["Static Documents\n(PDF assets)"]:::static

    Visitor -->|"HTTP(S) GET pages"| WebApp
    User -->|"HTTP(S) GET/POST forms"| WebApp
    Admin -->|"HTTP(S) Admin actions"| WebApp

    WebApp -->|"SQL queries via db.php"| DB
    WebApp <-->|"Read/Write files"| FS
    WebApp -->|"Serve static PDFs"| StaticPDFs
  end

  %% =======================
  %% Level 2 — Containers
  %% =======================
  subgraph "Level 2 — Containers"
    direction TB

    Browser["Client Browser"]:::container
    WebSrv["Web Server + PHP Runtime\n(Apache/Nginx + PHP)\nServer-rendered HTML\nPHP Sessions"]:::container
    Sess["PHP Session Storage\n(default filesystem)"]:::storage
    MySQL[("MySQL Server\nDatabase: cwmsdb")]:::db
    FileStore[["Filesystem Storage\n(uploads + served files)"]]:::storage

    Browser -->|"HTTP(S) request/response"| WebSrv
    WebSrv -->|"Store/Read session state"| Sess
    WebSrv -->|"SQL over TCP"| MySQL
    WebSrv <-->|"File I/O (uploads/downloads)"| FileStore
  end

  %% =======================
  %% Level 3 — Components (inside PHP app)
  %% =======================
  subgraph "Level 3 — Components (inside PHP app)"
    direction TB

    subgraph "PHP Route Handlers (Page-per-route)"
      direction TB

      subgraph "Content & Informational Pages"
        direction TB
        Index["Home Page"]:::php
        About["About Page"]:::php
        Contact["Contact Page"]:::php
        Location["Location Page"]:::php

        One["Section Page One"]:::php
        Two["Section Page Two"]:::php
        Three["Section Page Three"]:::php
        Four["Section Page Four"]:::php
        Five["Section Page Five"]:::php

        Teams["Teams Page"]:::php
      end

      subgraph "Domain Feature Pages (Shipyard Content/Services)"
        direction TB
        Drydocks["Drydocks"]:::php
        Vigilence["Vigilence"]:::php
        SRExp["SR Expertise"]:::php
        SRFac["SR Facilities"]:::php
        SBFac["SB Facility"]:::php
        SBTech["SB Technology"]:::php
        SP["SP"]:::php
        Hotels["Hotels"]:::php
        Rooms["Rooms"]:::php
      end

      subgraph "Identity & Access (Auth)"
        direction TB
        Login["Login"]:::php
        Signup["Signup"]:::php
        Logout["Logout"]:::php
      end

      subgraph "Tender Workflow"
        direction TB
        Tender["Tender Portal (List/View)"]:::php
        SubmitTender["Submit Tender (Form POST handler)"]:::php
        Storage["Storage / Document Handling"]:::php
      end
    end

    subgraph "Shared Utilities"
      direction TB
      DBphp["DB Connector / Query Helper\n(db.php)"]:::util
      Schema["DB Schema + Seed Data\n(cwmsdb.sql)"]:::schema
      PDFs["PDF Assets\n(Dummy.pdf, Readmore.pdf)"]:::static
    end

    AppDB[("MySQL (cwmsdb)")]:::db
    AppFS[["Server Filesystem"]]:::storage

    %% Typical flows
    Login -->|"Validate credentials"| DBphp
    Signup -->|"Create user"| DBphp
    Logout -->|"Destroy session"| Login

    Tender -->|"Read tenders"| DBphp
    SubmitTender -->|"Validate + insert tender"| DBphp
    SubmitTender -->|"Optional: write uploaded docs"| Storage
    Storage <-->|"Read/Write documents"| AppFS

    DBphp -->|"Connect & query"| AppDB
    Schema -.->|"Defines tables/seed used by"| AppDB
    PDFs -->|"Served by"| Index
  end

  %% Cross-level alignment (visual cohesion)
  WebApp -.->|"Deployed as"| WebSrv
  DB -.->|"Same datastore as"| MySQL
  FS -.->|"Same storage as"| FileStore

  %% =======================
  %% Click Events (from component_mapping)
  %% =======================
  click Index "https://github.com/rajeshekambaramm/shipyard/blob/main/./index.php"
  click About "https://github.com/rajeshekambaramm/shipyard/blob/main/./about.php"
  click Contact "https://github.com/rajeshekambaramm/shipyard/blob/main/./contact.php"
  click Location "https://github.com/rajeshekambaramm/shipyard/blob/main/./location.php"

  click One "https://github.com/rajeshekambaramm/shipyard/blob/main/./one.php"
  click Two "https://github.com/rajeshekambaramm/shipyard/blob/main/./two.php"
  click Three "https://github.com/rajeshekambaramm/shipyard/blob/main/./three.php"
  click Four "https://github.com/rajeshekambaramm/shipyard/blob/main/./four.php"
  click Five "https://github.com/rajeshekambaramm/shipyard/blob/main/./five.php"

  click Drydocks "https://github.com/rajeshekambaramm/shipyard/blob/main/./drydocks.php"
  click Vigilence "https://github.com/rajeshekambaramm/shipyard/blob/main/./vigilence.php"
  click SRExp "https://github.com/rajeshekambaramm/shipyard/blob/main/./sr-expertise.php"
  click SRFac "https://github.com/rajeshekambaramm/shipyard/blob/main/./sr-facilities.php"
  click SBFac "https://github.com/rajeshekambaramm/shipyard/blob/main/./sb-facility.php"
  click SBTech "https://github.com/rajeshekambaramm/shipyard/blob/main/./sb-technology.php"
  click SP "https://github.com/rajeshekambaramm/shipyard/blob/main/./sp.php"

  click Hotels "https://github.com/rajeshekambaramm/shipyard/blob/main/./hotels.php"
  click Rooms "https://github.com/rajeshekambaramm/shipyard/blob/main/./rooms.php"
  click Teams "https://github.com/rajeshekambaramm/shipyard/blob/main/./Teams.php"

  click Login "https://github.com/rajeshekambaramm/shipyard/blob/main/./login.php"
  click Signup "https://github.com/rajeshekambaramm/shipyard/blob/main/./signup.php"
  click Logout "https://github.com/rajeshekambaramm/shipyard/blob/main/./logout.php"

  click Tender "https://github.com/rajeshekambaramm/shipyard/blob/main/./tender.php"
  click SubmitTender "https://github.com/rajeshekambaramm/shipyard/blob/main/./submit_tender.php"
  click Storage "https://github.com/rajeshekambaramm/shipyard/blob/main/./storage.php"

  click DBphp "https://github.com/rajeshekambaramm/shipyard/blob/main/./db.php"
  click Schema "https://github.com/rajeshekambaramm/shipyard/blob/main/./cwmsdb.sql"
  click PDFs "https://github.com/rajeshekambaramm/shipyard/blob/main/./Dummy.pdf"
  click PDFs "https://github.com/rajeshekambaramm/shipyard/blob/main/./Readmore.pdf"

  %% =======================
  %% Styles
  %% =======================
  classDef actor fill:#ECECEC,stroke:#666,stroke-width:1px,color:#111
  classDef app fill:#0EA5E9,stroke:#075985,stroke-width:2px,color:#fff
  classDef container fill:#111827,stroke:#374151,stroke-width:2px,color:#fff
  classDef php fill:#60A5FA,stroke:#1D4ED8,stroke-width:1.5px,color:#0B1220
  classDef util fill:#A78BFA,stroke:#5B21B6,stroke-width:1.5px,color:#0B1220
  classDef db fill:#F59E0B,stroke:#92400E,stroke-width:2px,color:#111
  classDef storage fill:#34D399,stroke:#065F46,stroke-width:1.5px,color:#06281C
  classDef static fill:#FDE68A,stroke:#B45309,stroke-width:1.5px,color:#111
  classDef schema fill:#FB7185,stroke:#9F1239,stroke-width:1.5px,color:#111
```
