@jeffrey2423/coding-standards 1.0.0 → 2.0.1

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 (28) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +101 -174
  3. package/bin/cli.js +373 -20
  4. package/package.json +22 -3
  5. package/standards/backend/architecture/event-driven.md +112 -0
  6. package/standards/backend/architecture/microservice-anatomy.md +106 -0
  7. package/standards/backend/architecture/multitenancy.md +112 -0
  8. package/standards/backend/architecture/public-api-facade.md +112 -0
  9. package/standards/backend/architecture/shared-vs-owned.md +62 -0
  10. package/standards/{backend-standards.md → backend/backend-standards.md} +8 -1
  11. package/standards/{database-conventions.md → backend/database-conventions.md} +7 -0
  12. package/standards/backend/technology-stack.md +73 -0
  13. package/standards/core/ai-collaboration.md +64 -0
  14. package/standards/core/clean-architecture-ddd.md +69 -0
  15. package/standards/core/coding-conventions.md +66 -0
  16. package/standards/core/testing-strategy.md +46 -0
  17. package/standards/{mobile-flutter-standards.md → mobile/flutter/flutter-standards.md} +9 -1
  18. package/standards/{mobile-react-native-standards.md → mobile/react-native/react-native-standards.md} +9 -1
  19. package/standards/{technical-preferences-ux.md → web/_base/design-system-ux.md} +8 -1
  20. package/standards/web/_base/frontend-architecture.md +75 -0
  21. package/standards/{frontend-standards.md → web/_base/frontend-standards.md} +7 -0
  22. package/standards/web/_base/technology-stack.md +40 -0
  23. package/standards/web/microfrontends/module-federation-standard.md +216 -0
  24. package/standards/web/single-spa/single-spa-standard.md +196 -0
  25. package/standards/web/spa/spa-standard.md +53 -0
  26. package/standards/architecture-patterns.md +0 -444
  27. package/standards/technology-stack.md +0 -294
  28. package/standards/vite-config-standard.md +0 -531
