# orderPRO — Codebase Map

**Generated:** 2026-04-28 | **Version:** 3.2.0 | **Milestone:** v3.2 zamknięty (Phase 108 COMPLETE)

## What Is This Project

orderPRO is a **multi-channel order management system** for Polish e-commerce. It aggregates orders from Allegro (OAuth2) and shopPRO platforms, manages shipments via Apaczka and InPost APIs, generates PDF receipts/invoices, sends automated emails, and exposes a REST API for a Windows print client.

## Quick Navigation

| Document | Contents |
|----------|----------|
| [stack.md](stack.md) | PHP 8.4, custom framework, PDO, SCSS, PHPUnit, Composer deps |
| [architecture.md](architecture.md) | MVC + Repository + Service layers, modules, routing, data flows |
| [conventions.md](conventions.md) | Naming, code patterns, security, UI rules (from CLAUDE.md) |
| [testing.md](testing.md) | PHPUnit 11.5, test patterns, coverage areas |
| [integrations.md](integrations.md) | Allegro, shopPRO, Apaczka, InPost, Email, Print queue |
| [concerns.md](concerns.md) | Tech debt, SonarQube issues, known bugs, performance |
| [db_schema.md](db_schema.md) | Pełny schemat bazy danych — 55 tabel, typy kolumn, klucze, indeksy |
| [tech_changelog.md](tech_changelog.md) | Chronologiczny log zmian technicznych — co i dlaczego, per-phase |

## Key Directories

```
src/Core/           Custom framework (router, PDO, session, logger, CSRF)
src/Modules/        13 feature modules (Orders, Shipments, Accounting, Email, …)
routes/web.php      All ~80 routes in one file
resources/views/    PHP templates organized by module
resources/scss/     SCSS sources → public/assets/css/
database/migrations/ 84 SQL migration files (timestamped)
tests/Unit/         PHPUnit tests for services
.paul/codebase/     Mapa kodu (architecture, db_schema, tech_changelog, ...)
.paul/changelog/    Dziennik zmian per dzień (klient-friendly)
```

## Current State

- **Active phase:** — (Phase 108 COMPLETE, v3.2 zamknięty)
- **Last completed:** Phase 108 — Delivery Status Management (2026-04-27)
- **Total migrations:** 84+ (latest: delivery_status tables from Phase 108)
- **God classes to watch:** `OrdersRepository` (1221 LOC), `OrdersController` (1187 LOC), `AutomationService` (834 LOC)
- **BREAKING CHANGE (Phase 108):** Automation rules z kluczami group delivery status (`registered`, `courier_pickup`, `dropped_at_point`, `unclaimed`, `picked_up`) wymagają ręcznego odtworzenia po migracji do DB
