How geocoderdev/siasis-ss01-dev works
Project Type and Purpose
• This is a standalone, TypeScript-based real-time socket server (“SS01-SIASIS”) that provides bi-directional WebSocket (Socket.IO) communication for SIASIS attendance and related operations.
• It exposes both HTTP routes (e.g., authRoutes.ts) for login/REST operations and WebSocket channels under src/sockets for real-time events (e.g., attendance updates).
• It uses Prisma as its ORM to persist and query data.
High-Level Architecture Components
a. Clients (Web or Mobile Frontend)
• Initiate HTTP requests (login, profile) via REST
• Open Socket.IO connections for real-time events
b. API Gateway / HTTP Layer (src/routes, src/server/handlers)
• Express (or minimal HTTP) routes for authentication and basic CRUD
• Middleware for JWT validation (src/middlewares/socketAuth.ts)
c. WebSocket Server (src/server/SocketServer.ts, src/sockets)
• Socket.IO setup, namespace and event definitions
• Event handlers organized by feature (e.g., AsistenciaDePersonal)
d. Business Logic & Utilities (src/lib/utils, src/server/utils, src/assets)
• Environment loader, JWT key resolution
• Shared enums, types, and translation texts
• Logging utility (ServerLogger.ts)
e. Data Persistence (Prisma + Database)
• prisma/schema.prisma defines models
• Prisma Client invoked in route handlers or socket handlers
f. Deployment Pipeline & Infrastructure
• GitHub Actions workflows (.github/workflows/*) for CI/CD
• Oracle Cloud target for Dev/Cert/Prod via auto-deploy YAMLs
Relationships and Data Flows
• HTTP Request Flow: Client → API Gateway → Middleware → Route Handler → Prisma → Database → Response → Client
• WebSocket Flow: Client → SocketServer handshake → Auth middleware → Event namespaced under src/sockets/events → Event handler → Prisma (if needed) → Broadcast/Emit → Client(s)
• CI/CD Flow: GitHub push → GitHub Actions → Build & Test → Deploy to Oracle Cloud
Architectural Patterns & Principles
• Separation of Concerns:
• HTTP REST routes vs. WebSocket event handlers
• Utilities (env, logging) isolated from business logic
• Modular Feature Folders: sockets/events grouped by domain
• Typed Interfaces: Rich TypeScript interfaces under src/interfaces ensure strict contracts
• Single Responsibility: One file per handler, config, or utility