How lapis42/srtgo works
Project type & purpose (from README + tree)
This is a Python package / CLI-style automation tool: “SRTgo: K-Train (KTX, SRT) Reservation Assistant”. It likely logs into Korean rail reservation systems and performs search + reservation workflows for SRT and KTX (Korail).
There is no “frontend/backend” separation; the architecture is primarily:
• Library modules that implement provider-specific API/session logic (SRT vs KTX)
• A top-level orchestration/CLI entry that calls those modules
• External dependencies: railway reservation websites/APIs (remote systems)
File structure analysis → infer components
Top-level:
• pyproject.toml: packaging, dependencies, entry points (often defines console script)
• .github/workflows/python-publish.yml: CI/CD pipeline to build & publish to PyPI
• srtgo/ package:
• __init__.py: package exports, versioning, public API
• srtgo.py: likely the main entry/orchestrator (CLI / main function)
• srt.py: SRT provider implementation (login/search/reserve)
• ktx.py: KTX provider implementation (login/search/reserve)
• srt.py + ktx.py likely encapsulate:
• HTTP session/cookies
• request building
• parsing responses
• domain objects (trips, seats, passengers) or simple dict-based flow
Given the acknowledgments to SRT and korail2, expect:
• Similar architecture: a provider client class that wraps HTTP endpoints and parsing
• Local package modules and their boundaries
• Control flow: user → CLI → provider client → remote rail system
• External systems: SRT website/API, Korail/KTX website/API
• Cross-cutting concerns: authentication, session management, parsing, retry/backoff, captcha/2FA (if applicable), rate limiting (even if not implemented, show where it would live)
“software supply chain” aspect:
• GitHub Actions publishing to PyPI, user installs via pip
User-facing layer
• User / Shell
• CLI entrypoint (from srtgo/srtgo.py and/or console script in pyproject.toml)
• Responsibilities: parse args/options, choose provider, invoke workflows, print results
Domain/workflow orchestration
• Reservation Orchestrator (may be inside srtgo.py)
• Steps: authenticate → search trains → select train/seat → reserve/pay/confirm (depending on what exists)
Provider adapters (core architecture)
• SRT Adapter/Client (srtgo/srt.py)
• KTX Adapter/Client (srtgo/ktx.py)
• Auth/session (cookies, tokens)
• Search endpoint calls
• Reservation endpoint calls
• Response parsing / normalization into internal structures
External systems
• SRT reservation system (web/API)
• Korail/KTX reservation system (web/API)
Packaging/distribution (optional but valuable)
• GitHub Actions (.github/workflows/python-publish.yml)
• PyPI (distribution)
• End-user environment (pip install srtgo)
Architectural patterns to highlight (specific to this project)
• Adapter pattern / provider abstraction: srt.py and ktx.py are two adapters for different external systems with similar capabilities.
• Orchestration layer: srtgo.py likely coordinates flows without embedding provider-specific HTTP details.
• Boundary to external services: remote reservation systems are the “system of record”; your code is a client with session/state.
“Don’t overthink it” but be detailed: suggested maximum component split
• CLI parsing
• Workflow orchestration
• Provider selection/router
• Provider clients (SRT, KTX)
• HTTP transport/session
• Parser/normalizer
• Output formatting
• CI publish pipeline
• PyPI distribution
• [User]
→ [CLI srtgo/srtgo.py]
→ [Orchestrator srtgo/srtgo.py or srtgo.py]
→ [SRT Client srtgo/srt.py] → (HTTPS) → [SRT Reservation System]
→ [KTX Client srtgo/ktx.py] → (HTTPS) → [Korail/KTX Reservation System]
Release pipeline:
• [GitHub Repo] → [GitHub Actions: python-publish.yml] → [PyPI] → [pip install srtgo] → [User runs CLI]