@venizia/ignis-docs 0.0.3 → 0.0.4-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 (131) hide show
  1. package/README.md +1 -1
  2. package/package.json +4 -2
  3. package/wiki/best-practices/api-usage-examples.md +591 -0
  4. package/wiki/best-practices/architectural-patterns.md +415 -0
  5. package/wiki/best-practices/architecture-decisions.md +488 -0
  6. package/wiki/{get-started/best-practices → best-practices}/code-style-standards.md +406 -17
  7. package/wiki/{get-started/best-practices → best-practices}/common-pitfalls.md +109 -4
  8. package/wiki/{get-started/best-practices → best-practices}/contribution-workflow.md +34 -7
  9. package/wiki/best-practices/data-modeling.md +376 -0
  10. package/wiki/best-practices/deployment-strategies.md +698 -0
  11. package/wiki/best-practices/index.md +27 -0
  12. package/wiki/best-practices/performance-optimization.md +196 -0
  13. package/wiki/best-practices/security-guidelines.md +218 -0
  14. package/wiki/{get-started/best-practices → best-practices}/troubleshooting-tips.md +97 -1
  15. package/wiki/changelogs/2025-12-16-initial-architecture.md +1 -1
  16. package/wiki/changelogs/2025-12-16-model-repo-datasource-refactor.md +1 -1
  17. package/wiki/changelogs/2025-12-17-refactor.md +1 -1
  18. package/wiki/changelogs/2025-12-18-performance-optimizations.md +5 -5
  19. package/wiki/changelogs/2025-12-18-repository-validation-security.md +13 -7
  20. package/wiki/changelogs/2025-12-26-nested-relations-and-generics.md +2 -2
  21. package/wiki/changelogs/2025-12-29-dynamic-binding-registration.md +104 -0
  22. package/wiki/changelogs/2025-12-29-snowflake-uid-helper.md +100 -0
  23. package/wiki/changelogs/2025-12-30-repository-enhancements.md +214 -0
  24. package/wiki/changelogs/2025-12-31-json-path-filtering-array-operators.md +214 -0
  25. package/wiki/changelogs/2025-12-31-string-id-custom-generator.md +137 -0
  26. package/wiki/changelogs/2026-01-02-default-filter-and-repository-mixins.md +418 -0
  27. package/wiki/changelogs/index.md +6 -0
  28. package/wiki/changelogs/planned-schema-migrator.md +0 -8
  29. package/wiki/{get-started/core-concepts → guides/core-concepts/application}/bootstrapping.md +18 -5
  30. package/wiki/{get-started/core-concepts/application.md → guides/core-concepts/application/index.md} +47 -104
  31. package/wiki/guides/core-concepts/components-guide.md +509 -0
  32. package/wiki/{get-started → guides}/core-concepts/components.md +24 -17
  33. package/wiki/{get-started → guides}/core-concepts/controllers.md +30 -13
  34. package/wiki/{get-started → guides}/core-concepts/dependency-injection.md +97 -0
  35. package/wiki/guides/core-concepts/persistent/datasources.md +179 -0
  36. package/wiki/guides/core-concepts/persistent/index.md +119 -0
  37. package/wiki/guides/core-concepts/persistent/models.md +241 -0
  38. package/wiki/guides/core-concepts/persistent/repositories.md +219 -0
  39. package/wiki/guides/core-concepts/persistent/transactions.md +170 -0
  40. package/wiki/{get-started → guides}/core-concepts/services.md +26 -3
  41. package/wiki/{get-started → guides/get-started}/5-minute-quickstart.md +59 -14
  42. package/wiki/guides/get-started/philosophy.md +682 -0
  43. package/wiki/guides/get-started/setup.md +157 -0
  44. package/wiki/guides/index.md +89 -0
  45. package/wiki/guides/reference/glossary.md +243 -0
  46. package/wiki/{get-started → guides/reference}/mcp-docs-server.md +0 -10
  47. package/wiki/{get-started → guides/tutorials}/building-a-crud-api.md +134 -132
  48. package/wiki/{get-started/quickstart.md → guides/tutorials/complete-installation.md} +107 -71
  49. package/wiki/guides/tutorials/ecommerce-api.md +1399 -0
  50. package/wiki/guides/tutorials/realtime-chat.md +1261 -0
  51. package/wiki/guides/tutorials/testing.md +723 -0
  52. package/wiki/index.md +176 -37
  53. package/wiki/references/base/application.md +27 -0
  54. package/wiki/references/base/bootstrapping.md +31 -26
  55. package/wiki/references/base/components.md +24 -7
  56. package/wiki/references/base/controllers.md +50 -20
  57. package/wiki/references/base/datasources.md +30 -0
  58. package/wiki/references/base/dependency-injection.md +39 -3
  59. package/wiki/references/base/filter-system/application-usage.md +224 -0
  60. package/wiki/references/base/filter-system/array-operators.md +132 -0
  61. package/wiki/references/base/filter-system/comparison-operators.md +109 -0
  62. package/wiki/references/base/filter-system/default-filter.md +428 -0
  63. package/wiki/references/base/filter-system/fields-order-pagination.md +155 -0
  64. package/wiki/references/base/filter-system/index.md +127 -0
  65. package/wiki/references/base/filter-system/json-filtering.md +197 -0
  66. package/wiki/references/base/filter-system/list-operators.md +71 -0
  67. package/wiki/references/base/filter-system/logical-operators.md +156 -0
  68. package/wiki/references/base/filter-system/null-operators.md +58 -0
  69. package/wiki/references/base/filter-system/pattern-matching.md +108 -0
  70. package/wiki/references/base/filter-system/quick-reference.md +431 -0
  71. package/wiki/references/base/filter-system/range-operators.md +63 -0
  72. package/wiki/references/base/filter-system/tips.md +190 -0
  73. package/wiki/references/base/filter-system/use-cases.md +452 -0
  74. package/wiki/references/base/index.md +90 -0
  75. package/wiki/references/base/middlewares.md +604 -0
  76. package/wiki/references/base/models.md +215 -23
  77. package/wiki/references/base/providers.md +731 -0
  78. package/wiki/references/base/repositories/advanced.md +555 -0
  79. package/wiki/references/base/repositories/index.md +228 -0
  80. package/wiki/references/base/repositories/mixins.md +331 -0
  81. package/wiki/references/base/repositories/relations.md +486 -0
  82. package/wiki/references/base/repositories.md +40 -635
  83. package/wiki/references/base/services.md +28 -4
  84. package/wiki/references/components/authentication.md +22 -2
  85. package/wiki/references/components/health-check.md +12 -0
  86. package/wiki/references/components/index.md +23 -0
  87. package/wiki/references/components/mail.md +687 -0
  88. package/wiki/references/components/request-tracker.md +16 -0
  89. package/wiki/references/components/socket-io.md +18 -0
  90. package/wiki/references/components/static-asset.md +14 -26
  91. package/wiki/references/components/swagger.md +17 -0
  92. package/wiki/references/configuration/environment-variables.md +427 -0
  93. package/wiki/references/configuration/index.md +73 -0
  94. package/wiki/references/helpers/cron.md +14 -0
  95. package/wiki/references/helpers/crypto.md +15 -0
  96. package/wiki/references/helpers/env.md +16 -0
  97. package/wiki/references/helpers/error.md +17 -0
  98. package/wiki/references/helpers/index.md +14 -0
  99. package/wiki/references/helpers/inversion.md +24 -4
  100. package/wiki/references/helpers/logger.md +19 -0
  101. package/wiki/references/helpers/network.md +11 -0
  102. package/wiki/references/helpers/queue.md +19 -0
  103. package/wiki/references/helpers/redis.md +21 -0
  104. package/wiki/references/helpers/socket-io.md +24 -5
  105. package/wiki/references/helpers/storage.md +18 -10
  106. package/wiki/references/helpers/testing.md +18 -0
  107. package/wiki/references/helpers/types.md +16 -0
  108. package/wiki/references/helpers/uid.md +167 -0
  109. package/wiki/references/helpers/worker-thread.md +16 -0
  110. package/wiki/references/index.md +177 -0
  111. package/wiki/references/quick-reference.md +634 -0
  112. package/wiki/references/src-details/boot.md +3 -3
  113. package/wiki/references/src-details/dev-configs.md +0 -4
  114. package/wiki/references/src-details/docs.md +2 -2
  115. package/wiki/references/src-details/index.md +86 -0
  116. package/wiki/references/src-details/inversion.md +1 -6
  117. package/wiki/references/src-details/mcp-server.md +3 -15
  118. package/wiki/references/utilities/index.md +86 -10
  119. package/wiki/references/utilities/jsx.md +577 -0
  120. package/wiki/references/utilities/request.md +0 -2
  121. package/wiki/references/utilities/statuses.md +740 -0
  122. package/wiki/get-started/best-practices/api-usage-examples.md +0 -266
  123. package/wiki/get-started/best-practices/architectural-patterns.md +0 -170
  124. package/wiki/get-started/best-practices/data-modeling.md +0 -177
  125. package/wiki/get-started/best-practices/deployment-strategies.md +0 -121
  126. package/wiki/get-started/best-practices/performance-optimization.md +0 -97
  127. package/wiki/get-started/best-practices/security-guidelines.md +0 -99
  128. package/wiki/get-started/core-concepts/persistent.md +0 -539
  129. package/wiki/get-started/index.md +0 -65
  130. package/wiki/get-started/philosophy.md +0 -296
  131. package/wiki/get-started/prerequisites.md +0 -113
