@ironbackend/core 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.
- package/LICENSE +21 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +123 -0
- package/dist/index.js.map +1 -0
- package/dist/rules/index.d.ts +36 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +505 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/security/index.d.ts +15 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +243 -0
- package/dist/security/index.js.map +1 -0
- package/dist/stacks/index.d.ts +38 -0
- package/dist/stacks/index.d.ts.map +1 -0
- package/dist/stacks/index.js +193 -0
- package/dist/stacks/index.js.map +1 -0
- package/dist/styles/clean-monolith.d.ts +7 -0
- package/dist/styles/clean-monolith.d.ts.map +1 -0
- package/dist/styles/clean-monolith.js +124 -0
- package/dist/styles/clean-monolith.js.map +1 -0
- package/dist/styles/event-driven.d.ts +12 -0
- package/dist/styles/event-driven.d.ts.map +1 -0
- package/dist/styles/event-driven.js +247 -0
- package/dist/styles/event-driven.js.map +1 -0
- package/dist/styles/hexagonal.d.ts +7 -0
- package/dist/styles/hexagonal.d.ts.map +1 -0
- package/dist/styles/hexagonal.js +146 -0
- package/dist/styles/hexagonal.js.map +1 -0
- package/dist/styles/index.d.ts +33 -0
- package/dist/styles/index.d.ts.map +1 -0
- package/dist/styles/index.js +75 -0
- package/dist/styles/index.js.map +1 -0
- package/dist/styles/microservices.d.ts +12 -0
- package/dist/styles/microservices.d.ts.map +1 -0
- package/dist/styles/microservices.js +218 -0
- package/dist/styles/microservices.js.map +1 -0
- package/dist/styles/modular-monolith.d.ts +7 -0
- package/dist/styles/modular-monolith.d.ts.map +1 -0
- package/dist/styles/modular-monolith.js +131 -0
- package/dist/styles/modular-monolith.js.map +1 -0
- package/dist/styles/specialized.d.ts +17 -0
- package/dist/styles/specialized.d.ts.map +1 -0
- package/dist/styles/specialized.js +379 -0
- package/dist/styles/specialized.js.map +1 -0
- package/dist/types.d.ts +143 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.microservicesAsync = exports.microservicesSync = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Microservices (Synchronous) Architecture
|
|
6
|
+
* Distributed services communicating via HTTP/gRPC
|
|
7
|
+
*/
|
|
8
|
+
exports.microservicesSync = {
|
|
9
|
+
id: 'microservices-sync',
|
|
10
|
+
name: 'Microservices (Synchronous)',
|
|
11
|
+
description: 'Distributed system of independently deployable services communicating via synchronous protocols (HTTP/gRPC). Each service owns its data exclusively.',
|
|
12
|
+
whenToUse: [
|
|
13
|
+
'Multiple teams need independent deployment cycles',
|
|
14
|
+
'Services have different scaling requirements',
|
|
15
|
+
'Technology heterogeneity required',
|
|
16
|
+
'Clear domain boundaries established',
|
|
17
|
+
'Organization structure supports service ownership',
|
|
18
|
+
'Strong DevOps/platform capabilities'
|
|
19
|
+
],
|
|
20
|
+
whenNotToUse: [
|
|
21
|
+
'Small team (< 20 developers)',
|
|
22
|
+
'Unclear domain boundaries',
|
|
23
|
+
'Low latency critical (network overhead)',
|
|
24
|
+
'Operational maturity lacking',
|
|
25
|
+
'Simple, unified domain',
|
|
26
|
+
'Startup phase with rapid pivots'
|
|
27
|
+
],
|
|
28
|
+
corePrinciples: [
|
|
29
|
+
'Each service owns its data exclusively',
|
|
30
|
+
'Services communicate via well-defined APIs',
|
|
31
|
+
'Backward compatibility required for API changes',
|
|
32
|
+
'Failure of one service must not cascade',
|
|
33
|
+
'Services are independently deployable',
|
|
34
|
+
'Decentralized data management'
|
|
35
|
+
],
|
|
36
|
+
folderStructure: {
|
|
37
|
+
name: 'service-name',
|
|
38
|
+
type: 'folder',
|
|
39
|
+
description: 'Per-service structure',
|
|
40
|
+
children: [
|
|
41
|
+
{
|
|
42
|
+
name: 'src',
|
|
43
|
+
type: 'folder',
|
|
44
|
+
children: [
|
|
45
|
+
{
|
|
46
|
+
name: 'api',
|
|
47
|
+
type: 'folder',
|
|
48
|
+
children: [
|
|
49
|
+
{ name: 'controllers', type: 'folder', description: 'HTTP handlers' },
|
|
50
|
+
{ name: 'dto', type: 'folder', description: 'Request/response types' },
|
|
51
|
+
{ name: 'clients', type: 'folder', description: 'Clients for other services' }
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
{ name: 'domain', type: 'folder', description: 'Service domain logic' },
|
|
55
|
+
{ name: 'application', type: 'folder', description: 'Use cases' },
|
|
56
|
+
{ name: 'infrastructure', type: 'folder', description: 'Database, external calls' }
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'contracts',
|
|
61
|
+
type: 'folder',
|
|
62
|
+
description: 'API schemas (OpenAPI/Protobuf)'
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'tests',
|
|
66
|
+
type: 'folder',
|
|
67
|
+
children: [
|
|
68
|
+
{ name: 'unit', type: 'folder' },
|
|
69
|
+
{ name: 'integration', type: 'folder' },
|
|
70
|
+
{ name: 'contract', type: 'folder', description: 'Consumer-driven contracts' }
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'deploy',
|
|
75
|
+
type: 'folder',
|
|
76
|
+
children: [
|
|
77
|
+
{ name: 'Dockerfile', type: 'file' },
|
|
78
|
+
{ name: 'k8s', type: 'folder', description: 'Kubernetes manifests' }
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
commonPitfalls: [
|
|
84
|
+
'Distributed monolith - tight coupling defeats the purpose',
|
|
85
|
+
'Missing circuit breakers - failures cascade',
|
|
86
|
+
'Synchronous chains too deep - latency compounds',
|
|
87
|
+
'Shared database between services - kills independence',
|
|
88
|
+
'No API versioning strategy - breaking changes break consumers',
|
|
89
|
+
'Missing observability - debugging is impossible',
|
|
90
|
+
'Ignoring network failures - networks are unreliable'
|
|
91
|
+
],
|
|
92
|
+
aiInstructions: `When generating code for Sync Microservices:
|
|
93
|
+
|
|
94
|
+
RESILIENCE:
|
|
95
|
+
- Implement circuit breaker for ALL external service calls
|
|
96
|
+
- API clients have explicit timeout (e.g., 5s) and retry policies
|
|
97
|
+
- Use bulkhead pattern to isolate failures
|
|
98
|
+
- Implement fallback strategies
|
|
99
|
+
|
|
100
|
+
OBSERVABILITY:
|
|
101
|
+
- Include correlation ID in all requests and logs
|
|
102
|
+
- Add distributed tracing (OpenTelemetry)
|
|
103
|
+
- Health endpoints mandatory: /health, /ready
|
|
104
|
+
|
|
105
|
+
API DESIGN:
|
|
106
|
+
- Version APIs from day one: /v1/resource
|
|
107
|
+
- Use OpenAPI/Protobuf for contracts
|
|
108
|
+
- Implement consumer-driven contract tests
|
|
109
|
+
- Never break backward compatibility
|
|
110
|
+
|
|
111
|
+
DATA:
|
|
112
|
+
- Each service has its own database/schema
|
|
113
|
+
- No cross-service database queries
|
|
114
|
+
- Use API calls to get data from other services
|
|
115
|
+
|
|
116
|
+
DEPLOYMENT:
|
|
117
|
+
- Each service independently deployable
|
|
118
|
+
- Container-ready with health checks
|
|
119
|
+
- Graceful shutdown handling`
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Microservices (Asynchronous) Architecture
|
|
123
|
+
* Services communicating via message queues and events
|
|
124
|
+
*/
|
|
125
|
+
exports.microservicesAsync = {
|
|
126
|
+
id: 'microservices-async',
|
|
127
|
+
name: 'Microservices (Asynchronous)',
|
|
128
|
+
description: 'Distributed services communicating primarily through message queues and events. Decoupled in time and space for high availability and throughput.',
|
|
129
|
+
whenToUse: [
|
|
130
|
+
'High throughput required',
|
|
131
|
+
'Eventual consistency acceptable',
|
|
132
|
+
'Long-running operations common',
|
|
133
|
+
'Spiky workloads with buffering needs',
|
|
134
|
+
'Need to decouple producer/consumer lifecycles',
|
|
135
|
+
'Fire-and-forget patterns common'
|
|
136
|
+
],
|
|
137
|
+
whenNotToUse: [
|
|
138
|
+
'Immediate consistency required',
|
|
139
|
+
'Simple request-response patterns',
|
|
140
|
+
'Message infrastructure unavailable or too complex',
|
|
141
|
+
'Debugging async flows unacceptable for team',
|
|
142
|
+
'Low-latency synchronous responses needed'
|
|
143
|
+
],
|
|
144
|
+
corePrinciples: [
|
|
145
|
+
'Messages are the contract between services',
|
|
146
|
+
'Publishers and consumers independently deployable',
|
|
147
|
+
'Messages must have schemas and versioning',
|
|
148
|
+
'Dead letter handling mandatory',
|
|
149
|
+
'Exactly-once semantics via idempotency',
|
|
150
|
+
'Message ordering guaranteed within partition'
|
|
151
|
+
],
|
|
152
|
+
folderStructure: {
|
|
153
|
+
name: 'service-name',
|
|
154
|
+
type: 'folder',
|
|
155
|
+
children: [
|
|
156
|
+
{
|
|
157
|
+
name: 'src',
|
|
158
|
+
type: 'folder',
|
|
159
|
+
children: [
|
|
160
|
+
{ name: 'consumers', type: 'folder', description: 'Message handlers' },
|
|
161
|
+
{ name: 'producers', type: 'folder', description: 'Message publishers' },
|
|
162
|
+
{ name: 'domain', type: 'folder' },
|
|
163
|
+
{ name: 'application', type: 'folder' },
|
|
164
|
+
{
|
|
165
|
+
name: 'infrastructure',
|
|
166
|
+
type: 'folder',
|
|
167
|
+
children: [
|
|
168
|
+
{ name: 'messaging', type: 'folder', description: 'Queue configuration' }
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: 'contracts',
|
|
175
|
+
type: 'folder',
|
|
176
|
+
children: [
|
|
177
|
+
{ name: 'events', type: 'folder', description: 'Published event schemas' },
|
|
178
|
+
{ name: 'commands', type: 'folder', description: 'Accepted command schemas' }
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
{ name: 'tests', type: 'folder' },
|
|
182
|
+
{ name: 'deploy', type: 'folder' }
|
|
183
|
+
]
|
|
184
|
+
},
|
|
185
|
+
commonPitfalls: [
|
|
186
|
+
'Non-idempotent consumers - duplicate messages will cause issues',
|
|
187
|
+
'Missing dead letter queues - failed messages disappear',
|
|
188
|
+
'Message ordering assumptions across partitions',
|
|
189
|
+
'No schema registry - message evolution breaks consumers',
|
|
190
|
+
'Unbounded queue growth - no backpressure',
|
|
191
|
+
'Synchronous calls hidden in async flows',
|
|
192
|
+
'Missing message metadata (correlation, timestamp)'
|
|
193
|
+
],
|
|
194
|
+
aiInstructions: `When generating code for Async Microservices:
|
|
195
|
+
|
|
196
|
+
MESSAGES:
|
|
197
|
+
- Every message has: id, type, timestamp, version, correlationId, payload
|
|
198
|
+
- Message ID used for idempotency
|
|
199
|
+
- Schema registry for message contracts (Avro, Protobuf, JSON Schema)
|
|
200
|
+
|
|
201
|
+
CONSUMERS:
|
|
202
|
+
- MUST be idempotent - handle duplicate messages
|
|
203
|
+
- Acknowledge after successful processing
|
|
204
|
+
- Implement dead letter queue handling
|
|
205
|
+
- Log: message received, processing start, processing complete
|
|
206
|
+
|
|
207
|
+
PRODUCERS:
|
|
208
|
+
- Use transactional outbox pattern for reliability
|
|
209
|
+
- Include all required metadata
|
|
210
|
+
- Validate message schema before publishing
|
|
211
|
+
|
|
212
|
+
RELIABILITY:
|
|
213
|
+
- Configure appropriate retry policies with backoff
|
|
214
|
+
- Set up dead letter queues for each consumer
|
|
215
|
+
- Monitor queue depths and processing latency
|
|
216
|
+
- Implement circuit breaker for downstream calls`
|
|
217
|
+
};
|
|
218
|
+
//# sourceMappingURL=microservices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"microservices.js","sourceRoot":"","sources":["../../src/styles/microservices.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACU,QAAA,iBAAiB,GAAsB;IAChD,EAAE,EAAE,oBAAoB;IACxB,IAAI,EAAE,6BAA6B;I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AC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ArchitectureStyle } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Modular Monolith Architecture Style
|
|
4
|
+
* Monolith composed of self-contained modules with explicit boundaries
|
|
5
|
+
*/
|
|
6
|
+
export declare const modularMonolith: ArchitectureStyle;
|
|
7
|
+
//# sourceMappingURL=modular-monolith.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modular-monolith.d.ts","sourceRoot":"","sources":["../../src/styles/modular-monolith.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,iBAgI7B,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.modularMonolith = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Modular Monolith Architecture Style
|
|
6
|
+
* Monolith composed of self-contained modules with explicit boundaries
|
|
7
|
+
*/
|
|
8
|
+
exports.modularMonolith = {
|
|
9
|
+
id: 'modular-monolith',
|
|
10
|
+
name: 'Modular Monolith',
|
|
11
|
+
description: 'Monolith composed of self-contained modules with explicit boundaries. Modules communicate through defined interfaces. Prepares for potential microservices migration.',
|
|
12
|
+
whenToUse: [
|
|
13
|
+
'Preparing for potential microservices migration',
|
|
14
|
+
'Multiple feature teams on one codebase',
|
|
15
|
+
'Need module-level isolation without distributed complexity',
|
|
16
|
+
'Complex domain with clear bounded contexts',
|
|
17
|
+
'Want benefits of modularity with deployment simplicity',
|
|
18
|
+
'Team growing beyond 15 developers'
|
|
19
|
+
],
|
|
20
|
+
whenNotToUse: [
|
|
21
|
+
'Simple CRUD applications - overhead not justified',
|
|
22
|
+
'Single small team (< 5 developers)',
|
|
23
|
+
'No clear domain boundaries exist',
|
|
24
|
+
'Need independent scaling of components now',
|
|
25
|
+
'Different technology stacks required per component'
|
|
26
|
+
],
|
|
27
|
+
corePrinciples: [
|
|
28
|
+
'Each module owns its data and schema exclusively',
|
|
29
|
+
'Inter-module communication via public interfaces only',
|
|
30
|
+
'No shared mutable state between modules',
|
|
31
|
+
'Module dependencies must be acyclic',
|
|
32
|
+
'Modules can be extracted to services without rewrites',
|
|
33
|
+
'Shared kernel contains only immutable, stable types'
|
|
34
|
+
],
|
|
35
|
+
folderStructure: {
|
|
36
|
+
name: 'src',
|
|
37
|
+
type: 'folder',
|
|
38
|
+
children: [
|
|
39
|
+
{
|
|
40
|
+
name: 'modules',
|
|
41
|
+
type: 'folder',
|
|
42
|
+
description: 'Self-contained feature modules',
|
|
43
|
+
children: [
|
|
44
|
+
{
|
|
45
|
+
name: 'users',
|
|
46
|
+
type: 'folder',
|
|
47
|
+
description: 'User management module',
|
|
48
|
+
children: [
|
|
49
|
+
{ name: 'api', type: 'folder', description: 'Module HTTP endpoints' },
|
|
50
|
+
{ name: 'application', type: 'folder', description: 'Module use cases' },
|
|
51
|
+
{ name: 'domain', type: 'folder', description: 'Module domain logic' },
|
|
52
|
+
{ name: 'infrastructure', type: 'folder', description: 'Module repositories' },
|
|
53
|
+
{ name: 'index.ts', type: 'file', description: 'Public module API' }
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'orders',
|
|
58
|
+
type: 'folder',
|
|
59
|
+
description: 'Order management module',
|
|
60
|
+
children: [
|
|
61
|
+
{ name: 'api', type: 'folder' },
|
|
62
|
+
{ name: 'application', type: 'folder' },
|
|
63
|
+
{ name: 'domain', type: 'folder' },
|
|
64
|
+
{ name: 'infrastructure', type: 'folder' },
|
|
65
|
+
{ name: 'index.ts', type: 'file', description: 'Public module API' }
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'payments',
|
|
70
|
+
type: 'folder',
|
|
71
|
+
description: 'Payment processing module'
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'shared-kernel',
|
|
77
|
+
type: 'folder',
|
|
78
|
+
description: 'Shared domain concepts across modules',
|
|
79
|
+
children: [
|
|
80
|
+
{ name: 'types', type: 'folder', description: 'Shared immutable types' },
|
|
81
|
+
{ name: 'events', type: 'folder', description: 'Cross-module event definitions' }
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'bootstrap',
|
|
86
|
+
type: 'folder',
|
|
87
|
+
description: 'Application initialization',
|
|
88
|
+
children: [
|
|
89
|
+
{ name: 'modules.ts', type: 'file', description: 'Module registration' },
|
|
90
|
+
{ name: 'server.ts', type: 'file', description: 'HTTP server setup' }
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
commonPitfalls: [
|
|
96
|
+
'Cross-module database joins - each module should query its own data',
|
|
97
|
+
'Importing internal module files directly - only import from module/index',
|
|
98
|
+
'Shared models that couple modules - duplicate if necessary',
|
|
99
|
+
'Synchronous inter-module calls creating tight coupling - use events',
|
|
100
|
+
'Module circular dependencies - refactor to shared kernel if needed',
|
|
101
|
+
'Growing shared kernel with mutable types - keep it minimal and stable'
|
|
102
|
+
],
|
|
103
|
+
aiInstructions: `When generating code for Modular Monolith architecture:
|
|
104
|
+
|
|
105
|
+
MODULE BOUNDARIES:
|
|
106
|
+
- Never import from module internals, only from module/index.ts
|
|
107
|
+
- Each module has its own database schema/tables
|
|
108
|
+
- Modules communicate via events or public interfaces
|
|
109
|
+
- No direct database queries across module boundaries
|
|
110
|
+
|
|
111
|
+
PUBLIC API:
|
|
112
|
+
- Module index.ts exports only public types and services
|
|
113
|
+
- Keep public API minimal and stable
|
|
114
|
+
- Version module interfaces if backward compatibility needed
|
|
115
|
+
|
|
116
|
+
DATA OWNERSHIP:
|
|
117
|
+
- Each module owns its entities completely
|
|
118
|
+
- If data is needed cross-module, define events or APIs
|
|
119
|
+
- Duplicate read models rather than share
|
|
120
|
+
|
|
121
|
+
EVENTS:
|
|
122
|
+
- Use domain events for cross-module notifications
|
|
123
|
+
- Events are fire-and-forget, async
|
|
124
|
+
- Event handlers in consuming module
|
|
125
|
+
|
|
126
|
+
SHARED KERNEL:
|
|
127
|
+
- Contains only truly shared, immutable concepts
|
|
128
|
+
- Types like Money, Email, UserId can live here
|
|
129
|
+
- Never put mutable entities in shared kernel`
|
|
130
|
+
};
|
|
131
|
+
//# sourceMappingURL=modular-monolith.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modular-monolith.js","sourceRoot":"","sources":["../../src/styles/modular-monolith.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACU,QAAA,eAAe,GAAsB;IAC9C,EAAE,EAAE,kBAAkB;IACtB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,uKAAuK;IAEpL,SAAS,EAAE;QACP,iDAAiD;QACjD,wCAAwC;QACxC,4DAA4D;QAC5D,4CAA4C;QAC5C,wDAAwD;QACxD,mCAAmC;KACtC;IAED,YAAY,EAAE;QACV,mDAAmD;QACnD,oCAAoC;QACpC,kCAAkC;QAClC,4CAA4C;QAC5C,oDAAoD;KACvD;IAED,cAAc,EAAE;QACZ,kDAAkD;QAClD,uDAAuD;QACvD,yCAAyC;QACzC,qCAAqC;QACrC,uDAAuD;QACvD,qDAAqD;KACxD;IAED,eAAe,EAAE;QACb,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE;YACN;gBACI,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,gCAAgC;gBAC7C,QAAQ,EAAE;oBACN;wBACI,IAAI,EAAE,OAAO;wBACb,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,wBAAwB;wBACrC,QAAQ,EAAE;4BACN,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,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E;iBACpF;aACJ;YACD;gBACI,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,4BAA4B;gBACzC,QAAQ,EAAE;oBACN,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,qBAAqB,EAAE;oBACxE,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,mBAAmB,EAAE;iBACxE;aACJ;SACJ;KACJ;IAED,cAAc,EAAE;QACZ,qEAAqE;QACrE,0EAA0E;QAC1E,4DAA4D;QAC5D,qEAAqE;QACrE,oEAAoE;QACpE,uEAAuE;KAC1E;IAED,cAAc,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;8CA0B0B;CAC7C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ArchitectureStyle } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Serverless Backend Architecture
|
|
4
|
+
* Stateless functions triggered by events, managed infrastructure
|
|
5
|
+
*/
|
|
6
|
+
export declare const serverless: ArchitectureStyle;
|
|
7
|
+
/**
|
|
8
|
+
* Read-Heavy API Architecture
|
|
9
|
+
* Optimized for high read-to-write ratio
|
|
10
|
+
*/
|
|
11
|
+
export declare const readHeavy: ArchitectureStyle;
|
|
12
|
+
/**
|
|
13
|
+
* Automation / Bot Backend Architecture
|
|
14
|
+
* Scheduled jobs, workflows, integrations
|
|
15
|
+
*/
|
|
16
|
+
export declare const automation: ArchitectureStyle;
|
|
17
|
+
//# sourceMappingURL=specialized.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specialized.d.ts","sourceRoot":"","sources":["../../src/styles/specialized.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,iBAwIxB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,iBA+GvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,iBAmIxB,CAAC"}
|