@pixelcraft-tw/spec 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +195 -0
  3. package/dist/bin/pxs.d.ts +2 -0
  4. package/dist/bin/pxs.js +5 -0
  5. package/dist/bin/pxs.js.map +1 -0
  6. package/dist/src/backends/claude.d.ts +9 -0
  7. package/dist/src/backends/claude.js +80 -0
  8. package/dist/src/backends/claude.js.map +1 -0
  9. package/dist/src/backends/codex.d.ts +9 -0
  10. package/dist/src/backends/codex.js +72 -0
  11. package/dist/src/backends/codex.js.map +1 -0
  12. package/dist/src/backends/factory.d.ts +2 -0
  13. package/dist/src/backends/factory.js +14 -0
  14. package/dist/src/backends/factory.js.map +1 -0
  15. package/dist/src/backends/interface.d.ts +15 -0
  16. package/dist/src/backends/interface.js +2 -0
  17. package/dist/src/backends/interface.js.map +1 -0
  18. package/dist/src/cli.d.ts +2 -0
  19. package/dist/src/cli.js +94 -0
  20. package/dist/src/cli.js.map +1 -0
  21. package/dist/src/commands/clarify.d.ts +5 -0
  22. package/dist/src/commands/clarify.js +46 -0
  23. package/dist/src/commands/clarify.js.map +1 -0
  24. package/dist/src/commands/diff.d.ts +1 -0
  25. package/dist/src/commands/diff.js +81 -0
  26. package/dist/src/commands/diff.js.map +1 -0
  27. package/dist/src/commands/implement.d.ts +9 -0
  28. package/dist/src/commands/implement.js +247 -0
  29. package/dist/src/commands/implement.js.map +1 -0
  30. package/dist/src/commands/init.d.ts +6 -0
  31. package/dist/src/commands/init.js +183 -0
  32. package/dist/src/commands/init.js.map +1 -0
  33. package/dist/src/commands/new.d.ts +5 -0
  34. package/dist/src/commands/new.js +186 -0
  35. package/dist/src/commands/new.js.map +1 -0
  36. package/dist/src/commands/refine.d.ts +8 -0
  37. package/dist/src/commands/refine.js +158 -0
  38. package/dist/src/commands/refine.js.map +1 -0
  39. package/dist/src/commands/reset.d.ts +3 -0
  40. package/dist/src/commands/reset.js +44 -0
  41. package/dist/src/commands/reset.js.map +1 -0
  42. package/dist/src/commands/review.d.ts +4 -0
  43. package/dist/src/commands/review.js +70 -0
  44. package/dist/src/commands/review.js.map +1 -0
  45. package/dist/src/commands/status.d.ts +1 -0
  46. package/dist/src/commands/status.js +53 -0
  47. package/dist/src/commands/status.js.map +1 -0
  48. package/dist/src/discovery/project.d.ts +7 -0
  49. package/dist/src/discovery/project.js +135 -0
  50. package/dist/src/discovery/project.js.map +1 -0
  51. package/dist/src/git/operations.d.ts +10 -0
  52. package/dist/src/git/operations.js +56 -0
  53. package/dist/src/git/operations.js.map +1 -0
  54. package/dist/src/parsers/arguments.d.ts +18 -0
  55. package/dist/src/parsers/arguments.js +43 -0
  56. package/dist/src/parsers/arguments.js.map +1 -0
  57. package/dist/src/parsers/plan.d.ts +23 -0
  58. package/dist/src/parsers/plan.js +117 -0
  59. package/dist/src/parsers/plan.js.map +1 -0
  60. package/dist/src/parsers/spec.d.ts +10 -0
  61. package/dist/src/parsers/spec.js +46 -0
  62. package/dist/src/parsers/spec.js.map +1 -0
  63. package/dist/src/state/manager.d.ts +24 -0
  64. package/dist/src/state/manager.js +103 -0
  65. package/dist/src/state/manager.js.map +1 -0
  66. package/dist/src/state/types.d.ts +48 -0
  67. package/dist/src/state/types.js +20 -0
  68. package/dist/src/state/types.js.map +1 -0
  69. package/dist/src/utils/display.d.ts +7 -0
  70. package/dist/src/utils/display.js +42 -0
  71. package/dist/src/utils/display.js.map +1 -0
  72. package/dist/src/utils/prompt.d.ts +15 -0
  73. package/dist/src/utils/prompt.js +139 -0
  74. package/dist/src/utils/prompt.js.map +1 -0
  75. package/package.json +52 -0
  76. package/templates/agents-md-snippet.md +20 -0
  77. package/templates/architectures/clean/csharp-aspnet.md +56 -0
  78. package/templates/architectures/clean/dart-flutter.md +73 -0
  79. package/templates/architectures/clean/go-gin.md +50 -0
  80. package/templates/architectures/clean/go-std.md +49 -0
  81. package/templates/architectures/clean/kotlin-android.md +70 -0
  82. package/templates/architectures/clean/python-fastapi.md +49 -0
  83. package/templates/architectures/clean/swift-ios.md +69 -0
  84. package/templates/architectures/clean/typescript-express.md +60 -0
  85. package/templates/architectures/clean/typescript-nestjs.md +61 -0
  86. package/templates/architectures/ddd/csharp-aspnet.md +55 -0
  87. package/templates/architectures/ddd/go-gin.md +53 -0
  88. package/templates/architectures/ddd/python-fastapi.md +52 -0
  89. package/templates/architectures/ddd/typescript-nestjs.md +62 -0
  90. package/templates/architectures/hexagonal/csharp-aspnet.md +45 -0
  91. package/templates/architectures/hexagonal/go-gin.md +47 -0
  92. package/templates/architectures/hexagonal/python-fastapi.md +43 -0
  93. package/templates/architectures/hexagonal/typescript-nestjs.md +44 -0
  94. package/templates/architectures/layered/csharp-aspnet.md +45 -0
  95. package/templates/architectures/layered/go-gin.md +41 -0
  96. package/templates/architectures/layered/python-fastapi.md +42 -0
  97. package/templates/architectures/layered/typescript-nestjs.md +48 -0
  98. package/templates/architectures/modular/csharp-aspnet.md +45 -0
  99. package/templates/architectures/modular/dart-flutter.md +64 -0
  100. package/templates/architectures/modular/go-gin.md +47 -0
  101. package/templates/architectures/modular/kotlin-android.md +68 -0
  102. package/templates/architectures/modular/python-fastapi.md +45 -0
  103. package/templates/architectures/modular/swift-ios.md +55 -0
  104. package/templates/architectures/modular/typescript-nestjs.md +48 -0
  105. package/templates/architectures/mvvm/dart-flutter.md +69 -0
  106. package/templates/architectures/mvvm/kotlin-android.md +79 -0
  107. package/templates/architectures/mvvm/swift-ios.md +66 -0
  108. package/templates/claude-commands/sf.clarify.md +18 -0
  109. package/templates/claude-commands/sf.implement.md +80 -0
  110. package/templates/claude-commands/sf.new.md +22 -0
  111. package/templates/claude-commands/sf.refine.md +47 -0
  112. package/templates/claude-commands/sf.review.md +17 -0
  113. package/templates/claude-commands/sf.status.md +12 -0
  114. package/templates/workflow/config.yaml +17 -0
  115. package/templates/workflow/prompts/clarify.md +39 -0
  116. package/templates/workflow/prompts/final-review.md +30 -0
  117. package/templates/workflow/prompts/implement-tdd.md +35 -0
  118. package/templates/workflow/prompts/implement.md +43 -0
  119. package/templates/workflow/prompts/refine.md +52 -0
  120. package/templates/workflow/prompts/review.md +33 -0
  121. package/templates/workflow/prompts/test.md +14 -0
  122. package/templates/workflow/templates/spec-template.md +13 -0
