# skyrhrg/ocean architecture

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

- Interactive diagram: https://gitdiagram.com/skyrhrg/ocean
- Repository: https://github.com/skyrhrg/ocean

## Overview

Ocean is an Electron desktop app for automating IRCTC train booking, including APP-backed and browser-based booking, payment handoffs, and ticket handling. The principal flow is user configuration and train selection, then a managed booking run through an IRCTC browser/session, followed by payment and booking-result handling. The graph also shows train lookup, licensing, profile persistence, proxying, stealth, OCR, and printing. Evidence is limited to the supplied excerpts and SOURCE INDEX; relationships not demonstrated there are omitted.

Main entry points: [`session-manager.js`](https://github.com/skyrhrg/ocean/blob/main/session-manager.js) (Run manager), [`chrome-runner.js`](https://github.com/skyrhrg/ocean/blob/main/chrome-runner.js) (Chrome runner), [`main.js`](https://github.com/skyrhrg/ocean/blob/main/main.js) (IPC and windows), [`app-book.js`](https://github.com/skyrhrg/ocean/blob/main/app-book.js) (APP booking)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop control"]
  node_main["IPC and windows<br/>[main.js]"]
  node_renderer["App interface<br/>[renderer.js]"]
  node_license["License gate<br/>[license-gate.js]"]
end

subgraph group_booking["Booking workflow"]
  node_sessions["Run manager<br/>[session-manager.js]"]
  node_automation["Booking automation"]
  node_appbook["APP booking<br/>[app-book.js]"]
  node_direct["Direct booking host"]
  node_train["Train lookup<br/>[train-service.js]"]
  node_stations["Station data<br/>[stations.js]"]
  node_history["Booking history<br/>[booking-history.js]"]
end

subgraph group_browser["Browser runtime"]
  node_chrome["Chrome runner<br/>[chrome-runner.js]"]
  node_chrome_finder["Chrome discovery<br/>[chrome-finder.js]"]
  node_stealth["Fingerprint masking<br/>[stealth.js]"]
  node_consistency["Fingerprint consistency"]
  node_input["Trusted input<br/>[input-engine.js]"]
  node_network["IRCTC network<br/>[irctc-network.js]"]
end

subgraph group_support["Runtime services"]
  node_profiles["Profile bridge<br/>[profile-bridge.js]"]
  node_store[("SQLite profile store<br/>[profile-store.js]")]
  node_proxy["Proxy configuration<br/>[proxy-util.js]"]
  node_tunnel["Auth proxy tunnel<br/>[proxy-tunnel.js]"]
  node_pair["APP pair session"]
  node_sensor["Sensor client<br/>[sensor-client.js]"]
  node_ocr["Captcha OCR"]
  node_printer["Ticket printer<br/>[ticket-printer.js]"]
end

subgraph group_payment["Payments"]
  node_ipay["iPay QR<br/>[app-ipay-qr.js]"]
  node_razorpay["Razorpay UPI"]
  node_ewallet["E-wallet payment<br/>[app-ewallet.js]"]
end

node_user(("User"))
node_irctc(("IRCTC services"))
node_erail(("eRail service"))
node_sensor_api(("Sensor API"))

node_user -->|"uses"| node_renderer
node_renderer -->|"sends IPC"| node_main
node_main -->|"checks access"| node_license
node_main -->|"starts runs"| node_sessions
node_main -->|"requests trains"| node_train
node_main -->|"prints tickets"| node_printer
node_sessions -->|"launches browser"| node_chrome
node_sessions -->|"starts automation"| node_automation
node_sessions -->|"starts APP booking"| node_appbook
node_sessions -->|"starts direct host"| node_direct
node_sessions -->|"manages APP session"| node_pair
node_sessions -->|"loads profiles"| node_store
node_sessions -->|"applies stealth"| node_stealth
node_sessions -->|"uses consistency"| node_consistency
node_sessions -->|"configures network"| node_network
node_sessions -->|"resolves proxy"| node_proxy
node_sessions -.->|"records results"| node_history
node_chrome -->|"finds browser"| node_chrome_finder
node_chrome -->|"applies stealth"| node_stealth
node_chrome -->|"uses consistency"| node_consistency
node_chrome -->|"loads profile"| node_profiles
node_chrome -->|"normalizes proxy"| node_proxy
node_direct -->|"attaches network"| node_network
node_direct -->|"configures proxy"| node_proxy
node_proxy -->|"starts auth tunnel"| node_tunnel
node_profiles -->|"reads profiles"| node_store
node_pair -->|"consumes sensor"| node_sensor
node_sensor -->|"requests tokens"| node_sensor_api
node_train -->|"solves captcha"| node_ocr
node_train -->|"fetches train data"| node_erail
node_train -->|"checks availability"| node_irctc
node_appbook -->|"uses pair session"| node_pair
node_appbook -->|"uses payment flow"| node_ipay
node_appbook -->|"uses payment flow"| node_razorpay
node_appbook -->|"uses payment flow"| node_ewallet
node_printer -->|"reads bookings"| node_history

click node_main "https://github.com/skyrhrg/ocean/blob/main/main.js"
click node_renderer "https://github.com/skyrhrg/ocean/blob/main/renderer.js"
click node_license "https://github.com/skyrhrg/ocean/blob/main/license-gate.js"
click node_sessions "https://github.com/skyrhrg/ocean/blob/main/session-manager.js"
click node_automation "https://github.com/skyrhrg/ocean/blob/main/automation-runner.js"
click node_appbook "https://github.com/skyrhrg/ocean/blob/main/app-book.js"
click node_direct "https://github.com/skyrhrg/ocean/blob/main/direct-booking-host.js"
click node_train "https://github.com/skyrhrg/ocean/blob/main/train-service.js"
click node_stations "https://github.com/skyrhrg/ocean/blob/main/stations.js"
click node_history "https://github.com/skyrhrg/ocean/blob/main/booking-history.js"
click node_chrome "https://github.com/skyrhrg/ocean/blob/main/chrome-runner.js"
click node_chrome_finder "https://github.com/skyrhrg/ocean/blob/main/chrome-finder.js"
click node_stealth "https://github.com/skyrhrg/ocean/blob/main/stealth.js"
click node_consistency "https://github.com/skyrhrg/ocean/blob/main/stealth-consistency.js"
click node_input "https://github.com/skyrhrg/ocean/blob/main/input-engine.js"
click node_network "https://github.com/skyrhrg/ocean/blob/main/irctc-network.js"
click node_profiles "https://github.com/skyrhrg/ocean/blob/main/profile-bridge.js"
click node_store "https://github.com/skyrhrg/ocean/blob/main/profile-store.js"
click node_proxy "https://github.com/skyrhrg/ocean/blob/main/proxy-util.js"
click node_tunnel "https://github.com/skyrhrg/ocean/blob/main/proxy-tunnel.js"
click node_pair "https://github.com/skyrhrg/ocean/blob/main/app-pair-session.js"
click node_sensor "https://github.com/skyrhrg/ocean/blob/main/sensor-client.js"
click node_ocr "https://github.com/skyrhrg/ocean/blob/main/erail-ocr-bridge.js"
click node_printer "https://github.com/skyrhrg/ocean/blob/main/ticket-printer.js"
click node_ipay "https://github.com/skyrhrg/ocean/blob/main/app-ipay-qr.js"
click node_razorpay "https://github.com/skyrhrg/ocean/blob/main/app-razorpay-upi.js"
click node_ewallet "https://github.com/skyrhrg/ocean/blob/main/app-ewallet.js"

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_main,node_renderer,node_license,node_user toneBlue
class node_sessions,node_automation,node_appbook,node_direct,node_train,node_stations,node_history toneAmber
class node_chrome,node_chrome_finder,node_stealth,node_consistency,node_input,node_network,node_sensor_api toneMint
class node_profiles,node_store,node_proxy,node_tunnel,node_pair,node_sensor,node_ocr,node_printer toneRose
class node_ipay,node_razorpay,node_ewallet,node_irctc,node_erail toneIndigo
```

## Components

### Desktop control

- [IPC and windows](https://github.com/skyrhrg/ocean/blob/main/main.js): `main.js`
- [App interface](https://github.com/skyrhrg/ocean/blob/main/renderer.js): `renderer.js`
- [License gate](https://github.com/skyrhrg/ocean/blob/main/license-gate.js): `license-gate.js`

### Booking workflow

- [Run manager](https://github.com/skyrhrg/ocean/blob/main/session-manager.js): `session-manager.js`
- [Booking automation](https://github.com/skyrhrg/ocean/blob/main/automation-runner.js): `automation-runner.js`
- [APP booking](https://github.com/skyrhrg/ocean/blob/main/app-book.js): `app-book.js`
- [Direct booking host](https://github.com/skyrhrg/ocean/blob/main/direct-booking-host.js): `direct-booking-host.js`
- [Train lookup](https://github.com/skyrhrg/ocean/blob/main/train-service.js): `train-service.js`
- [Station data](https://github.com/skyrhrg/ocean/blob/main/stations.js): `stations.js`
- [Booking history](https://github.com/skyrhrg/ocean/blob/main/booking-history.js): `booking-history.js`

### Browser runtime

- [Chrome runner](https://github.com/skyrhrg/ocean/blob/main/chrome-runner.js): `chrome-runner.js`
- [Chrome discovery](https://github.com/skyrhrg/ocean/blob/main/chrome-finder.js): `chrome-finder.js`
- [Fingerprint masking](https://github.com/skyrhrg/ocean/blob/main/stealth.js): `stealth.js`
- [Fingerprint consistency](https://github.com/skyrhrg/ocean/blob/main/stealth-consistency.js): `stealth-consistency.js`
- [Trusted input](https://github.com/skyrhrg/ocean/blob/main/input-engine.js): `input-engine.js`
- [IRCTC network](https://github.com/skyrhrg/ocean/blob/main/irctc-network.js): `irctc-network.js`

### Runtime services

- [Profile bridge](https://github.com/skyrhrg/ocean/blob/main/profile-bridge.js): `profile-bridge.js`
- [SQLite profile store](https://github.com/skyrhrg/ocean/blob/main/profile-store.js): `profile-store.js`
- [Proxy configuration](https://github.com/skyrhrg/ocean/blob/main/proxy-util.js): `proxy-util.js`
- [Auth proxy tunnel](https://github.com/skyrhrg/ocean/blob/main/proxy-tunnel.js): `proxy-tunnel.js`
- [APP pair session](https://github.com/skyrhrg/ocean/blob/main/app-pair-session.js): `app-pair-session.js`
- [Sensor client](https://github.com/skyrhrg/ocean/blob/main/sensor-client.js): `sensor-client.js`
- [Captcha OCR](https://github.com/skyrhrg/ocean/blob/main/erail-ocr-bridge.js): `erail-ocr-bridge.js`
- [Ticket printer](https://github.com/skyrhrg/ocean/blob/main/ticket-printer.js): `ticket-printer.js`

### Payments

- [iPay QR](https://github.com/skyrhrg/ocean/blob/main/app-ipay-qr.js): `app-ipay-qr.js`
- [Razorpay UPI](https://github.com/skyrhrg/ocean/blob/main/app-razorpay-upi.js): `app-razorpay-upi.js`
- [E-wallet payment](https://github.com/skyrhrg/ocean/blob/main/app-ewallet.js): `app-ewallet.js`

### Other components

- **User**
- **IRCTC services**
- **eRail service**
- **Sensor API**

## Connections

- User → App interface: uses
- App interface → IPC and windows: sends IPC
- IPC and windows → License gate: checks access (evidence: `main.js`)
- IPC and windows → Run manager: starts runs (evidence: `main.js`)
- IPC and windows → Train lookup: requests trains (evidence: `main.js`)
- IPC and windows → Ticket printer: prints tickets (evidence: `main.js`)
- Run manager → Chrome runner: launches browser (evidence: `session-manager.js`)
- Run manager → Booking automation: starts automation (evidence: `session-manager.js`)
- Run manager → APP booking: starts APP booking (evidence: `session-manager.js`)
- Run manager → Direct booking host: starts direct host (evidence: `session-manager.js`)
- Run manager → APP pair session: manages APP session (evidence: `session-manager.js`)
- Run manager → SQLite profile store: loads profiles (evidence: `session-manager.js`)
- Run manager → Fingerprint masking: applies stealth (evidence: `session-manager.js`)
- Run manager → Fingerprint consistency: uses consistency (evidence: `session-manager.js`)
- Run manager → IRCTC network: configures network (evidence: `session-manager.js`)
- Run manager → Proxy configuration: resolves proxy (evidence: `session-manager.js`)
- Run manager → Booking history: records results
- Chrome runner → Chrome discovery: finds browser (evidence: `chrome-runner.js`)
- Chrome runner → Fingerprint masking: applies stealth (evidence: `chrome-runner.js`)
- Chrome runner → Fingerprint consistency: uses consistency (evidence: `chrome-runner.js`)
- Chrome runner → Profile bridge: loads profile (evidence: `chrome-runner.js`)
- Chrome runner → Proxy configuration: normalizes proxy (evidence: `chrome-runner.js`)
- Direct booking host → IRCTC network: attaches network (evidence: `direct-booking-host.js`)
- Direct booking host → Proxy configuration: configures proxy (evidence: `direct-booking-host.js`)
- Proxy configuration → Auth proxy tunnel: starts auth tunnel (evidence: `proxy-session.js`)
- Profile bridge → SQLite profile store: reads profiles (evidence: `profile-bridge.js`)
- APP pair session → Sensor client: consumes sensor (evidence: `app-pair-session.js`)
- Sensor client → Sensor API: requests tokens (evidence: `sensor-client.js`)
- Train lookup → Captcha OCR: solves captcha (evidence: `train-service.js`)
- Train lookup → eRail service: fetches train data (evidence: `train-service.js`)
- Train lookup → IRCTC services: checks availability (evidence: `train-service.js`)
- APP booking → APP pair session: uses pair session (evidence: `app-book.js`)
- APP booking → iPay QR: uses payment flow (evidence: `app-book.js`)
- APP booking → Razorpay UPI: uses payment flow (evidence: `app-book.js`)
- APP booking → E-wallet payment: uses payment flow (evidence: `app-book.js`)
- Ticket printer → Booking history: reads bookings (evidence: `ticket-printer.js`)