@@ -1,294 +0,0 @@
1
- # Technology Stack
2
-
3
- ## Frontend Stack
4
-
5
- ### Bundler & Dev Server
6
- - **Vite 7+** with TypeScript
7
- - Default bundler for all frontend projects
8
- - Native ES modules for fast development
9
- - Optimized for Module Federation (microfrontends)
10
- - HMR (Hot Module Replacement) instantáneo
11
-
12
- ### Router
13
- - **TanStack Router 1+** (file-based routing)
14
- - Type-safe routing with auto-generated route tree
15
- - File-based routing with special prefixes (`_`, `.`, `-`, `$`)
16
- - Automatic code-splitting per route
17
- - Integrated with TanStack Query
18
-
19
- ### State Management
20
- - **Zustand 5+** (client state)
21
- - Feature-based stores following DDD patterns
22
- - Prepared for microfrontends (singleton stores)
23
- - **TanStack Query 5+** (server state)
24
- - Cache and synchronization
25
- - Optimistic updates
26
-
27
- ### UI Framework & Styling
28
- - **shadcn/ui** (component library)
29
- - **Radix UI** (primitives)
30
- - **TailwindCSS v4** (styling)
31
-
32
- ### Architecture
33
- - **Clean Architecture** + **Domain-Driven Design (DDD)**
34
- - **Module/Domain/Feature** structure for enterprise scale
35
-
36
- ### Testing
37
- - **Vitest** (test runner - native Vite integration)
38
- - **React Testing Library** (component testing)
39
- - **MSW** (Mock Service Worker - API mocking)
40
-
41
- ### Forms & Validation
42
- - **React Hook Form** (form management)
43
- - **Zod** (schema validation)
44
-
45
- ### HTTP Client
46
- - **Axios** with interceptors
47
-
48
- ### Progressive Web App (PWA)
49
- - **vite-plugin-pwa** (PWA plugin for Vite)
50
- - **Workbox** (service worker library)
51
-
52
- ## Microfrontends Configuration
53
-
54
- ### Module Federation Shared Dependencies
55
-
56
- Para evitar dependencias duplicadas entre microfrontends:
57
-
58
- ```typescript
59
- // vite.config.ts - Host y cada Remote
60
- import { federation } from '@module-federation/vite';
61
-
62
- federation({
63
- shared: {
64
- react: { singleton: true, requiredVersion: '^18.3.0' },
65
- 'react-dom': { singleton: true, requiredVersion: '^18.3.0' },
66
- '@tanstack/react-router': { singleton: true, requiredVersion: '^1.95.0' },
67
- '@tanstack/react-query': { singleton: true, requiredVersion: '^5.62.0' },
68
- zustand: { singleton: true, requiredVersion: '^5.0.0' },
69
- },
70
- })
71
- ```
72
-
73
- | Configuración | Propósito |
74
- |---------------|-----------|
75
- | `singleton: true` | Garantiza una sola instancia en runtime |
76
- | `requiredVersion: '^x.x.0'` | Rango semver para flexibilidad sin romper compatibilidad |
77
-
78
- ## Core Principles
79
-
80
- ### Clean Architecture First
81
- Strict separation of:
82
- - Domain layer
83
- - Application layer
84
- - Infrastructure layer
85
- - Presentation layer
86
-
87
- ### Domain-Driven Design
88
- Business logic drives architecture decisions
89
-
90
- ### Component Composition
91
- Build complex UIs from simple, reusable components
92
-
93
- ### Type Safety
94
- Leverage TypeScript for compile-time safety and developer experience
95
-
96
- ### Performance by Design
97
- - Lazy loading (automatic with TanStack Router)
98
- - Memoization
99
- - Bundle optimization
100
- - Singleton shared dependencies for microfrontends
101
-
102
- ### Accessibility as Standard
103
- WCAG 2.1 AA compliance in all components
104
-
105
- ### Test-Driven Development
106
- Unit tests for all use cases and components
107
-
108
- ### Progressive Web App
109
- Offline-first approach with service workers
110
-
111
- ### Minimal and Functional
112
- Only build what's explicitly requested, nothing more
113
-
114
- ### User-Centered Design
115
- Start with user needs and work backward to implementation
116
-
117
- ### MCP Shadcn Available
118
- Use MCP to install Shadcn components instead of creating manually
119
-
120
- ## Backend Stack
121
-
122
- ### Core Framework & Language
123
- - **.NET 10**
124
- - **C# Minimal API** - Lightweight and modern API approach
125
- - **Entity Framework Core 10** - ORM for data access (matches .NET 10 version)
126
- - **FluentValidation** - Validation for models and DTOs
127
- - **linq2db** - Ultra-lightweight, high-performance ORM for complex optimized queries
128
- - **DynamicLinq** - Dynamic query construction from strings (runtime filters)
129
- - **LinqKit** - Composable and reusable LINQ expressions with type safety
130
-
131
- ### ORM Strategy & When to Use Each Tool
132
-
133
- #### Entity Framework Core 10 (Primary ORM)
134
- **Use for:**
135
- - Standard CRUD operations
136
- - DDD entities with tracking (Aggregate Roots, Domain Events)
137
- - Simple to moderate queries
138
- - Queries that participate in aggregate lifecycle
139
- - Navigation properties and relationships
140
- - Change tracking scenarios
141
-
142
- #### linq2db
143
- **Ultra-lightweight ORM for maximum performance and SQL control**
144
-
145
- ✔ **Use when:**
146
- - Need highly optimized complex queries
147
- - Advanced subqueries and complex projections
148
- - Multiple joins with dynamic conditions
149
- - Queries that EF Core cannot translate efficiently
150
- - Endpoints require extreme performance:
151
- - Dashboards
152
- - Analytics
153
- - Fast transactional reports
154
- - High data volumes
155
- - Microservice requires pure queries without tracking (linq2db operates naturally without tracking → faster)
156
- - EF Core generates inefficient SQL and you need alternatives without changing stack
157
- - Want SQL nearly as efficient as hand-written, but without explicit SQL
158
-
159
- 🚫 **Do NOT use when:**
160
- - Need complete DDD entities (aggregate roots, tracking, events)
161
- - Query participates in aggregate lifecycle
162
- - Only need simple filters or trivial pagination
163
-
164
- #### DynamicLinq
165
- **Dynamic query generation from strings for runtime filters**
166
-
167
- ✔ **Use when:**
168
- - Microservice offers dynamic filter system:
169
- - Example: `?filter=Age > 30 AND Country == "CO"`
170
- - Example: `?sort=Name desc`
171
- - Building simplified OData-style API without using OData
172
- - Generic queries over tables
173
- - Variable column searches
174
- - Data explorers or configurable grids
175
- - Want to avoid manually generating Expression Trees (DynamicLinq is much simpler)
176
-
177
- 🚫 **Do NOT use when:**
178
- - Filters are fully controlled in code
179
- - Don't want to interpret expressions at runtime
180
- - Require strict security (DynamicLinq requires sanitization)
181
- - Need maximum performance (use LinqKit or linq2db instead)
182
-
183
- #### LinqKit
184
- **Composable dynamic predicates with type safety**
185
-
186
- ✔ **Use when:**
187
- - Have complex business rules in queries
188
- - Composable predicates example:
189
- ```csharp
190
- IsActive
191
- RequiresApproval
192
- BelongsToOrganization(user.OrgId)
193
- ```
194
- - Want dynamic filters with type safety (no strings → expressions)
195
- - Combine multiple expressions in a single `Where()`:
196
- - Especially useful in DDD repositories with:
197
- - Multiple criteria
198
- - Conditional searches
199
- - Reusable queries
200
- - Need EF Core to translate the resulting expression (LinqKit is 100% compatible with EF Core)
201
- - Want to enhance EF Core when it fails to compose complex expressions
202
-
203
- 🚫 **Do NOT use when:**
204
- - Filters are extremely simple
205
- - Query is highly dynamic and text-based (use DynamicLinq)
206
- - Need maximum performance (use linq2db)
207
-
208
- ### Architecture & Design Patterns
209
- - **TDD (Test-Driven Development)** - Test-driven development approach
210
- - **DDD (Domain-Driven Design)** - Domain-oriented design
211
- - **Clean Architecture** - Clean architecture with layer separation
212
- - **Microservices** - Distributed services architecture
213
- - **REST API** - Primary communication protocol
214
-
215
- ### Database & Data Management
216
- - **PostgreSQL 18+** - Primary relational database (mandatory)
217
- - **Database per Microservice** - Each microservice has its own isolated database
218
- - **Primary Keys UUID** - Universal unique identifiers for all entities
219
- - **EF Core 10 Migrations** - Entity Framework migrations package for schema version control
220
-
221
- ### Testing
222
- - **xUnit** - Unit and integration testing framework
223
- - **EF Core 10 InMemory** - In-memory database for fast tests
224
- - **PostgreSQL 18+ Test Containers** - PostgreSQL containers for real integration tests
225
-
226
- ### Additional Libraries
227
- - **QuestPDF** - PDF document generation
228
- - **DynamicLinq** - Dynamic LINQ query construction
229
- - **LinqKit** - LINQ expression composition
230
-
231
- ### API Documentation
232
- - **Scalar** - Modern API documentation (DO NOT use Swagger)
233
-
234
- ### Infrastructure & DevOps
235
- - **Docker Ready** - Containerized applications ready for deployment (production only)
236
- - **Local Development** - Without Docker, direct execution with dotnet CLI
237
- - **Multiculture** - Support for internationalization (i18n) and localization (l10n)
238
-
239
- ## Backend Core Principles
240
-
241
- ### Clean Architecture First
242
- Strict separation of:
243
- - Domain layer (Entities, Value Objects, Aggregates, Domain Services)
244
- - Application layer (Commands, Queries, DTOs, Interfaces)
245
- - Infrastructure layer (Repositories, EF Core, External Services)
246
- - Presentation layer (Minimal API Endpoints)
247
-
248
- ### Domain-Driven Design
249
- Business logic drives architecture decisions
250
-
251
- ### Test-Driven Development
252
- - Write tests before or alongside implementation
253
- - xUnit for all backend tests
254
- - High test coverage requirement
255
-
256
- ### Microservices Isolation
257
- - Each service is independent
258
- - Own PostgreSQL 18+ database per service
259
- - No shared databases between services
260
-
261
- ### UUID Primary Keys
262
- All entities must use UUIDs (Guid in C#) as primary keys for distributed system compatibility
263
-
264
- ### Type Safety
265
- Leverage C# strong typing for compile-time safety
266
-
267
- ### Security by Design
268
- Implement security at every layer
269
-
270
- ### Docker for Production Only
271
- - Development: dotnet run locally
272
- - Production: Docker containers
273
-
274
- ## Version Summary
275
-
276
- ### Frontend
277
- | Technology | Version | Notes |
278
- |------------|---------|-------|
279
- | Vite | 6+ | Bundler, optimized for Module Federation |
280
- | React | 18+ | Functional components, hooks |
281
- | TypeScript | 5+ | Strict mode enabled |
282
- | TanStack Router | 1+ | File-based, type-safe routing |
283
- | TanStack Query | 5+ | Server state management |
284
- | Zustand | 5+ | Client state management |
285
- | TailwindCSS | 4+ | Utility-first CSS |
286
- | Vitest | Latest | Native Vite test runner |
287
-
288
- ### Backend
289
- | Technology | Version | Notes |
290
- |------------|---------|-------|
291
- | .NET | 10 | LTS |
292
- | Entity Framework Core | 10 | Matches .NET version |
293
- | PostgreSQL | 18+ | Mandatory, one per microservice |
294
- | xUnit | Latest | Testing framework |