@@ -0,0 +1,45 @@
1
+ # Architecture: Layered / Three-Tier (C# + ASP.NET Core)
2
+
3
+ ## Project Structure
4
+ ```
5
+ src/
6
+ ├── Controllers/
7
+ │ ├── OrderController.cs
8
+ │ └── AuthController.cs
9
+ ├── Services/
10
+ │ ├── IOrderService.cs
11
+ │ ├── OrderService.cs
12
+ │ └── IAuthService.cs
13
+ ├── Repositories/
14
+ │ ├── IOrderRepository.cs
15
+ │ ├── OrderRepository.cs
16
+ │ └── ApplicationDbContext.cs
17
+ ├── Models/
18
+ │ ├── Order.cs
19
+ │ └── User.cs
20
+ ├── DTOs/
21
+ │ ├── CreateOrderDto.cs
22
+ │ └── LoginDto.cs
23
+ ├── Middleware/
24
+ │ └── ExceptionHandlerMiddleware.cs
25
+ └── Program.cs
26
+ ```
27
+
28
+ ## Layer Dependencies
29
+ - Controllers → Services → Repositories → Database
30
+ - Each layer only depends on the layer directly below
31
+
32
+ ## Conventions
33
+ - Interface-based DI for Services and Repositories
34
+ - EF Core for data access
35
+ - DTOs at controller boundary
36
+ - Middleware for cross-cutting concerns
37
+
38
+ ## File Naming
39
+ - PascalCase: OrderService.cs
40
+ - Interface prefix: IOrderService.cs
41
+
42
+ ## Testing
43
+ - Services: unit tests (xUnit + NSubstitute)
44
+ - Controllers: unit tests with mocked services
45
+ - Repositories: integration tests (WebApplicationFactory)
@@ -0,0 +1,41 @@
1
+ # Architecture: Layered / Three-Tier (Go + Gin)
2
+
3
+ ## Directory Structure
4
+ ```
5
+ internal/
6
+ ├── handler/
7
+ │ ├── order_handler.go
8
+ │ ├── auth_handler.go
9
+ │ ├── middleware/
10
+ │ └── router.go
11
+ ├── service/
12
+ │ ├── order_service.go
13
+ │ └── auth_service.go
14
+ ├── repository/
15
+ │ ├── order_repo.go
16
+ │ └── user_repo.go
17
+ ├── model/
18
+ │ ├── order.go
19
+ │ └── user.go
20
+ └── config/
21
+ └── env.go
22
+ ```
23
+
24
+ ## Layer Dependencies
25
+ - Handler → Service → Repository → Database
26
+ - Each layer only depends on the layer directly below
27
+
28
+ ## Conventions
29
+ - Handlers handle HTTP concerns (Gin context)
30
+ - Services contain business logic, accept/return domain models
31
+ - Repositories handle data access
32
+ - Interfaces defined at consumer side for testability
33
+
34
+ ## File Naming
35
+ - snake_case: order_service.go
36
+ - Test files: order_service_test.go
37
+
38
+ ## Testing
39
+ - services: unit tests with mocked repositories
40
+ - handlers: HTTP tests (httptest)
41
+ - repositories: integration tests
@@ -0,0 +1,42 @@
1
+ # Architecture: Layered / Three-Tier (Python + FastAPI)
2
+
3
+ ## Directory Structure
4
+ ```
5
+ src/
6
+ ├── routers/
7
+ │ ├── order_router.py
8
+ │ └── auth_router.py
9
+ ├── services/
10
+ │ ├── order_service.py
11
+ │ └── auth_service.py
12
+ ├── repositories/
13
+ │ ├── order_repository.py
14
+ │ └── user_repository.py
15
+ ├── models/
16
+ │ ├── order.py
17
+ │ └── user.py
18
+ ├── schemas/
19
+ │ ├── order_schema.py # Pydantic models
20
+ │ └── auth_schema.py
21
+ ├── config.py
22
+ └── main.py
23
+ ```
24
+
25
+ ## Layer Dependencies
26
+ - Routers → Services → Repositories → Database
27
+ - Each layer only depends on the layer directly below
28
+
29
+ ## Conventions
30
+ - FastAPI dependency injection for wiring
31
+ - Pydantic schemas at router boundary
32
+ - Services contain business logic
33
+ - Repositories handle SQLAlchemy queries
34
+
35
+ ## File Naming
36
+ - snake_case: order_service.py
37
+ - Test files: test_order_service.py
38
+
39
+ ## Testing
40
+ - services: unit tests (pytest + mock)
41
+ - routers: HTTP tests (TestClient)
42
+ - repositories: integration tests
@@ -0,0 +1,48 @@
1
+ # Architecture: Layered / Three-Tier (NestJS)
2
+
3
+ ## Directory Structure
4
+ ```
5
+ src/
6
+ ├── controllers/
7
+ │ ├── order.controller.ts
8
+ │ └── auth.controller.ts
9
+ ├── services/
10
+ │ ├── order.service.ts
11
+ │ └── auth.service.ts
12
+ ├── repositories/
13
+ │ ├── order.repository.ts
14
+ │ └── user.repository.ts
15
+ ├── entities/
16
+ │ ├── order.entity.ts
17
+ │ └── user.entity.ts
18
+ ├── dtos/
19
+ │ ├── create-order.dto.ts
20
+ │ └── login.dto.ts
21
+ ├── guards/
22
+ ├── interceptors/
23
+ ├── pipes/
24
+ └── app.module.ts
25
+ ```
26
+
27
+ ## Layer Dependencies
28
+ - Controllers → Services → Repositories → Database
29
+ - Each layer only depends on the layer directly below
30
+
31
+ ## Conventions
32
+ - Controllers handle HTTP, validate input via DTOs + Pipes
33
+ - Services contain business logic
34
+ - Repositories handle data access (TypeORM/Prisma/MikroORM)
35
+ - NestJS DI wires everything together
36
+
37
+ ## File Naming
38
+ - kebab-case: order.service.ts, create-order.dto.ts
39
+ - Controller: *.controller.ts
40
+ - Service: *.service.ts
41
+ - Repository: *.repository.ts
42
+ - Entity: *.entity.ts
43
+
44
+ ## Testing
45
+ - services: unit tests with mocked repositories
46
+ - controllers: unit tests with mocked services
47
+ - repositories: integration tests
48
+ - E2E: supertest
@@ -0,0 +1,45 @@
1
+ # Architecture: Modular Monolith (C# + ASP.NET Core)
2
+
3
+ ## Project Structure
4
+ ```
5
+ src/
6
+ ├── Modules/
7
+ │ ├── Order/
8
+ │ │ ├── OrderModule.cs
9
+ │ │ ├── Controllers/OrderController.cs
10
+ │ │ ├── Services/OrderService.cs
11
+ │ │ ├── Repositories/OrderRepository.cs
12
+ │ │ ├── Models/Order.cs
13
+ │ │ ├── DTOs/CreateOrderDto.cs
14
+ │ │ └── Events/OrderCreatedEvent.cs
15
+ │ ├── Payment/
16
+ │ │ └── ...
17
+ │ └── User/
18
+ │ └── ...
19
+ ├── Shared/
20
+ │ ├── Database/ApplicationDbContext.cs
21
+ │ ├── Events/IEventBus.cs
22
+ │ └── Middleware/
23
+ └── Program.cs
24
+ ```
25
+
26
+ ## Module Boundaries
27
+ - Each module is self-contained with controllers, services, repositories
28
+ - Modules communicate via events or explicit interfaces
29
+ - No direct database access across module boundaries
30
+ - Shared for cross-cutting concerns only
31
+
32
+ ## Conventions
33
+ - Each module has a registration extension method (AddOrderModule)
34
+ - Inter-module communication via MediatR notifications
35
+ - Each module owns its EF Core configurations
36
+ - Modules register their own DI services
37
+
38
+ ## File Naming
39
+ - PascalCase: OrderService.cs
40
+ - One module = one folder under Modules/
41
+
42
+ ## Testing
43
+ - Per-module unit tests (xUnit)
44
+ - Integration tests per module
45
+ - Cross-module E2E tests
@@ -0,0 +1,64 @@
1
+ # Architecture: Modular (Flutter)
2
+
3
+ ## Directory Structure
4
+ ```
5
+ lib/
6
+ ├── features/
7
+ │ ├── order/
8
+ │ │ ├── data/
9
+ │ │ │ ├── order_repository.dart
10
+ │ │ │ └── order_api.dart
11
+ │ │ ├── domain/
12
+ │ │ │ └── order.dart
13
+ │ │ ├── presentation/
14
+ │ │ │ ├── order_page.dart
15
+ │ │ │ ├── order_provider.dart
16
+ │ │ │ └── widgets/order_card.dart
17
+ │ │ └── order_module.dart
18
+ │ ├── payment/
19
+ │ │ └── ...
20
+ │ └── user/
21
+ │ └── ...
22
+ ├── shared/
23
+ │ ├── database/app_database.dart
24
+ │ ├── networking/dio_client.dart
25
+ │ ├── widgets/loading_indicator.dart
26
+ │ └── providers/shared_providers.dart
27
+ ├── router/app_router.dart
28
+ └── main.dart
29
+ test/
30
+ ├── features/
31
+ │ ├── order/
32
+ │ └── payment/
33
+ └── shared/
34
+ integration_test/
35
+ └── app_test.dart
36
+ ```
37
+
38
+ ## Module Boundaries
39
+ - Each feature is self-contained with its own data, domain, presentation layers
40
+ - Features communicate via Riverpod providers or explicit public APIs
41
+ - No direct data access across feature boundaries
42
+ - shared/ for truly cross-cutting concerns only
43
+
44
+ ## Recommended Dependencies
45
+ - State Management: Riverpod (per-feature scope)
46
+ - Networking: dio
47
+ - Navigation: go_router (nested routing per feature)
48
+ - Local Storage: drift (per-feature DB or shared)
49
+ - DI: Riverpod (self-contained)
50
+
51
+ ## Conventions
52
+ - Feature module entry point exports only its public API (providers, routes)
53
+ - Inter-feature communication via shared providers or event streams
54
+ - Each feature owns its own data models and repositories
55
+ - go_router ShellRoute per feature for nested navigation
56
+
57
+ ## File Naming
58
+ - snake_case: order_repository.dart, order_page.dart
59
+ - One feature = one directory under features/
60
+
61
+ ## Testing
62
+ - Per-feature unit tests
63
+ - Per-feature widget tests
64
+ - Cross-feature integration tests in integration_test/
@@ -0,0 +1,47 @@
1
+ # Architecture: Modular Monolith (Go + Gin)
2
+
3
+ ## Directory Structure
4
+ ```
5
+ internal/
6
+ ├── modules/
7
+ │ ├── order/
8
+ │ │ ├── handler.go
9
+ │ │ ├── service.go
10
+ │ │ ├── repository.go
11
+ │ │ ├── model.go
12
+ │ │ ├── events.go
13
+ │ │ └── routes.go
14
+ │ ├── payment/
15
+ │ │ └── ...
16
+ │ └── user/
17
+ │ └── ...
18
+ ├── shared/
19
+ │ ├── database/
20
+ │ ├── events/event_bus.go
21
+ │ └── middleware/
22
+ ├── config/
23
+ │ └── env.go
24
+ └── cmd/
25
+ └── main.go
26
+ ```
27
+
28
+ ## Module Boundaries
29
+ - Each module is a Go package with its own handler, service, repository
30
+ - Modules communicate via events or explicit function calls
31
+ - No direct database access across module boundaries
32
+ - Shared package for cross-cutting concerns
33
+
34
+ ## Conventions
35
+ - Each module registers its own routes via a Setup function
36
+ - Inter-module communication via event bus
37
+ - Each module owns its database tables
38
+ - Module interfaces defined per module
39
+
40
+ ## File Naming
41
+ - snake_case: order_service.go
42
+ - One module = one package under modules/
43
+
44
+ ## Testing
45
+ - Per-module unit tests
46
+ - Integration tests per module
47
+ - Cross-module E2E tests
@@ -0,0 +1,68 @@
1
+ # Architecture: Modular (Android / Kotlin)
2
+
3
+ ## Directory Structure
4
+ ```
5
+ :app/ # Application module
6
+ ├── src/main/java/com/example/app/
7
+ │ ├── navigation/AppNavigation.kt
8
+ │ ├── di/AppModule.kt
9
+ │ └── App.kt
10
+ :feature:order/
11
+ ├── src/main/java/com/example/feature/order/
12
+ │ ├── ui/
13
+ │ │ ├── OrderScreen.kt
14
+ │ │ └── OrderViewModel.kt
15
+ │ ├── domain/
16
+ │ │ ├── Order.kt
17
+ │ │ └── OrderUseCase.kt
18
+ │ ├── data/
19
+ │ │ ├── OrderRepository.kt
20
+ │ │ └── OrderApi.kt
21
+ │ └── di/OrderModule.kt
22
+ :feature:payment/
23
+ │ └── ...
24
+ :feature:user/
25
+ │ └── ...
26
+ :core:network/
27
+ ├── src/main/java/com/example/core/network/
28
+ │ ├── ApiClient.kt
29
+ │ └── di/NetworkModule.kt
30
+ :core:database/
31
+ ├── src/main/java/com/example/core/database/
32
+ │ ├── AppDatabase.kt
33
+ │ └── di/DatabaseModule.kt
34
+ :core:ui/
35
+ ├── src/main/java/com/example/core/ui/
36
+ │ ├── theme/Theme.kt
37
+ │ └── components/LoadingIndicator.kt
38
+ ```
39
+
40
+ ## Module Boundaries
41
+ - Each :feature:* module is self-contained with ui, domain, data layers
42
+ - Features depend on :core:* modules but never on other features
43
+ - Inter-feature navigation via Navigation Compose nested graphs
44
+ - :core:* modules provide shared infrastructure
45
+
46
+ ## Recommended Dependencies
47
+ - State Management: Hilt + StateFlow + Compose State
48
+ - Networking: Retrofit + OkHttp (in :core:network)
49
+ - DI: Hilt (per-module @Module)
50
+ - Navigation: Navigation Compose (nested graphs per feature)
51
+ - Local Storage: Room (in :core:database)
52
+ - Async: Kotlin Coroutines + Flow
53
+
54
+ ## Conventions
55
+ - Feature modules expose only their navigation graph entry point
56
+ - Hilt @Module scoped per feature module
57
+ - Navigation Compose nested NavGraph per feature
58
+ - Room database in :core:database, DAOs accessible via DI
59
+
60
+ ## File Naming
61
+ - PascalCase: OrderViewModel.kt, OrderScreen.kt
62
+ - One feature = one Gradle module under :feature:*
63
+ - Core modules under :core:*
64
+
65
+ ## Testing
66
+ - Per-feature unit tests
67
+ - Per-feature Compose UI tests
68
+ - Cross-feature E2E tests in :app
@@ -0,0 +1,45 @@
1
+ # Architecture: Modular Monolith (Python + FastAPI)
2
+
3
+ ## Directory Structure
4
+ ```
5
+ src/
6
+ ├── modules/
7
+ │ ├── order/
8
+ │ │ ├── router.py
9
+ │ │ ├── service.py
10
+ │ │ ├── repository.py
11
+ │ │ ├── models.py
12
+ │ │ ├── schemas.py
13
+ │ │ └── events.py
14
+ │ ├── payment/
15
+ │ │ └── ...
16
+ │ └── user/
17
+ │ └── ...
18
+ ├── shared/
19
+ │ ├── database/connection.py
20
+ │ ├── events/event_bus.py
21
+ │ └── middleware/
22
+ ├── config.py
23
+ └── main.py
24
+ ```
25
+
26
+ ## Module Boundaries
27
+ - Each module is a Python package with its own router, service, repository
28
+ - Modules communicate via events or explicit imports of public APIs
29
+ - No direct database access across module boundaries
30
+ - Shared package for cross-cutting concerns
31
+
32
+ ## Conventions
33
+ - Each module registers its own FastAPI router
34
+ - Inter-module communication via event bus
35
+ - Each module owns its SQLAlchemy models
36
+ - Public API defined in module __init__.py
37
+
38
+ ## File Naming
39
+ - snake_case: order_service.py
40
+ - One module = one package under modules/
41
+
42
+ ## Testing
43
+ - Per-module unit tests (pytest)
44
+ - Integration tests per module
45
+ - Cross-module E2E tests
@@ -0,0 +1,55 @@
1
+ # Architecture: Modular (iOS / SwiftUI)
2
+
3
+ ## Directory Structure
4
+ ```
5
+ Sources/
6
+ ├── Features/
7
+ │ ├── Order/
8
+ │ │ ├── Views/OrderView.swift
9
+ │ │ ├── ViewModels/OrderViewModel.swift
10
+ │ │ ├── Models/Order.swift
11
+ │ │ ├── Services/OrderService.swift
12
+ │ │ └── Navigation/OrderRouter.swift
13
+ │ ├── Payment/
14
+ │ │ └── ...
15
+ │ └── User/
16
+ │ └── ...
17
+ ├── Shared/
18
+ │ ├── Networking/APIClient.swift
19
+ │ ├── Persistence/SharedDatabase.swift
20
+ │ ├── Components/LoadingView.swift
21
+ │ └── Extensions/
22
+ └── App.swift
23
+ Tests/
24
+ ├── OrderTests/
25
+ ├── PaymentTests/
26
+ └── SharedTests/
27
+ ```
28
+
29
+ ## Module Boundaries
30
+ - Each feature is self-contained with its own Views, ViewModels, Models, Services
31
+ - Features communicate via shared protocols or notification/event patterns
32
+ - No direct data access across feature boundaries
33
+ - Shared/ for truly cross-cutting concerns only
34
+
35
+ ## Recommended Dependencies
36
+ - State Management: @Observable (Observation framework)
37
+ - Networking: URLSession (built-in)
38
+ - Navigation: NavigationStack per feature
39
+ - Local Storage: SwiftData (shared)
40
+ - DI: Factory pattern
41
+
42
+ ## Conventions
43
+ - Feature entry point exposes only its root view and public protocols
44
+ - ViewModels use @Observable macro
45
+ - NavigationStack scoped per feature with coordinator pattern
46
+ - SwiftData models in Shared/ when used across features
47
+
48
+ ## File Naming
49
+ - PascalCase: OrderViewModel.swift, OrderView.swift
50
+ - One feature = one directory under Features/
51
+
52
+ ## Testing
53
+ - Per-feature unit tests with XCTest
54
+ - Per-feature UI tests
55
+ - Cross-feature integration tests
@@ -0,0 +1,48 @@
1
+ # Architecture: Modular Monolith (NestJS)
2
+
3
+ ## Directory Structure
4
+ ```
5
+ src/
6
+ ├── modules/
7
+ │ ├── order/
8
+ │ │ ├── order.module.ts
9
+ │ │ ├── order.controller.ts
10
+ │ │ ├── order.service.ts
11
+ │ │ ├── order.repository.ts
12
+ │ │ ├── entities/order.entity.ts
13
+ │ │ ├── dtos/create-order.dto.ts
14
+ │ │ └── events/order-created.event.ts
15
+ │ ├── payment/
16
+ │ │ ├── payment.module.ts
17
+ │ │ └── ...
18
+ │ └── user/
19
+ │ ├── user.module.ts
20
+ │ └── ...
21
+ ├── shared/
22
+ │ ├── shared.module.ts
23
+ │ ├── database/
24
+ │ ├── events/event-bus.ts
25
+ │ └── guards/
26
+ └── app.module.ts
27
+ ```
28
+
29
+ ## Module Boundaries
30
+ - Each module is self-contained with its own controller, service, repository, entities
31
+ - Modules communicate via events or explicit public APIs (exported services)
32
+ - No direct database access across module boundaries
33
+ - Shared module for truly cross-cutting concerns only
34
+
35
+ ## Conventions
36
+ - Module exports define the public API
37
+ - Inter-module communication via EventEmitter or message bus
38
+ - Each module owns its database tables
39
+ - NestJS DI scoped per module
40
+
41
+ ## File Naming
42
+ - kebab-case: order.service.ts, create-order.dto.ts
43
+ - One module = one directory under modules/
44
+
45
+ ## Testing
46
+ - Per-module unit tests
47
+ - Integration tests per module
48
+ - Cross-module E2E tests
@@ -0,0 +1,69 @@
1
+ # Architecture: MVVM (Flutter)
2
+
3
+ ## Pattern Overview
4
+ Flutter app organized into Models, Views, ViewModels, and Services under `lib/`. ViewModels hold UI state and logic; Views are pure widgets that observe ViewModel state.
5
+
6
+ ## Directory Structure
7
+ ```
8
+ lib/
9
+ ├── models/
10
+ │ ├── order.dart
11
+ │ └── user.dart
12
+ ├── views/
13
+ │ ├── order_list_view.dart
14
+ │ ├── order_detail_view.dart
15
+ │ └── widgets/
16
+ │ └── order_card.dart
17
+ ├── viewmodels/
18
+ │ ├── order_list_viewmodel.dart
19
+ │ └── order_detail_viewmodel.dart
20
+ ├── services/
21
+ │ ├── order_service.dart
22
+ │ └── auth_service.dart
23
+ ├── repositories/
24
+ │ ├── order_repository.dart
25
+ │ └── user_repository.dart
26
+ └── main.dart
27
+ test/
28
+ ├── models/
29
+ ├── viewmodels/
30
+ ├── services/
31
+ └── repositories/
32
+ integration_test/
33
+ └── app_test.dart
34
+ ```
35
+
36
+ ## Responsibility Split
37
+ - Models → plain Dart data classes, no framework dependency
38
+ - Views → StatelessWidget / HookWidget, render UI from ViewModel state, dispatch user actions to ViewModel
39
+ - ViewModels → hold UI state, expose state streams, call Services/Repositories
40
+ - Services → API calls, external integrations (HTTP, WebSocket)
41
+ - Repositories → data access abstraction over local + remote sources
42
+
43
+ ## Recommended Dependencies
44
+ - State Management: Riverpod (StateNotifier / AsyncNotifier)
45
+ - Networking: dio
46
+ - Navigation: go_router
47
+ - Local Storage: drift (SQL), shared_preferences (KV)
48
+ - DI: Riverpod (self-contained)
49
+
50
+ ## Conventions
51
+ - One ViewModel per screen or major UI section
52
+ - ViewModel is a Riverpod Notifier/AsyncNotifier, never a raw ChangeNotifier
53
+ - Views read ViewModel via `ref.watch()`; never call Services directly
54
+ - Models are immutable (use `freezed` or manual `copyWith`)
55
+
56
+ ## File Naming
57
+ - snake_case: order_list_viewmodel.dart
58
+ - View: *_view.dart
59
+ - ViewModel: *_viewmodel.dart
60
+ - Service: *_service.dart
61
+ - Repository: *_repository.dart
62
+ - Model: descriptive name under models/
63
+
64
+ ## Testing
65
+ - Models: pure unit tests
66
+ - ViewModels: unit tests with mocked services/repositories
67
+ - Services: integration tests or mocked HTTP (dio adapter)
68
+ - Views: widget tests with ProviderScope overrides
69
+ - integration_test/: full app flow tests