@venizia/ignis-docs 0.0.3 → 0.0.4-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/README.md +1 -1
- package/package.json +4 -2
- package/wiki/best-practices/api-usage-examples.md +591 -0
- package/wiki/best-practices/architectural-patterns.md +415 -0
- package/wiki/best-practices/architecture-decisions.md +488 -0
- package/wiki/{get-started/best-practices → best-practices}/code-style-standards.md +406 -17
- package/wiki/{get-started/best-practices → best-practices}/common-pitfalls.md +109 -4
- package/wiki/{get-started/best-practices → best-practices}/contribution-workflow.md +34 -7
- package/wiki/best-practices/data-modeling.md +376 -0
- package/wiki/best-practices/deployment-strategies.md +698 -0
- package/wiki/best-practices/index.md +27 -0
- package/wiki/best-practices/performance-optimization.md +196 -0
- package/wiki/best-practices/security-guidelines.md +218 -0
- package/wiki/{get-started/best-practices → best-practices}/troubleshooting-tips.md +97 -1
- package/wiki/changelogs/2025-12-16-initial-architecture.md +1 -1
- package/wiki/changelogs/2025-12-16-model-repo-datasource-refactor.md +1 -1
- package/wiki/changelogs/2025-12-17-refactor.md +1 -1
- package/wiki/changelogs/2025-12-18-performance-optimizations.md +5 -5
- package/wiki/changelogs/2025-12-18-repository-validation-security.md +13 -7
- package/wiki/changelogs/2025-12-26-nested-relations-and-generics.md +2 -2
- package/wiki/changelogs/2025-12-29-dynamic-binding-registration.md +104 -0
- package/wiki/changelogs/2025-12-29-snowflake-uid-helper.md +100 -0
- package/wiki/changelogs/2025-12-30-repository-enhancements.md +214 -0
- package/wiki/changelogs/2025-12-31-json-path-filtering-array-operators.md +214 -0
- package/wiki/changelogs/2025-12-31-string-id-custom-generator.md +137 -0
- package/wiki/changelogs/2026-01-02-default-filter-and-repository-mixins.md +418 -0
- package/wiki/changelogs/index.md +6 -0
- package/wiki/changelogs/planned-schema-migrator.md +0 -8
- package/wiki/{get-started/core-concepts → guides/core-concepts/application}/bootstrapping.md +18 -5
- package/wiki/{get-started/core-concepts/application.md → guides/core-concepts/application/index.md} +47 -104
- package/wiki/guides/core-concepts/components-guide.md +509 -0
- package/wiki/{get-started → guides}/core-concepts/components.md +24 -17
- package/wiki/{get-started → guides}/core-concepts/controllers.md +30 -13
- package/wiki/{get-started → guides}/core-concepts/dependency-injection.md +97 -0
- package/wiki/guides/core-concepts/persistent/datasources.md +179 -0
- package/wiki/guides/core-concepts/persistent/index.md +119 -0
- package/wiki/guides/core-concepts/persistent/models.md +241 -0
- package/wiki/guides/core-concepts/persistent/repositories.md +219 -0
- package/wiki/guides/core-concepts/persistent/transactions.md +170 -0
- package/wiki/{get-started → guides}/core-concepts/services.md +26 -3
- package/wiki/{get-started → guides/get-started}/5-minute-quickstart.md +59 -14
- package/wiki/guides/get-started/philosophy.md +682 -0
- package/wiki/guides/get-started/setup.md +157 -0
- package/wiki/guides/index.md +89 -0
- package/wiki/guides/reference/glossary.md +243 -0
- package/wiki/{get-started → guides/reference}/mcp-docs-server.md +0 -10
- package/wiki/{get-started → guides/tutorials}/building-a-crud-api.md +134 -132
- package/wiki/{get-started/quickstart.md → guides/tutorials/complete-installation.md} +107 -71
- package/wiki/guides/tutorials/ecommerce-api.md +1399 -0
- package/wiki/guides/tutorials/realtime-chat.md +1261 -0
- package/wiki/guides/tutorials/testing.md +723 -0
- package/wiki/index.md +176 -37
- package/wiki/references/base/application.md +27 -0
- package/wiki/references/base/bootstrapping.md +30 -26
- package/wiki/references/base/components.md +24 -7
- package/wiki/references/base/controllers.md +51 -20
- package/wiki/references/base/datasources.md +30 -0
- package/wiki/references/base/dependency-injection.md +39 -3
- package/wiki/references/base/filter-system/application-usage.md +224 -0
- package/wiki/references/base/filter-system/array-operators.md +132 -0
- package/wiki/references/base/filter-system/comparison-operators.md +109 -0
- package/wiki/references/base/filter-system/default-filter.md +428 -0
- package/wiki/references/base/filter-system/fields-order-pagination.md +155 -0
- package/wiki/references/base/filter-system/index.md +127 -0
- package/wiki/references/base/filter-system/json-filtering.md +197 -0
- package/wiki/references/base/filter-system/list-operators.md +71 -0
- package/wiki/references/base/filter-system/logical-operators.md +156 -0
- package/wiki/references/base/filter-system/null-operators.md +58 -0
- package/wiki/references/base/filter-system/pattern-matching.md +108 -0
- package/wiki/references/base/filter-system/quick-reference.md +431 -0
- package/wiki/references/base/filter-system/range-operators.md +63 -0
- package/wiki/references/base/filter-system/tips.md +190 -0
- package/wiki/references/base/filter-system/use-cases.md +452 -0
- package/wiki/references/base/index.md +90 -0
- package/wiki/references/base/middlewares.md +602 -0
- package/wiki/references/base/models.md +215 -23
- package/wiki/references/base/providers.md +732 -0
- package/wiki/references/base/repositories/advanced.md +555 -0
- package/wiki/references/base/repositories/index.md +228 -0
- package/wiki/references/base/repositories/mixins.md +331 -0
- package/wiki/references/base/repositories/relations.md +486 -0
- package/wiki/references/base/repositories.md +40 -635
- package/wiki/references/base/services.md +28 -4
- package/wiki/references/components/authentication.md +22 -2
- package/wiki/references/components/health-check.md +12 -0
- package/wiki/references/components/index.md +23 -0
- package/wiki/references/components/mail.md +687 -0
- package/wiki/references/components/request-tracker.md +16 -0
- package/wiki/references/components/socket-io.md +18 -0
- package/wiki/references/components/static-asset.md +14 -26
- package/wiki/references/components/swagger.md +17 -0
- package/wiki/references/configuration/environment-variables.md +427 -0
- package/wiki/references/configuration/index.md +73 -0
- package/wiki/references/helpers/cron.md +14 -0
- package/wiki/references/helpers/crypto.md +15 -0
- package/wiki/references/helpers/env.md +16 -0
- package/wiki/references/helpers/error.md +17 -0
- package/wiki/references/helpers/index.md +14 -0
- package/wiki/references/helpers/inversion.md +24 -4
- package/wiki/references/helpers/logger.md +19 -0
- package/wiki/references/helpers/network.md +11 -0
- package/wiki/references/helpers/queue.md +19 -0
- package/wiki/references/helpers/redis.md +21 -0
- package/wiki/references/helpers/socket-io.md +24 -5
- package/wiki/references/helpers/storage.md +18 -10
- package/wiki/references/helpers/testing.md +18 -0
- package/wiki/references/helpers/types.md +16 -0
- package/wiki/references/helpers/uid.md +167 -0
- package/wiki/references/helpers/worker-thread.md +16 -0
- package/wiki/references/index.md +177 -0
- package/wiki/references/quick-reference.md +634 -0
- package/wiki/references/src-details/boot.md +3 -3
- package/wiki/references/src-details/dev-configs.md +0 -4
- package/wiki/references/src-details/docs.md +2 -2
- package/wiki/references/src-details/index.md +86 -0
- package/wiki/references/src-details/inversion.md +1 -6
- package/wiki/references/src-details/mcp-server.md +3 -15
- package/wiki/references/utilities/index.md +86 -10
- package/wiki/references/utilities/jsx.md +577 -0
- package/wiki/references/utilities/request.md +0 -2
- package/wiki/references/utilities/statuses.md +740 -0
- package/wiki/get-started/best-practices/api-usage-examples.md +0 -266
- package/wiki/get-started/best-practices/architectural-patterns.md +0 -170
- package/wiki/get-started/best-practices/data-modeling.md +0 -177
- package/wiki/get-started/best-practices/deployment-strategies.md +0 -121
- package/wiki/get-started/best-practices/performance-optimization.md +0 -97
- package/wiki/get-started/best-practices/security-guidelines.md +0 -99
- package/wiki/get-started/core-concepts/persistent.md +0 -539
- package/wiki/get-started/index.md +0 -65
- package/wiki/get-started/philosophy.md +0 -296
- package/wiki/get-started/prerequisites.md +0 -113
|
@@ -0,0 +1,634 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Quick Reference Card
|
|
3
|
+
description: Single-page cheat sheet for IGNIS framework
|
|
4
|
+
lastUpdated: 2026-01-03
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Quick Reference Card
|
|
8
|
+
|
|
9
|
+
A single-page reference for the most commonly used classes, methods, decorators, and operators in IGNIS.
|
|
10
|
+
|
|
11
|
+
## Core Classes
|
|
12
|
+
|
|
13
|
+
### BaseApplication
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { BaseApplication } from '@venizia/ignis';
|
|
17
|
+
|
|
18
|
+
class MyApp extends BaseApplication {
|
|
19
|
+
constructor() {
|
|
20
|
+
super({ projectRoot: __dirname });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const app = new MyApp();
|
|
25
|
+
await app.initialize();
|
|
26
|
+
await app.start();
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Key Methods:**
|
|
30
|
+
- `initialize()` - Bootstrap the application
|
|
31
|
+
- `start()` - Start HTTP server
|
|
32
|
+
- `stop()` - Stop server gracefully
|
|
33
|
+
- `get<T>(key)` - Resolve from DI container
|
|
34
|
+
- `mountControllers()` - Register controllers
|
|
35
|
+
|
|
36
|
+
### BaseController
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { BaseController, controller, get } from '@venizia/ignis';
|
|
40
|
+
|
|
41
|
+
@controller({ path: '/users' })
|
|
42
|
+
class UserController extends BaseController {
|
|
43
|
+
@get({ configs: { path: '/:id' } })
|
|
44
|
+
async getUser(@param('id') id: string) {
|
|
45
|
+
return { id, name: 'John' };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Key Properties:**
|
|
51
|
+
- `this.context` - Hono context
|
|
52
|
+
- `this.container` - DI container
|
|
53
|
+
- `this.logger` - Scoped logger
|
|
54
|
+
|
|
55
|
+
### BaseService
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import { BaseService, injectable } from '@venizia/ignis';
|
|
59
|
+
|
|
60
|
+
@injectable()
|
|
61
|
+
class UserService extends BaseService {
|
|
62
|
+
constructor() {
|
|
63
|
+
super({ scope: UserService.name });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async getUser(id: string) {
|
|
67
|
+
this.logger.info('Getting user', id);
|
|
68
|
+
return this.userRepo.findById(id);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Key Properties:**
|
|
74
|
+
- `this.logger` - Scoped logger
|
|
75
|
+
|
|
76
|
+
### DefaultCRUDRepository
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import { DefaultCRUDRepository } from '@venizia/ignis';
|
|
80
|
+
import { User } from '../models';
|
|
81
|
+
|
|
82
|
+
class UserRepository extends DefaultCRUDRepository<User> {
|
|
83
|
+
constructor() {
|
|
84
|
+
super(User);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Key Methods:**
|
|
90
|
+
- `create(data)` - Create single entity
|
|
91
|
+
- `createMany(data[])` - Create multiple entities
|
|
92
|
+
- `find(filter?)` - Find many with filter
|
|
93
|
+
- `findById(id)` - Find by ID
|
|
94
|
+
- `findOne(filter)` - Find single entity
|
|
95
|
+
- `count(filter?)` - Count entities
|
|
96
|
+
- `update(id, data)` - Update by ID
|
|
97
|
+
- `updateMany(filter, data)` - Update multiple
|
|
98
|
+
- `delete(id)` - Delete by ID (soft/hard based on config)
|
|
99
|
+
- `deleteMany(filter)` - Delete multiple
|
|
100
|
+
|
|
101
|
+
### BaseEntity
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
import { BaseEntity, model } from '@venizia/ignis';
|
|
105
|
+
import { integer, text, pgTable } from 'drizzle-orm/pg-core';
|
|
106
|
+
|
|
107
|
+
@model()
|
|
108
|
+
class User extends BaseEntity {
|
|
109
|
+
static readonly tableName = 'users';
|
|
110
|
+
static readonly schema = pgTable(User.tableName, {
|
|
111
|
+
id: integer('id').primaryKey(),
|
|
112
|
+
name: text('name').notNull(),
|
|
113
|
+
email: text('email').notNull().unique(),
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Key Properties:**
|
|
119
|
+
- `static tableName` - Database table name
|
|
120
|
+
- `static schema` - Drizzle schema definition
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Route Decorators
|
|
125
|
+
|
|
126
|
+
### HTTP Methods
|
|
127
|
+
|
|
128
|
+
| Decorator | HTTP Method | Example |
|
|
129
|
+
|-----------|-------------|---------|
|
|
130
|
+
| `@get()` | GET | `@get({ configs: { path: '/:id' } })` |
|
|
131
|
+
| `@post()` | POST | `@post({ configs: { path: '/' } })` |
|
|
132
|
+
| `@put()` | PUT | `@put({ configs: { path: '/:id' } })` |
|
|
133
|
+
| `@patch()` | PATCH | `@patch({ configs: { path: '/:id' } })` |
|
|
134
|
+
| `@del()` | DELETE | `@del({ configs: { path: '/:id' } })` |
|
|
135
|
+
|
|
136
|
+
### Parameter Decorators
|
|
137
|
+
|
|
138
|
+
| Decorator | Extracts | Example |
|
|
139
|
+
|-----------|----------|---------|
|
|
140
|
+
| `@param('name')` | Route parameter | `@param('id') id: string` |
|
|
141
|
+
| `@query('name')` | Query string | `@query('page') page: string` |
|
|
142
|
+
| `@body()` | Request body | `@body() data: CreateUserDto` |
|
|
143
|
+
| `@header('name')` | HTTP header | `@header('authorization') auth: string` |
|
|
144
|
+
|
|
145
|
+
### Example
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
@controller({ path: '/users' })
|
|
149
|
+
class UserController extends BaseController {
|
|
150
|
+
@post({ configs: { path: '/' } })
|
|
151
|
+
async createUser(
|
|
152
|
+
@body() data: CreateUserDto,
|
|
153
|
+
@header('authorization') token: string
|
|
154
|
+
) {
|
|
155
|
+
return this.userService.create(data);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@get({ configs: { path: '/' } })
|
|
159
|
+
async listUsers(
|
|
160
|
+
@query('page') page: string,
|
|
161
|
+
@query('limit') limit: string
|
|
162
|
+
) {
|
|
163
|
+
return this.userService.findAll({ page, limit });
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
@get({ configs: { path: '/:id' } })
|
|
167
|
+
async getUser(@param('id') id: string) {
|
|
168
|
+
return this.userService.findById(id);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Filter Operators
|
|
176
|
+
|
|
177
|
+
### Comparison Operators
|
|
178
|
+
|
|
179
|
+
| Operator | SQL | Example |
|
|
180
|
+
|----------|-----|---------|
|
|
181
|
+
| `eq` | `=` | `{ status: { eq: 'active' } }` |
|
|
182
|
+
| `neq` | `!=` | `{ status: { neq: 'deleted' } }` |
|
|
183
|
+
| `gt` | `>` | `{ age: { gt: 18 } }` |
|
|
184
|
+
| `gte` | `>=` | `{ age: { gte: 18 } }` |
|
|
185
|
+
| `lt` | `<` | `{ price: { lt: 100 } }` |
|
|
186
|
+
| `lte` | `<=` | `{ price: { lte: 100 } }` |
|
|
187
|
+
|
|
188
|
+
### Range Operators
|
|
189
|
+
|
|
190
|
+
| Operator | SQL | Example |
|
|
191
|
+
|----------|-----|---------|
|
|
192
|
+
| `between` | `BETWEEN` | `{ age: { between: [18, 65] } }` |
|
|
193
|
+
| `notBetween` | `NOT BETWEEN` | `{ age: { notBetween: [0, 18] } }` |
|
|
194
|
+
|
|
195
|
+
### List Operators
|
|
196
|
+
|
|
197
|
+
| Operator | SQL | Example |
|
|
198
|
+
|----------|-----|---------|
|
|
199
|
+
| `in` | `IN` | `{ status: { in: ['active', 'pending'] } }` |
|
|
200
|
+
| `notIn` | `NOT IN` | `{ status: { notIn: ['deleted'] } }` |
|
|
201
|
+
|
|
202
|
+
### Pattern Matching
|
|
203
|
+
|
|
204
|
+
| Operator | SQL | Example |
|
|
205
|
+
|----------|-----|---------|
|
|
206
|
+
| `like` | `LIKE` | `{ name: { like: '%john%' } }` |
|
|
207
|
+
| `ilike` | `ILIKE` | `{ email: { ilike: '%@gmail.com' } }` |
|
|
208
|
+
| `notLike` | `NOT LIKE` | `{ name: { notLike: '%test%' } }` |
|
|
209
|
+
| `notILike` | `NOT ILIKE` | `{ email: { notILike: '%spam%' } }` |
|
|
210
|
+
| `startsWith` | `LIKE 'value%'` | `{ name: { startsWith: 'John' } }` |
|
|
211
|
+
| `endsWith` | `LIKE '%value'` | `{ email: { endsWith: '@example.com' } }` |
|
|
212
|
+
|
|
213
|
+
### Null Operators
|
|
214
|
+
|
|
215
|
+
| Operator | SQL | Example |
|
|
216
|
+
|----------|-----|---------|
|
|
217
|
+
| `isNull` | `IS NULL` | `{ deletedAt: { isNull: true } }` |
|
|
218
|
+
| `isNotNull` | `IS NOT NULL` | `{ email: { isNotNull: true } }` |
|
|
219
|
+
|
|
220
|
+
### Logical Operators
|
|
221
|
+
|
|
222
|
+
| Operator | SQL | Example |
|
|
223
|
+
|----------|-----|---------|
|
|
224
|
+
| `and` | `AND` | `{ and: [{ age: { gt: 18 } }, { status: 'active' }] }` |
|
|
225
|
+
| `or` | `OR` | `{ or: [{ role: 'admin' }, { role: 'moderator' }] }` |
|
|
226
|
+
| `not` | `NOT` | `{ not: { status: 'deleted' } }` |
|
|
227
|
+
|
|
228
|
+
### Array Operators (PostgreSQL)
|
|
229
|
+
|
|
230
|
+
| Operator | SQL | Example |
|
|
231
|
+
|----------|-----|---------|
|
|
232
|
+
| `contains` | `@>` | `{ tags: { contains: ['typescript'] } }` |
|
|
233
|
+
| `containedBy` | `<@` | `{ tags: { containedBy: ['ts', 'js', 'go'] } }` |
|
|
234
|
+
| `overlaps` | `&&` | `{ tags: { overlaps: ['react', 'vue'] } }` |
|
|
235
|
+
|
|
236
|
+
### JSON Operators (PostgreSQL)
|
|
237
|
+
|
|
238
|
+
| Operator | Description | Example |
|
|
239
|
+
|----------|-------------|---------|
|
|
240
|
+
| `jsonPath` | Query JSON field | `{ metadata: { jsonPath: '$.user.name', eq: 'John' } }` |
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Common Filters
|
|
245
|
+
|
|
246
|
+
### Basic Find
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
const users = await userRepo.find({
|
|
250
|
+
where: { isActive: true },
|
|
251
|
+
orderBy: { createdAt: 'desc' },
|
|
252
|
+
limit: 10,
|
|
253
|
+
offset: 0,
|
|
254
|
+
});
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### With Multiple Conditions
|
|
258
|
+
|
|
259
|
+
```typescript
|
|
260
|
+
const users = await userRepo.find({
|
|
261
|
+
where: {
|
|
262
|
+
and: [
|
|
263
|
+
{ age: { gte: 18 } },
|
|
264
|
+
{ status: { in: ['active', 'pending'] } },
|
|
265
|
+
{ email: { endsWith: '@company.com' } }
|
|
266
|
+
]
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### With Relations
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
const posts = await postRepo.find({
|
|
275
|
+
where: { published: true },
|
|
276
|
+
include: {
|
|
277
|
+
author: true,
|
|
278
|
+
comments: {
|
|
279
|
+
where: { approved: true },
|
|
280
|
+
limit: 5
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Selecting Fields
|
|
287
|
+
|
|
288
|
+
```typescript
|
|
289
|
+
const users = await userRepo.find({
|
|
290
|
+
where: { isActive: true },
|
|
291
|
+
fields: ['id', 'name', 'email'], // Only these fields
|
|
292
|
+
});
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Dependency Injection
|
|
298
|
+
|
|
299
|
+
### Injectable Decorator
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
import { injectable } from '@venizia/ignis';
|
|
303
|
+
|
|
304
|
+
@injectable()
|
|
305
|
+
class MyService extends BaseService {
|
|
306
|
+
// ...
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Inject Decorator
|
|
311
|
+
|
|
312
|
+
```typescript
|
|
313
|
+
import { inject } from '@venizia/ignis';
|
|
314
|
+
|
|
315
|
+
@injectable()
|
|
316
|
+
class UserController extends BaseController {
|
|
317
|
+
constructor(
|
|
318
|
+
@inject({ key: 'services.UserService' })
|
|
319
|
+
private userService: UserService
|
|
320
|
+
) {
|
|
321
|
+
super();
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Manual Resolution
|
|
327
|
+
|
|
328
|
+
```typescript
|
|
329
|
+
const userService = app.get<UserService>('services.UserService');
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
## Common Imports
|
|
335
|
+
|
|
336
|
+
### Core Framework
|
|
337
|
+
|
|
338
|
+
```typescript
|
|
339
|
+
import {
|
|
340
|
+
// Application
|
|
341
|
+
BaseApplication,
|
|
342
|
+
|
|
343
|
+
// Controllers
|
|
344
|
+
BaseController,
|
|
345
|
+
controller,
|
|
346
|
+
|
|
347
|
+
// HTTP Methods
|
|
348
|
+
get, post, put, patch, del,
|
|
349
|
+
|
|
350
|
+
// Parameters
|
|
351
|
+
param, query, body, header, context,
|
|
352
|
+
|
|
353
|
+
// Services
|
|
354
|
+
BaseService,
|
|
355
|
+
|
|
356
|
+
// Repositories
|
|
357
|
+
BaseRepository,
|
|
358
|
+
DefaultCRUDRepository,
|
|
359
|
+
|
|
360
|
+
// Models
|
|
361
|
+
BaseEntity,
|
|
362
|
+
model,
|
|
363
|
+
|
|
364
|
+
// DI
|
|
365
|
+
inject,
|
|
366
|
+
injectable,
|
|
367
|
+
|
|
368
|
+
// Utilities
|
|
369
|
+
jsonResponse,
|
|
370
|
+
htmlResponse,
|
|
371
|
+
Statuses,
|
|
372
|
+
} from '@venizia/ignis';
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### Helpers
|
|
376
|
+
|
|
377
|
+
```typescript
|
|
378
|
+
import {
|
|
379
|
+
// Logging
|
|
380
|
+
LoggerFactory,
|
|
381
|
+
ApplicationLogger,
|
|
382
|
+
|
|
383
|
+
// Caching
|
|
384
|
+
RedisHelper,
|
|
385
|
+
|
|
386
|
+
// Queues
|
|
387
|
+
QueueHelper,
|
|
388
|
+
BullMQHelper,
|
|
389
|
+
|
|
390
|
+
// Cron
|
|
391
|
+
CronHelper,
|
|
392
|
+
|
|
393
|
+
// Storage
|
|
394
|
+
MinIOHelper,
|
|
395
|
+
|
|
396
|
+
// Crypto
|
|
397
|
+
hash,
|
|
398
|
+
compare,
|
|
399
|
+
|
|
400
|
+
// HTTP
|
|
401
|
+
HTTP,
|
|
402
|
+
} from '@venizia/ignis-helpers';
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
### Dependency Injection
|
|
406
|
+
|
|
407
|
+
```typescript
|
|
408
|
+
import {
|
|
409
|
+
Container,
|
|
410
|
+
BindingKeys,
|
|
411
|
+
BindingNamespaces,
|
|
412
|
+
} from '@venizia/ignis-inversion';
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
## OpenAPI/Swagger
|
|
418
|
+
|
|
419
|
+
### JSON Response
|
|
420
|
+
|
|
421
|
+
```typescript
|
|
422
|
+
import { jsonResponse } from '@venizia/ignis';
|
|
423
|
+
import { z } from '@hono/zod-openapi';
|
|
424
|
+
|
|
425
|
+
@get({
|
|
426
|
+
configs: {
|
|
427
|
+
path: '/users/:id',
|
|
428
|
+
responses: jsonResponse({
|
|
429
|
+
description: 'User data',
|
|
430
|
+
schema: z.object({
|
|
431
|
+
id: z.string(),
|
|
432
|
+
name: z.string(),
|
|
433
|
+
email: z.string().email(),
|
|
434
|
+
}),
|
|
435
|
+
}),
|
|
436
|
+
},
|
|
437
|
+
})
|
|
438
|
+
async getUser(@param('id') id: string) {
|
|
439
|
+
return { id, name: 'John', email: 'john@example.com' };
|
|
440
|
+
}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
### HTML Response
|
|
444
|
+
|
|
445
|
+
```typescript
|
|
446
|
+
import { htmlResponse } from '@venizia/ignis';
|
|
447
|
+
|
|
448
|
+
@get({
|
|
449
|
+
configs: {
|
|
450
|
+
path: '/dashboard',
|
|
451
|
+
responses: htmlResponse({
|
|
452
|
+
description: 'Dashboard page',
|
|
453
|
+
}),
|
|
454
|
+
},
|
|
455
|
+
})
|
|
456
|
+
async getDashboard() {
|
|
457
|
+
return this.context.html(<DashboardPage />);
|
|
458
|
+
}
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
## Status Codes
|
|
464
|
+
|
|
465
|
+
### Using Statuses
|
|
466
|
+
|
|
467
|
+
```typescript
|
|
468
|
+
import { Statuses } from '@venizia/ignis';
|
|
469
|
+
|
|
470
|
+
// Create with status
|
|
471
|
+
const order = await orderRepo.create({
|
|
472
|
+
items: [...],
|
|
473
|
+
status: Statuses.PENDING,
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
// Update status
|
|
477
|
+
await orderRepo.update(orderId, {
|
|
478
|
+
status: Statuses.COMPLETED,
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
// Check status
|
|
482
|
+
if (Statuses.isActive(order.status)) {
|
|
483
|
+
// Process order
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
if (Statuses.isCompleted(order.status)) {
|
|
487
|
+
// Order is done
|
|
488
|
+
}
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
### Common Statuses
|
|
492
|
+
|
|
493
|
+
| Status | Value | Category |
|
|
494
|
+
|--------|-------|----------|
|
|
495
|
+
| `UNKNOWN` | `'000_UNKNOWN'` | Initial |
|
|
496
|
+
| `DRAFT` | `'001_DRAFT'` | Initial |
|
|
497
|
+
| `PENDING` | `'103_PENDING'` | Pending |
|
|
498
|
+
| `ACTIVATED` | `'201_ACTIVATED'` | Active |
|
|
499
|
+
| `RUNNING` | `'202_RUNNING'` | Active |
|
|
500
|
+
| `COMPLETED` | `'303_COMPLETED'` | Completed |
|
|
501
|
+
| `SUCCESS` | `'302_SUCCESS'` | Completed |
|
|
502
|
+
| `SUSPENDED` | `'402_SUSPENDED'` | Inactive |
|
|
503
|
+
| `ARCHIVED` | `'405_ARCHIVED'` | Inactive |
|
|
504
|
+
| `FAIL` | `'500_FAIL'` | Failed |
|
|
505
|
+
| `CANCELLED` | `'505_CANCELLED'` | Failed |
|
|
506
|
+
| `DELETED` | `'506_DELETED'` | Failed |
|
|
507
|
+
|
|
508
|
+
---
|
|
509
|
+
|
|
510
|
+
## Middlewares
|
|
511
|
+
|
|
512
|
+
### Built-in Middlewares
|
|
513
|
+
|
|
514
|
+
```typescript
|
|
515
|
+
import {
|
|
516
|
+
appErrorHandler,
|
|
517
|
+
notFoundHandler,
|
|
518
|
+
requestNormalize,
|
|
519
|
+
RequestSpyMiddleware,
|
|
520
|
+
emojiFavicon,
|
|
521
|
+
} from '@venizia/ignis';
|
|
522
|
+
|
|
523
|
+
const app = new MyApp();
|
|
524
|
+
|
|
525
|
+
// Request normalization
|
|
526
|
+
app.use(requestNormalize());
|
|
527
|
+
|
|
528
|
+
// Request logging
|
|
529
|
+
const requestSpy = new RequestSpyMiddleware();
|
|
530
|
+
app.use(requestSpy.value());
|
|
531
|
+
|
|
532
|
+
// Emoji favicon
|
|
533
|
+
app.use(emojiFavicon({ icon: '🚀' }));
|
|
534
|
+
|
|
535
|
+
// Error handling (register last)
|
|
536
|
+
app.onError(appErrorHandler({ logger: app.logger }));
|
|
537
|
+
|
|
538
|
+
// 404 handler
|
|
539
|
+
app.notFound(notFoundHandler({ logger: app.logger }));
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
---
|
|
543
|
+
|
|
544
|
+
## Environment Variables
|
|
545
|
+
|
|
546
|
+
### Loading Environment
|
|
547
|
+
|
|
548
|
+
```typescript
|
|
549
|
+
import { EnvHelper } from '@venizia/ignis-helpers';
|
|
550
|
+
|
|
551
|
+
// Load from .env file
|
|
552
|
+
EnvHelper.load();
|
|
553
|
+
|
|
554
|
+
// Get variable
|
|
555
|
+
const dbUrl = EnvHelper.get('DATABASE_URL');
|
|
556
|
+
|
|
557
|
+
// Get with default
|
|
558
|
+
const port = EnvHelper.get('PORT', '3000');
|
|
559
|
+
|
|
560
|
+
// Get required (throws if missing)
|
|
561
|
+
const apiKey = EnvHelper.getRequired('API_KEY');
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
---
|
|
565
|
+
|
|
566
|
+
## Common Patterns
|
|
567
|
+
|
|
568
|
+
### Controller → Service → Repository
|
|
569
|
+
|
|
570
|
+
```typescript
|
|
571
|
+
// Controller
|
|
572
|
+
@controller({ path: '/users' })
|
|
573
|
+
class UserController extends BaseController {
|
|
574
|
+
constructor(
|
|
575
|
+
@inject({ key: 'services.UserService' })
|
|
576
|
+
private userService: UserService
|
|
577
|
+
) {
|
|
578
|
+
super();
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
@post({ configs: { path: '/' } })
|
|
582
|
+
async createUser(@body() data: CreateUserDto) {
|
|
583
|
+
return this.userService.create(data);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
// Service
|
|
588
|
+
@injectable()
|
|
589
|
+
class UserService extends BaseService {
|
|
590
|
+
constructor(
|
|
591
|
+
@inject({ key: 'repositories.UserRepository' })
|
|
592
|
+
private userRepo: UserRepository
|
|
593
|
+
) {
|
|
594
|
+
super({ scope: UserService.name });
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
async create(data: CreateUserDto) {
|
|
598
|
+
// Business logic
|
|
599
|
+
const hashedPassword = await hash({ value: data.password });
|
|
600
|
+
|
|
601
|
+
return this.userRepo.create({
|
|
602
|
+
...data,
|
|
603
|
+
password: hashedPassword,
|
|
604
|
+
status: Statuses.ACTIVATED,
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
// Repository
|
|
610
|
+
@injectable()
|
|
611
|
+
class UserRepository extends DefaultCRUDRepository<User> {
|
|
612
|
+
constructor() {
|
|
613
|
+
super(User);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
---
|
|
619
|
+
|
|
620
|
+
## See Also
|
|
621
|
+
|
|
622
|
+
- **Full Documentation:**
|
|
623
|
+
- [Base Abstractions](./base/) - Complete API reference
|
|
624
|
+
- [Components](./components/) - Pre-built features
|
|
625
|
+
- [Helpers](./helpers/) - Utility helpers
|
|
626
|
+
- [Utilities](./utilities/) - Pure functions
|
|
627
|
+
|
|
628
|
+
- **Guides:**
|
|
629
|
+
- [Getting Started](/guides/) - Tutorials and walkthroughs
|
|
630
|
+
- [Core Concepts](/guides/core-concepts/application/) - Architecture deep-dive
|
|
631
|
+
|
|
632
|
+
- **Best Practices:**
|
|
633
|
+
- [Architecture Patterns](/best-practices/architecture/)
|
|
634
|
+
- [Security Guidelines](/best-practices/security/)
|
|
@@ -80,7 +80,7 @@ import { inject } from '@venizia/ignis-inversion';
|
|
|
80
80
|
export class CustomBooter extends BaseArtifactBooter {
|
|
81
81
|
constructor(
|
|
82
82
|
@inject({ key: '@app/project_root' }) root: string,
|
|
83
|
-
@inject({ key: '@app/instance' }) private
|
|
83
|
+
@inject({ key: '@app/instance' }) private _app: IApplication,
|
|
84
84
|
@inject({ key: '@app/boot-options' }) bootOptions: IBootOptions,
|
|
85
85
|
) {
|
|
86
86
|
super({
|
|
@@ -373,7 +373,7 @@ await app.start(); // Calls initialize() which triggers boot
|
|
|
373
373
|
|
|
374
374
|
## Related Documentation
|
|
375
375
|
|
|
376
|
-
- [Bootstrapping Concepts](/
|
|
377
|
-
- [Application Guide](/
|
|
376
|
+
- [Bootstrapping Concepts](/guides/core-concepts/application/bootstrapping)
|
|
377
|
+
- [Application Guide](/guides/core-concepts/application/)
|
|
378
378
|
- [Dependency Injection](/references/base/dependency-injection.md)
|
|
379
379
|
- [Core Package](/references/src-details/core.md)
|
|
@@ -120,7 +120,6 @@ Recommended ignore patterns:
|
|
|
120
120
|
- `coverage` - Test coverage (if applicable)
|
|
121
121
|
- `*.min.js` - Minified files (if applicable)
|
|
122
122
|
|
|
123
|
-
---
|
|
124
123
|
|
|
125
124
|
## TypeScript Configuration
|
|
126
125
|
|
|
@@ -187,7 +186,6 @@ Extends the base config with settings for standard packages:
|
|
|
187
186
|
|
|
188
187
|
**Note:** Path-related options (`outDir`, `rootDir`, `baseUrl`, `paths`, `include`, `exclude`) must be defined in each package's tsconfig.json as they are resolved relative to the config file location.
|
|
189
188
|
|
|
190
|
-
---
|
|
191
189
|
|
|
192
190
|
## Project Structure
|
|
193
191
|
|
|
@@ -214,7 +212,6 @@ packages/dev-configs/
|
|
|
214
212
|
└── prettier.js / .d.ts
|
|
215
213
|
```
|
|
216
214
|
|
|
217
|
-
---
|
|
218
215
|
|
|
219
216
|
## Integration Guide
|
|
220
217
|
|
|
@@ -284,7 +281,6 @@ node_modules
|
|
|
284
281
|
}
|
|
285
282
|
```
|
|
286
283
|
|
|
287
|
-
---
|
|
288
284
|
|
|
289
285
|
## Building the Package
|
|
290
286
|
|
|
@@ -17,7 +17,7 @@ Documentation package housing guides, references, and MCP server for the Ignis f
|
|
|
17
17
|
|
|
18
18
|
| Section | Content |
|
|
19
19
|
|---------|---------|
|
|
20
|
-
| `
|
|
20
|
+
| `guides/` | Tutorials, quickstart, core concepts, best practices |
|
|
21
21
|
| `references/` | API reference, components, helpers, base classes |
|
|
22
22
|
| `.vitepress/` | Site configuration and theme |
|
|
23
23
|
|
|
@@ -61,7 +61,7 @@ This directory holds the actual documentation content and the VitePress configur
|
|
|
61
61
|
| `.vitepress/` | VitePress-specific configuration and theme files. |
|
|
62
62
|
| `.vitepress/config.mts` | The main configuration file for VitePress, defining the documentation's title, description, navigation, and sidebar structure. |
|
|
63
63
|
| `.vitepress/theme/` | Custom theme files for the VitePress documentation. |
|
|
64
|
-
| `
|
|
64
|
+
| `guides/` | Guides and tutorials for getting started with `Ignis`. |
|
|
65
65
|
| `references/` | Detailed reference documentation for various aspects of the framework. |
|
|
66
66
|
| `index.md` | The homepage content for the documentation site. |
|
|
67
67
|
| `logo.svg` | The logo used in the documentation. |
|