@@ -125,3 +125,21 @@ import { SocketIOServerHelper, SocketIOBindingKeys, inject } from '@venizia/igni
125
125
  });
126
126
  }
127
127
  ```
128
+
129
+ ## See Also
130
+
131
+ - **Related Concepts:**
132
+ - [Components Overview](/guides/core-concepts/components) - Component system basics
133
+ - [Application](/guides/core-concepts/application/) - Registering components
134
+
135
+ - **Other Components:**
136
+ - [Components Index](./index) - All built-in components
137
+
138
+ - **References:**
139
+ - [Socket.IO Helper](/references/helpers/socket-io) - Socket.IO utilities
140
+
141
+ - **External Resources:**
142
+ - [Socket.IO Documentation](https://socket.io/docs/) - WebSocket library
143
+
144
+ - **Tutorials:**
145
+ - [Real-Time Chat](/guides/tutorials/realtime-chat) - Building a chat app with Socket.IO
@@ -264,7 +264,6 @@ this.bind({
264
264
  this.component(StaticAssetComponent);
265
265
  ```
266
266
 
267
- ---
268
267
 
269
268
  ## MetaLink: Database File Tracking
270
269
 
@@ -530,7 +529,6 @@ DELETE /uploads/buckets/user-uploads/objects/document.pdf
530
529
  - Deletes MetaLink record from database
