@@ -214,6 +214,25 @@ This API follows a **modular monolith** architecture:
214214└─────────────────────┴───────────────────────────────────────────────────────┘
215215```
216216
217+ ### Architecture
218+
219+ This API follows a modular monolith architecture with the following modules:
220+
221+ - ` authentication ` - User authentication and authorization
222+ - ` dashboard ` - Dashboard statistics and metrics
223+ - ` players ` - Player management and statistics
224+ - ` scouting ` - Player scouting and talent discovery
225+ - ` analytics ` - Performance analytics and reporting
226+ - ` matches ` - Match data and statistics
227+ - ` schedules ` - Event and schedule management
228+ - ` vod_reviews ` - Video review and timestamp management
229+ - ` team_goals ` - Goal setting and tracking
230+ - ` riot_integration ` - Riot Games API integration
231+ - ` competitive ` - PandaScore integration, pro matches, draft analysis
232+ - ` scrims ` - Scrim management and opponent team tracking
233+ - ` strategy ` - Draft planning and tactical board system
234+ - ` support ` - Support ticket system with staff and FAQ management
235+
217236### Architecture Diagram
218237
219238``` mermaid
@@ -241,46 +260,12 @@ graph TB
241260 DashStats[Statistics Service]
242261 end
243262
244- subgraph "Players Module"
245- PlayersController[Players Controller]
246- PlayerModel[Player Model]
247- ChampionPoolModel[Champion Pool Model]
248- end
249-
250- subgraph "Scouting Module"
251- ScoutingController[Scouting Controller]
252- ScoutingTargetModel[Scouting Target Model]
253- Watchlist[Watchlist Service]
254- end
255-
256263 subgraph "Analytics Module"
257264 AnalyticsController[Analytics Controller]
258265 PerformanceService[Performance Service]
259266 KDAService[KDA Trend Service]
260267 end
261268
262- subgraph "Matches Module"
263- MatchesController[Matches Controller]
264- MatchModel[Match Model]
265- PlayerMatchStatModel[Player Match Stat Model]
266- end
267-
268- subgraph "Schedules Module"
269- SchedulesController[Schedules Controller]
270- ScheduleModel[Schedule Model]
271- end
272-
273- subgraph "VOD Reviews Module"
274- VODController[VOD Reviews Controller]
275- VodReviewModel[VOD Review Model]
276- VodTimestampModel[VOD Timestamp Model]
277- end
278-
279- subgraph "Team Goals Module"
280- GoalsController[Team Goals Controller]
281- TeamGoalModel[Team Goal Model]
282- end
283-
284269 subgraph "Riot Integration Module"
285270 RiotService[Riot API Service]
286271 RiotSync[Sync Service]
@@ -298,20 +283,6 @@ graph TB
298283 OpponentTeamsController[Opponent Teams Controller]
299284 ScrimAnalytics[Scrim Analytics Service]
300285 end
301-
302- subgraph "Strategy Module"
303- DraftPlansController[Draft Plans Controller]
304- TacticalBoardsController[Tactical Boards Controller]
305- DraftAnalysisService[Draft Analysis Service]
306- end
307-
308- subgraph "Support Module"
309- SupportTicketsController[Support Tickets Controller]
310- SupportFaqsController[Support FAQs Controller]
311- SupportStaffController[Support Staff Controller]
312- SupportTicketModel[Support Ticket Model]
313- SupportFaqModel[Support FAQ Model]
314- end
315286 end
316287
317288 subgraph "Data Layer"
@@ -333,71 +304,26 @@ graph TB
333304 CORS --> RateLimit
334305 RateLimit --> Auth
335306 Auth --> Router
336-
337- Router --> AuthController
338- Router --> DashboardController
339- Router --> PlayersController
340- Router --> ScoutingController
307+
341308 Router --> AnalyticsController
342- Router --> MatchesController
343- Router --> SchedulesController
344- Router --> VODController
345- Router --> GoalsController
346309 Router --> CompetitiveController
347310 Router --> ProMatchesController
348311 Router --> ScrimsController
349312 Router --> OpponentTeamsController
350- Router --> DraftPlansController
351- Router --> TacticalBoardsController
352- Router --> SupportTicketsController
353- Router --> SupportFaqsController
354- Router --> SupportStaffController
355313 AuthController --> JWTService
356314 AuthController --> UserModel
357- PlayersController --> PlayerModel
358- PlayerModel --> ChampionPoolModel
359- ScoutingController --> ScoutingTargetModel
360- ScoutingController --> Watchlist
361- Watchlist --> PostgreSQL
362- MatchesController --> MatchModel
363- MatchModel --> PlayerMatchStatModel
364- SchedulesController --> ScheduleModel
365- VODController --> VodReviewModel
366- VodReviewModel --> VodTimestampModel
367- GoalsController --> TeamGoalModel
368315 AnalyticsController --> PerformanceService
369316 AnalyticsController --> KDAService
370317 CompetitiveController --> PandaScoreService
371318 CompetitiveController --> DraftAnalyzer
372319 ScrimsController --> ScrimAnalytics
373320 ScrimAnalytics --> PostgreSQL
374- DraftPlansController --> DraftAnalysisService
375- SupportTicketsController --> SupportTicketModel
376- SupportFaqsController --> SupportFaqModel
377- SupportStaffController --> UserModel
378321 AuditLogModel[AuditLog Model] --> PostgreSQL
379- ChampionPoolModel[ChampionPool Model] --> PostgreSQL
380- CompetitiveMatchModel[CompetitiveMatch Model] --> PostgreSQL
381- DraftPlanModel[DraftPlan Model] --> PostgreSQL
382- MatchModel[Match Model] --> PostgreSQL
383- NotificationModel[Notification Model] --> PostgreSQL
384- OpponentTeamModel[OpponentTeam Model] --> PostgreSQL
322+ CurrentModel[Current Model] --> PostgreSQL
385323 OrganizationModel[Organization Model] --> PostgreSQL
386324 PasswordResetTokenModel[PasswordResetToken Model] --> PostgreSQL
387- PlayerModel[Player Model] --> PostgreSQL
388- PlayerMatchStatModel[PlayerMatchStat Model] --> PostgreSQL
389- ScheduleModel[Schedule Model] --> PostgreSQL
390- ScoutingTargetModel[ScoutingTarget Model] --> PostgreSQL
391- ScrimModel[Scrim Model] --> PostgreSQL
392- SupportFaqModel[SupportFaq Model] --> PostgreSQL
393- SupportTicketModel[Support Ticket Model] --> PostgreSQL
394- SupportTicketMessageModel[SupportTicketMessage Model] --> PostgreSQL
395- TacticalBoardModel[TacticalBoard Model] --> PostgreSQL
396- TeamGoalModel[Team Goal Model] --> PostgreSQL
397325 TokenBlacklistModel[TokenBlacklist Model] --> PostgreSQL
398326 UserModel[User Model] --> PostgreSQL
399- VodReviewModel[VodReview Model] --> PostgreSQL
400- VodTimestampModel[VodTimestamp Model] --> PostgreSQL
401327 JWTService --> Redis
402328 DashStats --> Redis
403329 PerformanceService --> Redis
@@ -408,9 +334,9 @@ graph TB
408334 RiotService --> RiotAPI
409335
410336 RiotService --> Sidekiq
411- PandaScoreService --> PandaScoreAPI
337+ PandaScoreService --> PandaScoreAPI[PandaScore API]
412338 Sidekiq -- Uses --> Redis
413-
339+
414340 style Client fill:#e1f5ff
415341 style PostgreSQL fill:#336791
416342 style Redis fill:#d82c20
@@ -419,80 +345,26 @@ graph TB
419345 style Sidekiq fill:#b1003e
420346```
421347
422- ** Key Architecture Principles:**
423-
424- 1 . ** Modular Monolith** : Each module under ` app/modules/<domain>/ ` is self-contained with its own controllers, models, jobs, serializers, policies and services
425- 2 . ** Zeitwerk Autoloading** : Custom ` config/initializers/zeitwerk.rb ` maps ` app/modules/<domain>/<layer>/ ` to the correct Ruby namespace — no manual ` require ` needed
426- 3 . ** API-Only** : Rails configured in API mode for JSON responses
427- 4 . ** JWT Authentication** : Stateless authentication using JWT tokens
428- 5 . ** Background Processing** : Long-running tasks handled by Sidekiq
429- 6 . ** Caching** : Redis used for session management and performance optimization
430- 7 . ** External Integration** : Riot Games API integration for real-time data
431- 8 . ** Rate Limiting** : Rack::Attack for API rate limiting
432- 9 . ** CORS** : Configured for cross-origin requests from frontend
433-
434- ### Deployment Architecture
435-
436- ``` mermaid
437- graph TB
438- subgraph "Clients"
439- FrontendApp["ProStaff.gg<br/>Front + TypeScript SPA"]
440- PlayerPortal["Player Portal<br/>JWT player token"]
441- end
442-
443- subgraph "Production — Coolify"
444- Traefik["Traefik<br/>TLS + Let's Encrypt<br/>WebSocket proxy"]
445- end
446-
447- subgraph "Rails — Puma"
448- Cable["Action Cable<br/>WebSocket /cable<br/>(team chat)"]
449- Router["Rails Router<br/>REST API v1<br/>200+ endpoints"]
450- Sidekiq["Sidekiq<br/>Background Workers<br/>(Riot sync · reindex)"]
451- end
452-
453- subgraph "Data"
454- PG[("PostgreSQL")]
455- RD[("Redis")]
456- Meili[("Meilisearch")]
457- end
458348
459- subgraph "External APIs"
460- RiotAPI["Riot Games API"]
461- PandaScore["PandaScore API"]
462- end
349+ > ** Better Visualization Options:**
350+ >
351+ > The diagram above may be difficult to read in GitHub's preview. For better visualization:
352+ > - ** [ View in Mermaid Live Editor] ( https://mermaid.live/ ) ** - Open ` diagram.mmd ` file in the live editor
353+ > - ** [ View in VS Code] ( https://marketplace.visualstudio.com/items?itemName=bierner.markdown-mermaid ) ** - Install Mermaid extension
354+ > - ** Export diagram** : Use the standalone ` diagram.mmd ` file for import into diagramming tools
355+ >
356+ > The complete Mermaid source is available in [ ` diagram.mmd ` ] ( ./diagram.mmd ) .
463357
464- FrontendApp -- "HTTPS REST" --> Traefik
465- FrontendApp -- "WSS /cable" --> Traefik
466- PlayerPortal -- "HTTPS REST" --> Traefik
467-
468- Traefik -- "HTTP" --> Router
469- Traefik -- "WS upgrade" --> Cable
470-
471- Router -- "reads / writes" --> PG
472- Router -- "cache · JWT blacklist" --> RD
473- Router -- "full-text search" --> Meili
474- Cable -- "pub/sub" --> RD
475- Sidekiq -- "async jobs" --> PG
476- Sidekiq -- "queue · cache" --> RD
477- Sidekiq -- "reindex docs" --> Meili
478-
479- Router -- "player data" --> RiotAPI
480- Sidekiq -- "match sync" --> RiotAPI
481- Router -- "pro matches" --> PandaScore
482-
483- style FrontendApp fill:#1e88e5
484- style PlayerPortal fill:#5c6bc0
485- style Traefik fill:#1565c0
486- style Cable fill:#b1003e
487- style Sidekiq fill:#b1003e
488- style PG fill:#336791
489- style RD fill:#d82c20
490- style Meili fill:#ff5722
491- style RiotAPI fill:#eb0029
492- style PandaScore fill:#ff6b35
493- ```
358+ ** Key Architecture Principles:**
494359
495- ---
360+ 1 . ** Modular Monolith** : Each module is self-contained with its own controllers, models, and services
361+ 2 . ** API-Only** : Rails configured in API mode for JSON responses
362+ 3 . ** JWT Authentication** : Stateless authentication using JWT tokens
363+ 4 . ** Background Processing** : Long-running tasks handled by Sidekiq
364+ 5 . ** Caching** : Redis used for session management and performance optimization
365+ 6 . ** External Integration** : Riot Games API integration for real-time data
366+ 7 . ** Rate Limiting** : Rack::Attack for API rate limiting
367+ 8 . ** CORS** : Configured for cross-origin requests from frontend
496368
497369## 04 · Setup
498370
0 commit comments