diff --git a/CLAUDE.md b/CLAUDE.md index 8f8a0bf86..aff1a9bf8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -137,3 +137,23 @@ The TorrentPier 3.0 release represents a major architectural shift focused on: - **Language system**: Update global $lang usage to new Language singleton methods When working with this codebase, prioritize modern architecture patterns and clean code practices. Focus on the new systems in `/src/` directory rather than maintaining legacy compatibility. + +## Markdown File Guidelines + +When creating or editing `.md` files in this project, follow these linting rules: + +### MD032 - Lists surrounded by blank lines +Always add blank lines before and after lists: + +```markdown +Some text here. + +- First item +- Second item +- Third item + +More text here. +``` + +### MD047 - Files should end with a single newline +Ensure every markdown file ends with exactly one newline character at the end of the file. diff --git a/docs/specs/hexagonal-architecture-spec.md b/docs/specs/hexagonal-architecture-spec.md index 5359dfa16..07dc0a672 100644 --- a/docs/specs/hexagonal-architecture-spec.md +++ b/docs/specs/hexagonal-architecture-spec.md @@ -375,26 +375,31 @@ return [ ## Implementation Order 1. **Phase 1: Foundation** + - Create directory structure - Set up base classes in Domain/Shared - Configure dependency injection 2. **Phase 2: Domain Modeling** + - Implement core aggregates - Create value objects - Define repository interfaces 3. **Phase 3: Application Services** + - Create commands and queries - Implement handlers - Set up event dispatching 4. **Phase 4: Infrastructure** + - Implement repositories - Configure database adapter - Set up caching 5. **Phase 5: Presentation** + - Create controllers - Implement middleware - Build CLI commands diff --git a/src/Application/Forum/Command/README.md b/src/Application/Forum/Command/README.md index 1b05c6a19..eae098d4a 100644 --- a/src/Application/Forum/Command/README.md +++ b/src/Application/Forum/Command/README.md @@ -1,6 +1,7 @@ # Forum Commands Commands representing write operations: + - `CreateThreadCommand`: Start new discussion - `CreatePostCommand`: Reply to thread - `EditPostCommand`: Modify existing post diff --git a/src/Application/Forum/Handler/README.md b/src/Application/Forum/Handler/README.md index d46095c43..4af804611 100644 --- a/src/Application/Forum/Handler/README.md +++ b/src/Application/Forum/Handler/README.md @@ -1,6 +1,7 @@ # Forum Handlers Command and query handlers for forum operations: + - `CreateThreadHandler`: Handles thread creation - `CreatePostHandler`: Handles post creation - `GetThreadListHandler`: Retrieves thread listings diff --git a/src/Application/Forum/Query/README.md b/src/Application/Forum/Query/README.md index f4b94f32c..845ef3948 100644 --- a/src/Application/Forum/Query/README.md +++ b/src/Application/Forum/Query/README.md @@ -1,6 +1,7 @@ # Forum Queries Read-only queries for forum data: + - `GetThreadListQuery`: Paginated thread listing - `GetPostsByThreadQuery`: Thread posts with pagination - `SearchPostsQuery`: Full-text post search diff --git a/src/Application/README.md b/src/Application/README.md index 27a871567..f7a27973c 100644 --- a/src/Application/README.md +++ b/src/Application/README.md @@ -1,11 +1,13 @@ # Application Layer Contains application services that orchestrate domain objects to fulfill use cases. + - Commands: Write operations that change state - Queries: Read operations for data retrieval - Handlers: Process commands and queries This layer should: + - Coordinate domain objects - Handle transactions - Dispatch domain events diff --git a/src/Application/Tracker/Command/README.md b/src/Application/Tracker/Command/README.md index 76bee99c4..800c6579d 100644 --- a/src/Application/Tracker/Command/README.md +++ b/src/Application/Tracker/Command/README.md @@ -1,11 +1,13 @@ # Tracker Commands Commands representing write operations: + - `RegisterTorrentCommand`: Register new torrent - `UpdateTorrentCommand`: Modify torrent details - `DeleteTorrentCommand`: Remove torrent from tracker Example: + ```php final class RegisterTorrentCommand { diff --git a/src/Application/Tracker/Handler/README.md b/src/Application/Tracker/Handler/README.md index 7125e0c97..b30755d33 100644 --- a/src/Application/Tracker/Handler/README.md +++ b/src/Application/Tracker/Handler/README.md @@ -1,6 +1,7 @@ # Tracker Handlers Command and query handlers for tracker operations: + - `RegisterTorrentHandler`: Processes torrent registration - `GetTorrentDetailsHandler`: Retrieves torrent information - `UpdateTorrentHandler`: Handles torrent updates diff --git a/src/Application/Tracker/Query/README.md b/src/Application/Tracker/Query/README.md index c16c7581c..05e42e39f 100644 --- a/src/Application/Tracker/Query/README.md +++ b/src/Application/Tracker/Query/README.md @@ -1,6 +1,7 @@ # Tracker Queries Read-only queries for tracker data: + - `GetTorrentDetailsQuery`: Single torrent information - `GetPeerListQuery`: Active peers for torrent - `GetTorrentStatsQuery`: Download/upload statistics diff --git a/src/Application/User/Command/README.md b/src/Application/User/Command/README.md index 41afee1dc..fbf0342be 100644 --- a/src/Application/User/Command/README.md +++ b/src/Application/User/Command/README.md @@ -1,6 +1,7 @@ # User Commands Commands for user management operations: + - `RegisterUserCommand`: New user registration - `ChangePasswordCommand`: Password update - `UpdateProfileCommand`: Profile modifications diff --git a/src/Application/User/Handler/README.md b/src/Application/User/Handler/README.md index 5204eed78..8f34ce418 100644 --- a/src/Application/User/Handler/README.md +++ b/src/Application/User/Handler/README.md @@ -1,6 +1,7 @@ # User Handlers Command and query handlers for user operations: + - `RegisterUserHandler`: Processes user registration - `ChangePasswordHandler`: Handles password changes - `GetUserProfileHandler`: Retrieves user profiles diff --git a/src/Application/User/Query/README.md b/src/Application/User/Query/README.md index ddb5cd6f1..1307a51ec 100644 --- a/src/Application/User/Query/README.md +++ b/src/Application/User/Query/README.md @@ -1,6 +1,7 @@ # User Queries Read operations for user data: + - `GetUserProfileQuery`: User profile details - `SearchUsersQuery`: User search with filters - `GetUserStatisticsQuery`: Upload/download stats diff --git a/src/Domain/Forum/Exception/README.md b/src/Domain/Forum/Exception/README.md index 1401782dd..07a483fe6 100644 --- a/src/Domain/Forum/Exception/README.md +++ b/src/Domain/Forum/Exception/README.md @@ -1,6 +1,7 @@ # Forum Domain Exceptions Domain-specific exceptions for forum operations: + - `ThreadLockedException`: Attempt to post in locked thread - `PostEditTimeExpiredException`: Edit time limit exceeded - `ForumAccessDeniedException`: Insufficient permissions diff --git a/src/Domain/Forum/Model/README.md b/src/Domain/Forum/Model/README.md index cdfa1bc13..6dafb0894 100644 --- a/src/Domain/Forum/Model/README.md +++ b/src/Domain/Forum/Model/README.md @@ -1,12 +1,14 @@ # Forum Domain Models Contains aggregate roots and entities for the forum system: + - `Forum`: Forum category aggregate - `Thread`: Discussion thread aggregate root - `Post`: Individual post entity - `Attachment`: File attachment entity Business rules enforced at this level: + - Post editing time limits - Thread locking rules - Forum access permissions diff --git a/src/Domain/Forum/Repository/README.md b/src/Domain/Forum/Repository/README.md index da02f7612..1a8430801 100644 --- a/src/Domain/Forum/Repository/README.md +++ b/src/Domain/Forum/Repository/README.md @@ -1,6 +1,7 @@ # Forum Repository Interfaces Repository interfaces for forum aggregates: + - `ForumRepositoryInterface`: Forum aggregate persistence - `ThreadRepositoryInterface`: Thread aggregate persistence - `PostRepositoryInterface`: Post queries (read-only) diff --git a/src/Domain/Forum/ValueObject/README.md b/src/Domain/Forum/ValueObject/README.md index 5999d305d..eb8aec659 100644 --- a/src/Domain/Forum/ValueObject/README.md +++ b/src/Domain/Forum/ValueObject/README.md @@ -1,6 +1,7 @@ # Forum Value Objects Immutable objects representing forum concepts: + - `PostId`: Unique post identifier - `ThreadTitle`: Thread title with validation - `PostContent`: Formatted post content diff --git a/src/Domain/README.md b/src/Domain/README.md index 1a02f9092..cb9254a68 100644 --- a/src/Domain/README.md +++ b/src/Domain/README.md @@ -1,12 +1,14 @@ # Domain Layer This directory contains the core business logic of TorrentPier. Code here should: + - Have no dependencies on frameworks or infrastructure - Represent pure business rules and domain models - Be testable in isolation - Use only PHP language features and domain concepts ## Bounded Contexts + - **Forum**: Discussion forums, posts, threads - **Tracker**: BitTorrent tracking, peers, torrents - **User**: User management, authentication, profiles diff --git a/src/Domain/Shared/Event/README.md b/src/Domain/Shared/Event/README.md index 9184a8284..11656fb4a 100644 --- a/src/Domain/Shared/Event/README.md +++ b/src/Domain/Shared/Event/README.md @@ -1,11 +1,13 @@ # Domain Events Base classes and interfaces for domain event system: + - `DomainEvent`: Base event interface - `EventRecording`: Trait for aggregate event recording - `AggregateHistory`: Event sourcing support Example events: + - `UserRegisteredEvent` - `TorrentUploadedEvent` - `ThreadCreatedEvent` diff --git a/src/Domain/Shared/Exception/README.md b/src/Domain/Shared/Exception/README.md index 3e73b731b..2c5a556bd 100644 --- a/src/Domain/Shared/Exception/README.md +++ b/src/Domain/Shared/Exception/README.md @@ -1,6 +1,7 @@ # Shared Domain Exceptions Base exception classes used across all bounded contexts: + - `DomainException`: Base domain exception - `InvalidArgumentException`: Invalid input validation - `EntityNotFoundException`: Generic entity not found diff --git a/src/Domain/Shared/Model/README.md b/src/Domain/Shared/Model/README.md index ec67dddc6..4daf36150 100644 --- a/src/Domain/Shared/Model/README.md +++ b/src/Domain/Shared/Model/README.md @@ -1,6 +1,7 @@ # Shared Domain Models Base classes and interfaces used across bounded contexts: + - `AggregateRoot`: Base class for all aggregates - `Entity`: Base class for entities - `DomainEvent`: Interface for domain events diff --git a/src/Domain/Shared/Repository/README.md b/src/Domain/Shared/Repository/README.md index 5f3f80b1c..999f9d300 100644 --- a/src/Domain/Shared/Repository/README.md +++ b/src/Domain/Shared/Repository/README.md @@ -1,9 +1,9 @@ # Shared Repository Interfaces Common repository patterns and base interfaces: + - `RepositoryInterface`: Base repository contract - `ReadOnlyRepositoryInterface`: Query-only operations - `AggregateRepositoryInterface`: Aggregate-specific methods -- `Specification`: Query specification pattern These define common persistence patterns without implementation details. \ No newline at end of file diff --git a/src/Domain/Shared/ValueObject/README.md b/src/Domain/Shared/ValueObject/README.md index c65b057e9..afc5b7bc6 100644 --- a/src/Domain/Shared/ValueObject/README.md +++ b/src/Domain/Shared/ValueObject/README.md @@ -1,6 +1,7 @@ # Shared Value Objects Common value objects used across contexts: + - `Id`: Generic identifier base class - `DateTime`: Immutable datetime wrapper - `Money`: Monetary value representation diff --git a/src/Domain/Tracker/Exception/README.md b/src/Domain/Tracker/Exception/README.md index bee3e83d8..73ae0f882 100644 --- a/src/Domain/Tracker/Exception/README.md +++ b/src/Domain/Tracker/Exception/README.md @@ -1,6 +1,7 @@ # Tracker Domain Exceptions Domain-specific exceptions for tracker operations: + - `InvalidInfoHashException`: Malformed info hash - `InactiveTorrentException`: Torrent not active - `PeerLimitExceededException`: Too many peers diff --git a/src/Domain/Tracker/Model/README.md b/src/Domain/Tracker/Model/README.md index 805fd96d9..124456276 100644 --- a/src/Domain/Tracker/Model/README.md +++ b/src/Domain/Tracker/Model/README.md @@ -1,11 +1,13 @@ # Tracker Domain Models Contains aggregate roots and entities for the BitTorrent tracker: + - `Torrent`: Aggregate root for torrent management - `Peer`: Entity representing a BitTorrent peer - `TorrentStatistics`: Value object for torrent stats Example: + ```php class Torrent extends AggregateRoot { diff --git a/src/Domain/Tracker/Repository/README.md b/src/Domain/Tracker/Repository/README.md index 9158f300b..3745d6e4e 100644 --- a/src/Domain/Tracker/Repository/README.md +++ b/src/Domain/Tracker/Repository/README.md @@ -1,6 +1,7 @@ # Tracker Repository Interfaces Repository interfaces for tracker aggregates: + - `TorrentRepositoryInterface`: Torrent aggregate persistence - `PeerRepositoryInterface`: Peer data access - `TrackerStatsRepositoryInterface`: Statistics queries diff --git a/src/Domain/Tracker/ValueObject/README.md b/src/Domain/Tracker/ValueObject/README.md index 2e2bce542..cd3fcf0ee 100644 --- a/src/Domain/Tracker/ValueObject/README.md +++ b/src/Domain/Tracker/ValueObject/README.md @@ -1,12 +1,14 @@ # Tracker Value Objects Immutable objects representing domain concepts: + - `InfoHash`: 20-byte torrent identifier - `PeerId`: Peer client identifier - `Port`: Network port (1-65535) - `BytesTransferred`: Upload/download bytes Example: + ```php final class InfoHash { diff --git a/src/Domain/User/Exception/README.md b/src/Domain/User/Exception/README.md index 16fb4fd06..f689a7943 100644 --- a/src/Domain/User/Exception/README.md +++ b/src/Domain/User/Exception/README.md @@ -1,6 +1,7 @@ # User Domain Exceptions Domain-specific exceptions for user operations: + - `UserNotFoundException`: User not found - `DuplicateUsernameException`: Username already taken - `InvalidCredentialsException`: Authentication failed diff --git a/src/Domain/User/Model/README.md b/src/Domain/User/Model/README.md index 90dc02202..2001b3ebd 100644 --- a/src/Domain/User/Model/README.md +++ b/src/Domain/User/Model/README.md @@ -1,12 +1,14 @@ # User Domain Models Contains user management aggregates and entities: + - `User`: User aggregate root - `UserProfile`: User profile information - `UserCredentials`: Authentication credentials - `UserPermissions`: Authorization rules Business rules: + - Password complexity requirements - Username uniqueness - Email verification workflow diff --git a/src/Domain/User/Repository/README.md b/src/Domain/User/Repository/README.md index 870d24dbb..9d4c463c7 100644 --- a/src/Domain/User/Repository/README.md +++ b/src/Domain/User/Repository/README.md @@ -1,6 +1,7 @@ # User Repository Interface Repository interface for user aggregate: + - `UserRepositoryInterface`: User persistence and retrieval - `findById(UserId $id): ?User` - `findByUsername(Username $username): ?User` diff --git a/src/Domain/User/ValueObject/README.md b/src/Domain/User/ValueObject/README.md index a4c32706f..79c930883 100644 --- a/src/Domain/User/ValueObject/README.md +++ b/src/Domain/User/ValueObject/README.md @@ -1,6 +1,7 @@ # User Value Objects Immutable objects for user domain: + - `UserId`: Unique user identifier - `Username`: Username with validation - `Email`: Email address with format validation diff --git a/src/Infrastructure/Cache/File/README.md b/src/Infrastructure/Cache/File/README.md index 4a4f2923b..9f781c1b9 100644 --- a/src/Infrastructure/Cache/File/README.md +++ b/src/Infrastructure/Cache/File/README.md @@ -1,6 +1,7 @@ # File Cache Adapter File system-based caching implementation: + - Simple file-based storage - Suitable for single-server deployments - Directory structure optimization diff --git a/src/Infrastructure/Cache/Memcached/README.md b/src/Infrastructure/Cache/Memcached/README.md index f3df59150..2e60b7e0b 100644 --- a/src/Infrastructure/Cache/Memcached/README.md +++ b/src/Infrastructure/Cache/Memcached/README.md @@ -1,6 +1,7 @@ # Memcached Cache Adapter Memcached-based caching implementation: + - Simple key-value caching - Distributed cache support - Automatic key expiration diff --git a/src/Infrastructure/Cache/Redis/README.md b/src/Infrastructure/Cache/Redis/README.md index 6e79485eb..da7e090aa 100644 --- a/src/Infrastructure/Cache/Redis/README.md +++ b/src/Infrastructure/Cache/Redis/README.md @@ -1,6 +1,7 @@ # Redis Cache Adapter Redis-based caching implementation: + - High-performance key-value storage - Support for data structures (lists, sets, hashes) - TTL management diff --git a/src/Infrastructure/Email/Template/README.md b/src/Infrastructure/Email/Template/README.md index 2a356ef06..3497a96ba 100644 --- a/src/Infrastructure/Email/Template/README.md +++ b/src/Infrastructure/Email/Template/README.md @@ -1,6 +1,7 @@ # Email Templates Email template management: + - HTML and plain text templates - Template variables and placeholders - Multi-language support @@ -8,6 +9,7 @@ Email template management: - Preview functionality Common templates: + - User registration confirmation - Password reset - Torrent notifications diff --git a/src/Infrastructure/Email/Transport/README.md b/src/Infrastructure/Email/Transport/README.md index f2ceae680..0de823895 100644 --- a/src/Infrastructure/Email/Transport/README.md +++ b/src/Infrastructure/Email/Transport/README.md @@ -1,6 +1,7 @@ # Email Transport Email delivery mechanisms: + - `SmtpTransport`: Traditional SMTP delivery - `SendgridTransport`: SendGrid API integration - `MailgunTransport`: Mailgun API integration diff --git a/src/Infrastructure/FileStorage/Local/README.md b/src/Infrastructure/FileStorage/Local/README.md index 2ec779f0d..cb0fdac49 100644 --- a/src/Infrastructure/FileStorage/Local/README.md +++ b/src/Infrastructure/FileStorage/Local/README.md @@ -1,6 +1,7 @@ # Local File Storage Local filesystem storage implementation: + - Direct disk storage - Directory structure management - File permissions handling diff --git a/src/Infrastructure/FileStorage/S3/README.md b/src/Infrastructure/FileStorage/S3/README.md index c2c399b5e..c008d9f5a 100644 --- a/src/Infrastructure/FileStorage/S3/README.md +++ b/src/Infrastructure/FileStorage/S3/README.md @@ -1,6 +1,7 @@ # S3 File Storage Amazon S3 (or compatible) storage implementation: + - Cloud object storage - Pre-signed URLs for direct uploads - CDN integration support diff --git a/src/Infrastructure/Persistence/Database/README.md b/src/Infrastructure/Persistence/Database/README.md index 45e3f3e7d..c250b60e8 100644 --- a/src/Infrastructure/Persistence/Database/README.md +++ b/src/Infrastructure/Persistence/Database/README.md @@ -1,6 +1,7 @@ # Database Adapter Database connection and query building layer: + - `DatabaseAdapterInterface`: Common database operations - `QueryBuilder`: Fluent query construction - `ConnectionPool`: Connection management diff --git a/src/Infrastructure/Persistence/Migration/README.md b/src/Infrastructure/Persistence/Migration/README.md index aa7bf5fc2..1f203e645 100644 --- a/src/Infrastructure/Persistence/Migration/README.md +++ b/src/Infrastructure/Persistence/Migration/README.md @@ -1,6 +1,7 @@ # Database Migrations Schema version control and migration management: + - Migration files for schema changes - Seed data for initial setup - Rollback support diff --git a/src/Infrastructure/Persistence/Repository/README.md b/src/Infrastructure/Persistence/Repository/README.md index 49763acf5..002760d4a 100644 --- a/src/Infrastructure/Persistence/Repository/README.md +++ b/src/Infrastructure/Persistence/Repository/README.md @@ -1,12 +1,14 @@ # Repository Implementations Concrete implementations of domain repository interfaces: + - Uses database adapter for persistence - Implements caching strategies - Handles query optimization - Supports multiple database backends Example: + ```php class TorrentRepository implements TorrentRepositoryInterface { diff --git a/src/Infrastructure/README.md b/src/Infrastructure/README.md index 54bbc2937..2098a9f97 100644 --- a/src/Infrastructure/README.md +++ b/src/Infrastructure/README.md @@ -1,6 +1,7 @@ # Infrastructure Layer Technical implementations and external service adapters: + - Database persistence - Caching mechanisms - Email services diff --git a/src/Presentation/Cli/Commands/README.md b/src/Presentation/Cli/Commands/README.md index 4016fac0b..5e2cf1239 100644 --- a/src/Presentation/Cli/Commands/README.md +++ b/src/Presentation/Cli/Commands/README.md @@ -1,6 +1,7 @@ # CLI Commands Console commands for administrative tasks: + - `UserCreateCommand`: Create users from CLI - `CacheClearCommand`: Clear cache stores - `MigrateCommand`: Run database migrations diff --git a/src/Presentation/Http/Controllers/Admin/README.md b/src/Presentation/Http/Controllers/Admin/README.md index 2bea19e76..6e478949b 100644 --- a/src/Presentation/Http/Controllers/Admin/README.md +++ b/src/Presentation/Http/Controllers/Admin/README.md @@ -1,12 +1,14 @@ # Admin Panel Controllers Administrative interface controllers with enhanced security: + - Role-based access control (RBAC) - Audit logging for all actions - Additional authentication checks - Administrative dashboards and reports Example: + ```php class AdminUserController { diff --git a/src/Presentation/Http/Controllers/Api/README.md b/src/Presentation/Http/Controllers/Api/README.md index cbf7c0342..7d944db2e 100644 --- a/src/Presentation/Http/Controllers/Api/README.md +++ b/src/Presentation/Http/Controllers/Api/README.md @@ -1,12 +1,14 @@ # API Controllers RESTful API endpoints following OpenAPI specification: + - JSON request/response format - Proper HTTP status codes - HATEOAS where applicable - Rate limiting aware Example: + ```php class UserController { diff --git a/src/Presentation/Http/Controllers/Web/README.md b/src/Presentation/Http/Controllers/Web/README.md index b5a2917e3..015c2d19c 100644 --- a/src/Presentation/Http/Controllers/Web/README.md +++ b/src/Presentation/Http/Controllers/Web/README.md @@ -1,6 +1,7 @@ # Web Controllers Traditional web interface controllers: + - HTML response generation - Template rendering - Form handling @@ -8,6 +9,7 @@ Traditional web interface controllers: - CSRF protection Controllers for: + - Forum browsing and posting - Torrent browsing and downloading - User profiles and settings diff --git a/src/Presentation/Http/Middleware/README.md b/src/Presentation/Http/Middleware/README.md index 558216c14..c5a1d1a0c 100644 --- a/src/Presentation/Http/Middleware/README.md +++ b/src/Presentation/Http/Middleware/README.md @@ -1,6 +1,7 @@ # HTTP Middleware Request/response pipeline middleware: + - `AuthenticationMiddleware`: User authentication - `AuthorizationMiddleware`: Permission checks - `CsrfProtectionMiddleware`: CSRF token validation diff --git a/src/Presentation/Http/Requests/README.md b/src/Presentation/Http/Requests/README.md index b13d87f4e..8e0a47d1c 100644 --- a/src/Presentation/Http/Requests/README.md +++ b/src/Presentation/Http/Requests/README.md @@ -1,6 +1,7 @@ # HTTP Requests Request objects and validation: + - Request DTOs with validation rules - Type-safe access to request data - File upload handling @@ -8,6 +9,7 @@ Request objects and validation: - Custom validation rules Example: + ```php class RegisterRequest extends FormRequest { diff --git a/src/Presentation/Http/Responses/README.md b/src/Presentation/Http/Responses/README.md index f4f878dcd..bce8c8325 100644 --- a/src/Presentation/Http/Responses/README.md +++ b/src/Presentation/Http/Responses/README.md @@ -1,6 +1,7 @@ # HTTP Responses Response transformation and formatting: + - Response factories - JSON transformers - View presenters diff --git a/src/Presentation/README.md b/src/Presentation/README.md index 185efc3b8..3e99a424b 100644 --- a/src/Presentation/README.md +++ b/src/Presentation/README.md @@ -1,6 +1,7 @@ # Presentation Layer User interface implementations: + - HTTP controllers for web and API - CLI commands for console operations - Request/response handling