531
530
  - Returns `{ "success": true }`
532
531
 
533
- ---
534
532
 
535
533
  ## Storage Helpers
536
534
 
@@ -573,7 +571,6 @@ app_data/storage/
573
571
  - Metadata stored in file stats
574
572
  - Stream-based file operations
575
573
 
576
- ---
577
574
 
578
575
  ### MinioHelper (S3-Compatible Storage)
579
576
 
@@ -603,7 +600,6 @@ const minioHelper = new MinioHelper({
603
600
  });
604
601
  ```
605
602
 
606
- ---
607
603
 
608
604
  ## IStorageHelper Interface
609
605
 
@@ -640,7 +636,6 @@ interface IStorageHelper {
640
636
  }
641
637
  ```
642
638
 
643
- ---
644
639
 
645
640
  ## API Endpoints
646
641
 
@@ -663,7 +658,6 @@ GET /{basePath}/buckets
663
658
  ]
664
659
  ```
665
660
 
666
- ---
667
661
 
668
662
  #### **Get Bucket by Name**
669
663
 
@@ -683,7 +677,6 @@ GET /{basePath}/buckets/:bucketName
683
677
  { "name": "my-bucket", "creationDate": "2025-01-01T00:00:00.000Z" }
684
678
  ```
685
679
 
686
- ---
687
680
 
688
681
  #### **Create Bucket**
689
682
 
@@ -699,7 +692,6 @@ POST /{basePath}/buckets/:bucketName
699
692
  { "name": "my-bucket", "creationDate": "2025-12-13T00:00:00.000Z" }
700
693
  ```
701
694
 
702
- ---
703
695
 
704
696
  #### **Delete Bucket**
705
697
 
@@ -715,7 +707,6 @@ DELETE /{basePath}/buckets/:bucketName
715
707
  { "success": true }
716
708
  ```
717
709
 
718
- ---
719
710
 
720
711
  #### **Upload Files**
721
712
 
@@ -777,7 +768,6 @@ const result = await response.json();
777
768
  console.log(result[0].metaLink); // Database record (if MetaLink enabled)
778
769
  ```
779
770
 
780
- ---
781
771
 
782
772
  #### **Get Object (Stream)**
783
773
 
@@ -799,7 +789,6 @@ GET /{basePath}/buckets/:bucketName/objects/:objectName
799
789
  - Content-Length: File size in bytes
800
790
  - X-Content-Type-Options: `nosniff`
801
791
 
802
- ---
803
792
 
804
793
  #### **Download Object**
805
794
 
@@ -822,7 +811,6 @@ const downloadUrl = `/assets/buckets/uploads/objects/${encodeURIComponent('docum
822
811
  window.open(downloadUrl, '_blank');
823
812
  ```
824
813
 
825
- ---
826
814
 
827
815
  #### **Delete Object**
828
816
 
@@ -839,7 +827,6 @@ DELETE /{basePath}/buckets/:bucketName/objects/:objectName
839
827
  { "success": true }
840
828
  ```
841
829
 
842
- ---
843
830
 
844
831
  #### **List Objects**
845
832
 
@@ -864,7 +851,6 @@ GET /{basePath}/buckets/:bucketName/objects
864
851
  ]
865
852
  ```
866
853
 
867
- ---
868
854
 
869
855
  #### **Delete Object**
870
856
 
@@ -905,7 +891,6 @@ await fetch(`/assets/buckets/${bucketName}/objects/${encodeURIComponent(objectNa
905
891
  // MetaLink record deleted from database (if enabled)
906
892
  ```
907
893
 
908
- ---
909
894
 
910
895
  #### **Sync MetaLink** (MetaLink only)
911
896
 
@@ -996,7 +981,6 @@ for (const obj of objects) {
996
981
  }
997
982
  ```
998
983
 
999
- ---
1000
984
 
1001
985
  ## Security Features
1002
986
 
@@ -1049,7 +1033,6 @@ X-Content-Type-Options: nosniff
1049
1033
  Content-Disposition: attachment; filename="..."
1050
1034
  ```
1051
1035
 
1052
- ---
1053
1036
 
1054
1037
  ## Usage Examples
1055
1038
 
@@ -1146,7 +1129,6 @@ async function listFiles(bucketName: string, prefix?: string) {
1146
1129
  }
1147
1130
  ```
1148
1131
 
1149
- ---
1150
1132
 
1151
1133
  ## Custom Storage Implementation
1152
1134
 
@@ -1188,7 +1170,6 @@ this.bind<TStaticAssetsComponentOptions>({
1188
1170
  });
1189
1171
  ```
1190
1172
 
1191
- ---
1192
1173
 
1193
1174
  ## Troubleshooting
1194
1175
 
@@ -1243,7 +1224,6 @@ extra: {
1243
1224
  }
1244
1225
  ```
1245
1226
 
1246
- ---
1247
1227
 
1248
1228
  ## Docker Setup for Development
1249
1229
 
@@ -1279,11 +1259,19 @@ docker-compose up -d
1279
1259
  http://localhost:9001
1280
1260
  ```
1281
1261
 
1282
- ---
1283
1262
 
1284
- ## Related Documentation
1263
+ ## See Also
1264
+
1265
+ - **Related Concepts:**
1266
+ - [Components Overview](/guides/core-concepts/components) - Component system basics
1267
+ - [Controllers](/guides/core-concepts/controllers) - File upload endpoints
1268
+
1269
+ - **Other Components:**
1270
+ - [Components Index](./index) - All built-in components
1271
+
1272
+ - **References:**
1273
+ - [Storage Helpers](/references/helpers/storage) - DiskHelper, MinIOHelper, BaseStorageHelper
1274
+ - [Request Utilities](/references/utilities/request) - File upload utilities
1285
1275
 
1286
- - [Storage Helpers](../helpers/storage.md) - DiskHelper, MinioHelper, BaseStorageHelper
1287
- - [Request Utilities](../utilities/request.md) - `parseMultipartBody`, `createContentDispositionHeader`
1288
- - [Components Overview](./index.md)
1289
- - [Controllers](../base/controllers.md)
1276
+ - **Best Practices:**
1277
+ - [Security Guidelines](/best-practices/security-guidelines) - File upload security
@@ -173,3 +173,20 @@ By default, the documentation is available at the following endpoints:
173
173
  - **/doc/openapi.json**: The raw OpenAPI specification.
174
174
 
175
175
  These paths can be configured by providing custom `ISwaggerOptions`. This feature provides a powerful and flexible way to document your APIs, making them easier to consume and understand.
176
+
177
+ ## See Also
178
+
179
+ - **Related Concepts:**
180
+ - [Components Overview](/guides/core-concepts/components) - Component system basics
181
+ - [Controllers](/guides/core-concepts/controllers) - Defining OpenAPI routes
182
+
183
+ - **Other Components:**
184
+ - [Components Index](./index) - All built-in components
185
+
186
+ - **References:**
187
+ - [Schema Utilities](/references/utilities/schema) - Response schema helpers
188
+ - [JSX Utilities](/references/utilities/jsx) - HTML response schemas
189
+
190
+ - **External Resources:**
191
+ - [OpenAPI Specification](https://swagger.io/specification/) - OpenAPI standard
192
+ - [Scalar Documentation](https://github.com/scalar/scalar) - API documentation UI
@@ -0,0 +1,427 @@
1
+ # Environment Variables Reference
2
+
3
+ Complete reference of all environment variables used by Ignis framework.
4
+
5
+
6
+ ## Overview
7
+
8
+ Ignis uses the `APP_ENV_` prefix for all framework-specific environment variables. This prevents conflicts with system variables like `PATH`, `HOME`, etc.
9
+
10
+ ```bash
11
+ # ✅ Ignis variables
12
+ APP_ENV_POSTGRES_HOST=localhost
13
+
14
+ # ❌ Might conflict with system
15
+ POSTGRES_HOST=localhost
16
+ ```
17
+
18
+ ### Accessing Environment Variables
19
+
20
+ ```typescript
21
+ // Direct access
22
+ const host = process.env.APP_ENV_POSTGRES_HOST;
23
+
24
+ // Using applicationEnvironment helper (recommended)
25
+ import { applicationEnvironment, EnvironmentKeys } from '@venizia/ignis';
26
+ const host = applicationEnvironment.get<string>(EnvironmentKeys.APP_ENV_POSTGRES_HOST);
27
+ ```
28
+
29
+
30
+ ## Quick Start Template
31
+
32
+ Create a `.env` file in your project root:
33
+
34
+ ```bash
35
+ # .env
36
+
37
+ # =====================
38
+ # APPLICATION
39
+ # =====================
40
+ APP_ENV_APPLICATION_NAME=my-app
41
+ APP_ENV_APPLICATION_TIMEZONE=UTC
42
+
43
+ # =====================
44
+ # SERVER
45
+ # =====================
46
+ APP_ENV_SERVER_HOST=0.0.0.0
47
+ APP_ENV_SERVER_PORT=3000
48
+ APP_ENV_SERVER_BASE_PATH=/api
49
+
50
+ # =====================
51
+ # DATABASE (PostgreSQL)
52
+ # =====================
53
+ APP_ENV_POSTGRES_HOST=localhost
54
+ APP_ENV_POSTGRES_PORT=5432
55
+ APP_ENV_POSTGRES_USERNAME=postgres
56
+ APP_ENV_POSTGRES_PASSWORD=your_password_here
57
+ APP_ENV_POSTGRES_DATABASE=my_database
58
+
59
+ # =====================
60
+ # AUTHENTICATION
61
+ # =====================
62
+ APP_ENV_APPLICATION_SECRET=generate-a-strong-random-secret
63
+ APP_ENV_JWT_SECRET=generate-another-strong-random-secret
64
+ APP_ENV_JWT_EXPIRES_IN=86400
65
+
66
+ # =====================
67
+ # LOGGING
68
+ # =====================
69
+ APP_ENV_LOGGER_FOLDER_PATH=./logs
70
+ ```
71
+
72
+ > **Important:** Add `.env` to your `.gitignore` to prevent committing secrets.
73
+
74
+
75
+ ## Application Variables
76
+
77
+ | Variable | Required | Default | Description |
78
+ |----------|----------|---------|-------------|
79
+ | `APP_ENV_APPLICATION_NAME` | No | `APP` | Application name, used in logs and identification |
80
+ | `APP_ENV_APPLICATION_TIMEZONE` | No | `Asia/Ho_Chi_Minh` | Default timezone for date operations |
81
+ | `APP_ENV_APPLICATION_ROLES` | No | - | Comma-separated list of application roles |
82
+
83
+ ### Example
84
+
85
+ ```bash
86
+ APP_ENV_APPLICATION_NAME=ignis-backend
87
+ APP_ENV_APPLICATION_TIMEZONE=UTC
88
+ APP_ENV_APPLICATION_ROLES=api,worker
89
+ ```
90
+
91
+
92
+ ## Server Variables
93
+
94
+ | Variable | Required | Default | Description |
95
+ |----------|----------|---------|-------------|
96
+ | `APP_ENV_SERVER_HOST` | No | `localhost` | Server bind address |
97
+ | `APP_ENV_SERVER_PORT` | No | `3000` | Server port |
98
+ | `APP_ENV_SERVER_BASE_PATH` | No | `/` | Base path for all routes |
99
+ | `HOST` | No | - | Alternative to `APP_ENV_SERVER_HOST` |
100
+ | `PORT` | No | - | Alternative to `APP_ENV_SERVER_PORT` |
101
+
102
+ ### Example
103
+
104
+ ```bash
105
+ # Development
106
+ APP_ENV_SERVER_HOST=localhost
107
+ APP_ENV_SERVER_PORT=3000
108
+ APP_ENV_SERVER_BASE_PATH=/api
109
+
110
+ # Production
111
+ APP_ENV_SERVER_HOST=0.0.0.0
112
+ APP_ENV_SERVER_PORT=8080
113
+ APP_ENV_SERVER_BASE_PATH=/v1/api
114
+ ```
115
+
116
+ ### Priority Order
117
+
118
+ The server configuration uses this priority:
119
+ 1. Explicit config in `appConfigs`
120
+ 2. `APP_ENV_SERVER_*` variables
121
+ 3. `HOST`/`PORT` variables (for cloud platforms)
122
+ 4. Default values
123
+
124
+
125
+ ## Database Variables (PostgreSQL)
126
+
127
+ | Variable | Required | Default | Description |
128
+ |----------|----------|---------|-------------|
129
+ | `APP_ENV_POSTGRES_HOST` | Yes* | `localhost` | Database host |
130
+ | `APP_ENV_POSTGRES_PORT` | No | `5432` | Database port |
131
+ | `APP_ENV_POSTGRES_USERNAME` | Yes* | `postgres` | Database username |
132
+ | `APP_ENV_POSTGRES_PASSWORD` | Yes* | - | Database password |
133
+ | `APP_ENV_POSTGRES_DATABASE` | Yes* | - | Database name |
134
+ | `APP_ENV_DATASOURCE_NAME` | No | - | DataSource identifier |
135
+
136
+ *Required when using PostgreSQL DataSource.
137
+
138
+ ### Example
139
+
140
+ ```bash
141
+ # Local development
142
+ APP_ENV_POSTGRES_HOST=localhost
143
+ APP_ENV_POSTGRES_PORT=5432
144
+ APP_ENV_POSTGRES_USERNAME=postgres
145
+ APP_ENV_POSTGRES_PASSWORD=password
146
+ APP_ENV_POSTGRES_DATABASE=my_app_dev
147
+
148
+ # Production
149
+ APP_ENV_POSTGRES_HOST=db.example.com
150
+ APP_ENV_POSTGRES_PORT=5432
151
+ APP_ENV_POSTGRES_USERNAME=app_user
152
+ APP_ENV_POSTGRES_PASSWORD=strong_password_here
153
+ APP_ENV_POSTGRES_DATABASE=my_app_prod
154
+ ```
155
+
156
+ ### DataSource Configuration
157
+
158
+ ```typescript
159
+ @datasource({ driver: 'node-postgres' })
160
+ export class PostgresDataSource extends BaseDataSource {
161
+ constructor() {
162
+ super({
163
+ name: PostgresDataSource.name,
164
+ config: {
165
+ host: process.env.APP_ENV_POSTGRES_HOST ?? 'localhost',
166
+ port: +(process.env.APP_ENV_POSTGRES_PORT ?? 5432),
167
+ database: process.env.APP_ENV_POSTGRES_DATABASE ?? 'mydb',
168
+ user: process.env.APP_ENV_POSTGRES_USERNAME ?? 'postgres',
169
+ password: process.env.APP_ENV_POSTGRES_PASSWORD ?? '',
170
+ },
171
+ });
172
+ }
173
+ }
174
+ ```
175
+
176
+
177
+ ## Authentication Variables
178
+
179
+ | Variable | Required | Default | Description |
180
+ |----------|----------|---------|-------------|
181
+ | `APP_ENV_APPLICATION_SECRET` | **Yes** | - | Secret for encrypting JWT payload |
182
+ | `APP_ENV_JWT_SECRET` | **Yes** | - | Secret for signing JWT tokens |
183
+ | `APP_ENV_JWT_EXPIRES_IN` | No | `86400` | Token expiration in seconds (24h default) |
184
+
185
+ ### Security Requirements
186
+
187
+ Both `APP_ENV_APPLICATION_SECRET` and `APP_ENV_JWT_SECRET` are **mandatory** when using the authentication component. The application will fail to start if these are missing or empty.
188
+
189
+ ### Generate Strong Secrets
190
+
191
+ ```bash
192
+ # Generate random secrets
193
+ openssl rand -base64 32 # For APP_ENV_APPLICATION_SECRET
194
+ openssl rand -base64 32 # For APP_ENV_JWT_SECRET
195
+ ```
196
+
197
+ ### Example
198
+
199
+ ```bash
200
+ APP_ENV_APPLICATION_SECRET=K8sX2mP9qR4tV7wZ1aD3fG6hJ9kL2nO5
201
+ APP_ENV_JWT_SECRET=M3nB6vC9xZ2aS5dF8gH1jK4lP7oI0uY
202
+ APP_ENV_JWT_EXPIRES_IN=86400
203
+ ```
204
+
205
+ ### Common Expiration Values
206
+
207
+ | Value | Duration |
208
+ |-------|----------|
209
+ | `3600` | 1 hour |
210
+ | `86400` | 24 hours (1 day) |
211
+ | `604800` | 7 days |
212
+ | `2592000` | 30 days |
213
+
214
+
215
+ ## Logging Variables
216
+
217
+ | Variable | Required | Default | Description |
218
+ |----------|----------|---------|-------------|
219
+ | `APP_ENV_LOGGER_FOLDER_PATH` | No | `./` | Directory for log files |
220
+ | `APP_ENV_LOGGER_DGRAM_HOST` | No | - | UDP log transport host |
221
+ | `APP_ENV_LOGGER_DGRAM_PORT` | No | - | UDP log transport port |
222
+ | `APP_ENV_LOGGER_DGRAM_LABEL` | No | - | Label for UDP logs |
223
+ | `APP_ENV_LOGGER_DGRAM_LEVELS` | No | - | Comma-separated log levels for UDP |
224
+ | `APP_ENV_EXTRA_LOG_ENVS` | No | - | Extra env vars to include in logs |
225
+
226
+ ### Example
227
+
228
+ ```bash
229
+ # File logging
230
+ APP_ENV_LOGGER_FOLDER_PATH=./app_data/logs
231
+
232
+ # UDP logging (for log aggregators)
233
+ APP_ENV_LOGGER_DGRAM_HOST=127.0.0.1
234
+ APP_ENV_LOGGER_DGRAM_PORT=5000
235
+ APP_ENV_LOGGER_DGRAM_LABEL=my-app
236
+ APP_ENV_LOGGER_DGRAM_LEVELS=error,warn,info
237
+ ```
238
+
239
+
240
+ ## Storage Variables (MinIO/S3)
241
+
242
+ | Variable | Required | Default | Description |
243
+ |----------|----------|---------|-------------|
244
+ | `APP_ENV_MINIO_HOST` | Yes* | - | MinIO/S3 endpoint |
245
+ | `APP_ENV_MINIO_API_PORT` | No | `9000` | MinIO API port |
246
+ | `APP_ENV_MINIO_ACCESS_KEY` | Yes* | - | Access key |
247
+ | `APP_ENV_MINIO_SECRET_KEY` | Yes* | - | Secret key |
248
+ | `APP_ENV_MINIO_USE_SSL` | No | `false` | Enable SSL |
249
+
250
+ *Required when using StaticAsset component.
251
+
252
+ ### Example
253
+
254
+ ```bash
255
+ # Local MinIO
256
+ APP_ENV_MINIO_HOST=localhost
257
+ APP_ENV_MINIO_API_PORT=9000
258
+ APP_ENV_MINIO_ACCESS_KEY=minioadmin
259
+ APP_ENV_MINIO_SECRET_KEY=minioadmin
260
+ APP_ENV_MINIO_USE_SSL=false
261
+
262
+ # AWS S3
263
+ APP_ENV_MINIO_HOST=s3.amazonaws.com
264
+ APP_ENV_MINIO_API_PORT=443
265
+ APP_ENV_MINIO_ACCESS_KEY=AKIAIOSFODNN7EXAMPLE
266
+ APP_ENV_MINIO_SECRET_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
267
+ APP_ENV_MINIO_USE_SSL=true
268
+ ```
269
+
270
+
271
+ ## Mail Variables
272
+
273
+ | Variable | Required | Default | Description |
274
+ |----------|----------|---------|-------------|
275
+ | `APP_ENV_MAIL_HOST` | Yes* | `smtp.gmail.com` | SMTP host |
276
+ | `APP_ENV_MAIL_PORT` | No | `465` | SMTP port |
277
+ | `APP_ENV_MAIL_SECURE` | No | `true` | Use TLS |
278
+ | `APP_ENV_MAIL_USER` | Yes* | - | SMTP username/email |
279
+ | `APP_ENV_MAIL_CLIENT_ID` | Yes* | - | OAuth2 client ID |
280
+ | `APP_ENV_MAIL_CLIENT_SECRET` | Yes* | - | OAuth2 client secret |
281
+ | `APP_ENV_MAIL_REFRESH_TOKEN` | Yes* | - | OAuth2 refresh token |
282
+
283
+ *Required when using Mail component with OAuth2.
284
+
285
+ ### Example (Gmail with OAuth2)
286
+
287
+ ```bash
288
+ APP_ENV_MAIL_HOST=smtp.gmail.com
289
+ APP_ENV_MAIL_PORT=465
290
+ APP_ENV_MAIL_SECURE=true
291
+ APP_ENV_MAIL_USER=your-email@gmail.com
292
+ APP_ENV_MAIL_CLIENT_ID=your-oauth2-client-id
293
+ APP_ENV_MAIL_CLIENT_SECRET=your-oauth2-client-secret
294
+ APP_ENV_MAIL_REFRESH_TOKEN=your-oauth2-refresh-token
295
+ ```
296
+
297
+
298
+ ## DataSource Variables
299
+
300
+ | Variable | Required | Default | Description |
301
+ |----------|----------|---------|-------------|
302
+ | `APP_ENV_APPLICATION_DS_MIGRATION` | No | - | DataSource name for migrations |
303
+ | `APP_ENV_APPLICATION_DS_AUTHORIZE` | No | - | DataSource name for auth |
304
+ | `APP_ENV_APPLICATION_DS_OAUTH2` | No | - | DataSource name for OAuth2 |
305
+
306
+
307
+ ## Debug Variables
308
+
309
+ | Variable | Required | Default | Description |
310
+ |----------|----------|---------|-------------|
311
+ | `DEBUG` | No | - | Enable debug mode |
312
+ | `NODE_ENV` | No | `development` | Environment mode |
313
+ | `ALLOW_EMPTY_ENV_VALUE` | No | `false` | Allow empty env values |
314
+
315
+ ### Example
316
+
317
+ ```bash
318
+ # Development
319
+ NODE_ENV=development
320
+ DEBUG=true
321
+
322
+ # Production
323
+ NODE_ENV=production
324
+ ```
325
+
326
+
327
+ ## Environment-Specific Files
328
+
329
+ Create environment-specific `.env` files:
330
+
331
+ ```
332
+ project/
333
+ ├── .env # Default (development)
334
+ ├── .env.local # Local overrides (gitignored)
335
+ ├── .env.production # Production values
336
+ ├── .env.test # Test environment
337
+ └── .env.example # Template for team (committed)
338
+ ```
339
+
340
+ ### Loading Priority
341
+
342
+ 1. `.env.local` (highest priority, gitignored)
343
+ 2. `.env.{NODE_ENV}` (e.g., `.env.production`)
344
+ 3. `.env` (default)
345
+
346
+
347
+ ## Custom Environment Prefix
348
+
349
+ You can customize the prefix from `APP_ENV_` to something else:
350
+
351
+ ```typescript
352
+ // Set custom prefix
353
+ process.env.APPLICATION_ENV_PREFIX = 'MY_APP';
354
+
355
+ // Now use MY_APP_ prefix
356
+ // MY_APP_POSTGRES_HOST=localhost
357
+ ```
358
+
359
+
360
+ ## Validation
361
+
362
+ Ignis validates `APP_ENV_*` variables on startup. Missing required variables will cause the application to fail with a clear error message.
363
+
364
+ ### Disable Validation
365
+
366
+ ```bash
367
+ # Allow empty env values (not recommended for production)
368
+ ALLOW_EMPTY_ENV_VALUE=true
369
+ ```
370
+
371
+
372
+ ## Security Best Practices
373
+
374
+ 1. **Never commit `.env` files** - Add to `.gitignore`
375
+ 2. **Use strong secrets** - Generate with `openssl rand -base64 32`
376
+ 3. **Rotate secrets regularly** - Especially `JWT_SECRET`
377
+ 4. **Use different values per environment** - Don't reuse dev secrets in production
378
+ 5. **Use secret managers in production** - AWS Secrets Manager, HashiCorp Vault, etc.
379
+
380
+
381
+ ## Complete .env.example
382
+
383
+ ```bash
384
+ # ===========================================
385
+ # IGNIS ENVIRONMENT VARIABLES
386
+ # ===========================================
387
+ # Copy this file to .env and fill in values
388
+
389
+ # APPLICATION
390
+ APP_ENV_APPLICATION_NAME=my-app
391
+ APP_ENV_APPLICATION_TIMEZONE=UTC
392
+
393
+ # SERVER
394
+ APP_ENV_SERVER_HOST=0.0.0.0
395
+ APP_ENV_SERVER_PORT=3000
396
+ APP_ENV_SERVER_BASE_PATH=/api
397
+
398
+ # DATABASE
399
+ APP_ENV_POSTGRES_HOST=localhost
400
+ APP_ENV_POSTGRES_PORT=5432
401
+ APP_ENV_POSTGRES_USERNAME=postgres
402
+ APP_ENV_POSTGRES_PASSWORD=
403
+ APP_ENV_POSTGRES_DATABASE=
404
+
405
+ # AUTHENTICATION (Required for auth component)
406
+ APP_ENV_APPLICATION_SECRET=
407
+ APP_ENV_JWT_SECRET=
408
+ APP_ENV_JWT_EXPIRES_IN=86400
409
+
410
+ # LOGGING
411
+ APP_ENV_LOGGER_FOLDER_PATH=./logs
412
+
413
+ # STORAGE (Optional - MinIO/S3)
414
+ # APP_ENV_MINIO_HOST=localhost
415
+ # APP_ENV_MINIO_API_PORT=9000
416
+ # APP_ENV_MINIO_ACCESS_KEY=
417
+ # APP_ENV_MINIO_SECRET_KEY=
418
+ # APP_ENV_MINIO_USE_SSL=false
419
+
420
+ # MAIL (Optional)
421
+ # APP_ENV_MAIL_HOST=smtp.gmail.com
422
+ # APP_ENV_MAIL_PORT=465
423
+ # APP_ENV_MAIL_USER=
424
+ # APP_ENV_MAIL_CLIENT_ID=
425
+ # APP_ENV_MAIL_CLIENT_SECRET=
426
+ # APP_ENV_MAIL_REFRESH_TOKEN=
427
+ ```
@@ -0,0 +1,73 @@
1
+ # Configuration Reference
2
+
3
+ Configuration options and environment variables for Ignis applications.
4
+
5
+ ## Quick Reference
6
+
7
+ | Category | Purpose | Key Variables |
8
+ |----------|---------|---------------|
9
+ | Application | App identity and timezone | `APP_ENV_APPLICATION_NAME`, `APP_ENV_APPLICATION_TIMEZONE` |
10
+ | Server | HTTP server settings | `APP_ENV_SERVER_HOST`, `APP_ENV_SERVER_PORT` |
11
+ | Database | PostgreSQL connection | `APP_ENV_POSTGRES_HOST`, `APP_ENV_POSTGRES_DATABASE` |
12
+ | Authentication | JWT tokens and secrets | `APP_ENV_JWT_SECRET`, `APP_ENV_APPLICATION_SECRET` |
13
+ | Logging | Log file paths and transports | `APP_ENV_LOGGER_FOLDER_PATH` |
14
+ | Storage | MinIO/S3 file storage | `APP_ENV_MINIO_HOST`, `APP_ENV_MINIO_ACCESS_KEY` |
15
+ | Mail | SMTP email sending | `APP_ENV_MAIL_HOST`, `APP_ENV_MAIL_USER` |
16
+
17
+ ## Environment Variable Prefix
18
+
19
+ Ignis uses the `APP_ENV_` prefix to avoid conflicts with system variables:
20
+
21
+ ```bash
22
+ # ✅ Ignis variables
23
+ APP_ENV_POSTGRES_HOST=localhost
24
+
25
+ # ❌ Might conflict with system
26
+ POSTGRES_HOST=localhost
27
+ ```
28
+
29
+ ## Quick Start
30
+
31
+ Create a `.env` file in your project root:
32
+
33
+ ```bash
34
+ # .env
35
+ APP_ENV_APPLICATION_NAME=my-app
36
+ APP_ENV_SERVER_HOST=0.0.0.0
37
+ APP_ENV_SERVER_PORT=3000
38
+ APP_ENV_POSTGRES_HOST=localhost
39
+ APP_ENV_POSTGRES_DATABASE=my_database
40
+ ```
41
+
42
+ ## What's in This Section
43
+
44
+ - [Environment Variables](./environment-variables.md) - Complete reference of all `APP_ENV_*` variables
45
+
46
+ ## Configuration Patterns
47
+
48
+ ### 1. Accessing Variables
49
+
50
+ ```typescript
51
+ // 1. Direct access
52
+ const host = process.env.APP_ENV_POSTGRES_HOST;
53
+
54
+ // 2. Using helper (recommended)
55
+ import { applicationEnvironment, EnvironmentKeys } from '@venizia/ignis';
56
+ const host = applicationEnvironment.get<string>(EnvironmentKeys.APP_ENV_POSTGRES_HOST);
57
+ ```
58
+
59
+ ### 2. Environment Files
60
+
61
+ ```
62
+ project/
63
+ ├── .env # Default (development)
64
+ ├── .env.local # Local overrides (gitignored)
65
+ ├── .env.production # Production values
66
+ └── .env.example # Template (committed)
67
+ ```
68
+
69
+ ### 3. Validation on Startup
70
+
71
+ Ignis validates required variables on startup. Missing values cause clear error messages.
72
+
73
+ > **Related:** [Environment Variables Reference](./environment-variables.md) | [DataSources Guide](../../guides/core-concepts/persistent/datasources)