@futdevpro/nts-dynamo 1.15.167 → 1.15.168

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 (19) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +799 -799
  3. package/build/_modules/privacy-lifecycle/_models/privacy-lifecycle-adapter.interface.d.ts +7 -0
  4. package/build/_modules/privacy-lifecycle/_models/privacy-lifecycle-adapter.interface.d.ts.map +1 -1
  5. package/build/_modules/privacy-lifecycle/_models/privacy-request-list-result.interface.d.ts +15 -0
  6. package/build/_modules/privacy-lifecycle/_models/privacy-request-list-result.interface.d.ts.map +1 -0
  7. package/build/_modules/privacy-lifecycle/_models/privacy-request-list-result.interface.js +3 -0
  8. package/build/_modules/privacy-lifecycle/_models/privacy-request-list-result.interface.js.map +1 -0
  9. package/build/_modules/privacy-lifecycle/_models/privacy-request-list.interface.d.ts +17 -0
  10. package/build/_modules/privacy-lifecycle/_models/privacy-request-list.interface.d.ts.map +1 -0
  11. package/build/_modules/privacy-lifecycle/_models/privacy-request-list.interface.js +3 -0
  12. package/build/_modules/privacy-lifecycle/_models/privacy-request-list.interface.js.map +1 -0
  13. package/build/_modules/privacy-lifecycle/index.d.ts +2 -0
  14. package/build/_modules/privacy-lifecycle/index.d.ts.map +1 -1
  15. package/build/_modules/privacy-lifecycle/privacy-lifecycle.control-service.d.ts +7 -0
  16. package/build/_modules/privacy-lifecycle/privacy-lifecycle.control-service.d.ts.map +1 -1
  17. package/build/_modules/privacy-lifecycle/privacy-lifecycle.control-service.js +64 -0
  18. package/build/_modules/privacy-lifecycle/privacy-lifecycle.control-service.js.map +1 -1
  19. package/package.json +1 -1
package/README.md CHANGED
@@ -1,799 +1,799 @@
1
- # Dynamo-NTS
2
-
3
- ![Dynamo-NTS Logo](src/_assets/dynamo-nts-logo-256.png)
4
-
5
- **Dynamo-NTS** (NodeTS) is a comprehensive backend framework for building robust, secure, and scalable Node.js applications with TypeScript. Built on top of [Dynamo FSM](https://www.npmjs.com/package/@futdevpro/fsm-dynamo) (`@futdevpro/fsm-dynamo`), it provides a structured approach to server-side development with clear separation of concerns, extensive configuration options, and production-ready implementations for common backend tasks.
6
-
7
- Dynamo-NTS uses **[Dynamo FSM](https://www.npmjs.com/package/@futdevpro/fsm-dynamo)** as its foundational layer, implementing the server-side components of the FSM architecture. All core interfaces, types, and utilities are provided by FSM, ensuring consistency and type safety across the entire Dynamo ecosystem.
8
-
9
- Dynamo-NTS is part of the unified **Dynamo ecosystem**, a full-stack development framework designed to accelerate the development of scalable web applications. The ecosystem consists of interconnected packages that work together seamlessly, with Dynamo-NTS serving as the backend implementation layer. The frontend counterpart is **[Dynamo NGX](https://www.npmjs.com/package/@futdevpro/ngx-dynamo)**, which uses **[Dynamo NGX Models](https://www.npmjs.com/package/@futdevpro/ngx-dynamo-models)** for type-safe model definitions.
10
-
11
- ### Design Philosophy
12
-
13
- Dynamo-NTS is built with two key principles:
14
-
15
- - **Full Override Capability**: Every component, service, and class can be overridden or extended. The framework provides a solid foundation with sensible defaults, but you have complete control to customize or replace any part to fit your specific needs. This makes Dynamo-NTS highly customizable and adaptable to any project requirements.
16
-
17
- - **Complete Type Information**: All types, interfaces, and definitions are included in the compiled output. This ensures excellent readability and maintainability—everything you need is available at compile time through TypeScript's type system, providing full IntelliSense support and eliminating the need to reference external documentation during development.
18
-
19
- ### Simplified System Definitions
20
-
21
- Dynamo-NTS simplifies complex system definitions by abstracting common backend infrastructure into simple parameterization. Instead of manually configuring various libraries and services, you define your application through straightforward parameter objects:
22
-
23
- - **Express Usage**: HTTP/HTTPS server setup, routing, middleware, and error handling are configured through `DyNTS_App_Params`, `DyNTS_Http_Settings`, and `DyNTS_RoutingModule` parameters (simplifies Express server initialization and route management)
24
- - **MongoDB/Mongoose Usage**: Database connections, models, schemas, and operations are managed through `DyNTS_DBService` and `DyNTS_DataService` with simple data model parameter definitions (simplifies Mongoose schema creation and model management)
25
- - **Socket.io Usage**: Real-time communication setup, event handling, and presence tracking are configured through `DyNTS_SocketServerService` parameters and the `DyNTS_AppExtended` class (simplifies Socket.io server initialization and event management)
26
- - **Nodemailer Usage**: Email sending with templating, attachments, and async delivery is handled through `DyNTS_EmailService` with template component definitions (simplifies Nodemailer transporter setup and email template management)
27
- - **OAuth2 Implementation**: Complete OAuth2.0 protocol flows including authorization codes, token exchange, and refresh tokens are managed through `DyNTS_OAuth2_Controller` and `DyNTS_OAuth2_AuthService` (simplifies complex OAuth2 flow implementation)
28
- - **Axios Usage**: HTTP client requests to external APIs are standardized through `DyNTS_ApiService` with `DyNTS_ApiCall_Params` configuration (simplifies Axios request setup, error handling, and response management)
29
- - **Discord.js / Slack / Teams Bot Development**: Platform-agnostic bot framework through `DyNTS_Bot_MessagingProvider_ServiceBase` and bot modules (simplifies Discord.js, Slack, and Teams bot development with unified interfaces)
30
- - **OpenAI / AI Provider Integration**: AI/LLM operations including chat, embeddings, and vector search are abstracted through `DyNTS_AI_Provider_ServiceBase` and provider implementations (simplifies OpenAI SDK usage and enables multi-provider architecture)
31
- - **Location Tracking**: Optional, local-only IP geolocation through `geoip-lite`; addresses are not sent to an external service or written to logs by Dynamo-NTS
32
-
33
- This parameterization approach eliminates boilerplate code and provides a consistent, type-safe interface for all backend operations. Instead of learning multiple library APIs and their configuration patterns, developers work with unified Dynamo-NTS parameter objects that handle the underlying complexity.
34
-
35
- ### Content-free process diagnostics
36
-
37
- `DyNTS_App` projects bootstrap failures, unhandled promise rejections, database connection/runtime failures,
38
- HTTP/HTTPS server errors, routing failures and Express fallbacks through the versioned
39
- `dynts-safe-diagnostic/1` contract before framework-owned logging or error forwarding. The public allowlist is
40
- limited to `contractVersion`, `code`, `stage`, `causeType`, `fingerprint` and `status`. Raw error messages,
41
- stacks, rejected promises, requests and database URIs are excluded. The fingerprint is derived only from the
42
- allowlisted classification, never from raw failure content.
43
-
44
- Consumers can use `DyNTS_SafeDiagnostic_ControlService.project()` when they need the same deterministic
45
- projection without logging, `report()` for safe framework logging, and `toError()` when a content-free
46
- `DyFM_Error` must cross an existing error-handler boundary. See
47
- [`__documentations/2026-08-22-content-free-process-error-boundary.md`](./__documentations/2026-08-22-content-free-process-error-boundary.md)
48
- for the normative boundary and verification matrix.
49
-
50
- ## Table of Contents
51
-
52
- - [Installation](#installation)
53
- - [Quick Start](#quick-start)
54
- - [Core Concepts](#core-concepts)
55
- - [Modules Overview](#modules-overview)
56
- - [Usage Examples](#usage-examples)
57
- - [Ecosystem Integration](#ecosystem-integration)
58
- - [API Reference](#api-reference)
59
-
60
- ## Installation
61
-
62
- Install Dynamo-NTS using pnpm (recommended) or npm:
63
-
64
- ```bash
65
- pnpm add @futdevpro/dynamo-nts
66
- # or
67
- npm install @futdevpro/dynamo-nts
68
- ```
69
-
70
- ### Peer Dependencies
71
-
72
- Dynamo-NTS requires peer dependencies that are divided into two categories: core dependencies (required for the main module) and module-specific dependencies (required only when using specific modules).
73
-
74
- #### Core Dependencies (Required)
75
-
76
- These dependencies are required for the main Dynamo-NTS functionality:
77
-
78
- - [`@futdevpro/fsm-dynamo`](https://www.npmjs.com/package/@futdevpro/fsm-dynamo) - The foundational package providing core interfaces and utilities (always required)
79
- - `express` - Web framework for Node.js (simplified through Dynamo-NTS parameterization)
80
- - `mongoose` - MongoDB object modeling (simplified through Dynamo-NTS data services)
81
- - `axios` - HTTP client (simplified through Dynamo-NTS API service)
82
- - `body-parser` - Request body parsing middleware
83
- - `dotenv` - Environment variable management
84
- - `rxjs` - Reactive programming library
85
- - `@types/express` - TypeScript types for Express
86
- - `@types/node` - TypeScript types for Node.js
87
- - `ts-node` - TypeScript execution environment
88
-
89
- Install core dependencies:
90
-
91
- ```bash
92
- pnpm add @futdevpro/fsm-dynamo express mongoose axios body-parser dotenv rxjs @types/express @types/node ts-node
93
- ```
94
-
95
- #### Module-Specific Dependencies (Optional)
96
-
97
- These dependencies are only required when using specific modules:
98
-
99
- - **Socket Module**: `socket.io` - Real-time communication (simplified through Dynamo-NTS socket services)
100
- - **Email Service**: `nodemailer` - Email sending (simplified through Dynamo-NTS email services)
101
- - **Usage Module**: `geoip-lite` and `@types/geoip-lite` - optional, local-only IP geolocation. The provider is loaded only when a lookup is requested. Without it, lookup methods return `null` and the rest of Dynamo-NTS remains usable. The supported secure `geoip-lite` line requires Node.js 24 or newer.
102
- - **Bot Module (Discord)**: `discord.js` - Discord bot development (simplified through Dynamo-NTS bot module)
103
- - **AI Module (OpenAI)**: `openai` - OpenAI API integration (simplified through Dynamo-NTS AI module)
104
-
105
- The GeoIP lookup itself does not transmit or log an address. Calling the Usage module can persist the
106
- request address and derived location in the consumer's own data store. Consumers enabling that capability
107
- must define the applicable lawful basis, user-facing transparency, access controls, retention and deletion.
108
-
109
- Install module-specific dependencies as needed:
110
-
111
- ```bash
112
- # For Socket module
113
- pnpm add socket.io
114
-
115
- # For Email service
116
- pnpm add nodemailer
117
-
118
- # For Usage module
119
- pnpm add geoip-lite@^2.0.3 @types/geoip-lite@^1.4.4
120
-
121
- # For Bot module (Discord)
122
- pnpm add discord.js
123
-
124
- # For AI module (OpenAI)
125
- pnpm add openai
126
- ```
127
-
128
- ## Quick Start
129
-
130
- The following example demonstrates how to set up a basic Dynamo-NTS application with routing and socket support:
131
-
132
- ```typescript
133
- import {
134
- DyNTS_AppExtended,
135
- DyNTS_App_Params,
136
- DyNTS_GlobalService_Settings,
137
- DyNTS_Http_Settings,
138
- DyNTS_RoutingModule
139
- } from '@futdevpro/nts-dynamo';
140
- import {
141
- DyNTS_SocketServerService
142
- } from '@futdevpro/nts-dynamo/socket';
143
- import { DyFM_usageSession_dataParams } from '@futdevpro/fsm-dynamo/usage';
144
- import { DyFM_customData_dataParams } from '@futdevpro/fsm-dynamo/custom-data';
145
- import { DyNTS_getUsageRoutingModule } from '@futdevpro/nts-dynamo/usage';
146
- import { DyNTS_getTestRoutingModule } from '@futdevpro/nts-dynamo/test';
147
-
148
- import { AuthService } from './core-services/auth.service';
149
- import { Email_ServiceCollection } from './core-services/email.service-collection';
150
- import { User_Controller } from './routes/user/user.controller';
151
- import { Chat_SocketServerService } from './socket-services/chat.socket-server-service';
152
-
153
- export class App extends DyNTS_AppExtended {
154
-
155
- getAppParams(): DyNTS_App_Params {
156
- return new DyNTS_App_Params({
157
- name: 'My Application',
158
- version: '1.0.0',
159
- dbName: 'myapp',
160
- dbUri: process.env.MONGO_URL || 'mongodb://localhost:27017/myapp',
161
- systemShortCodeName: 'MYAPP',
162
- });
163
- }
164
-
165
- getGlobalServiceCollection(): DyNTS_GlobalService_Settings {
166
- return {
167
- authService: AuthService.getInstance(),
168
- emailServiceCollection: Email_ServiceCollection.getInstance(),
169
- dbModels: [
170
- // Your data model parameters here
171
- DyFM_usageSession_dataParams,
172
- DyFM_customData_dataParams,
173
- ],
174
- };
175
- }
176
-
177
- getPortSettings(): DyNTS_Http_Settings {
178
- return new DyNTS_Http_Settings({
179
- httpPort: 3000,
180
- });
181
- }
182
-
183
- getRoutingModules(): DyNTS_RoutingModule[] {
184
- return [
185
- new DyNTS_RoutingModule({
186
- route: '/user',
187
- controllers: [
188
- User_Controller.getInstance(),
189
- ],
190
- }),
191
- DyNTS_getTestRoutingModule(),
192
- DyNTS_getUsageRoutingModule(),
193
- ];
194
- }
195
-
196
- getSocketServices(): DyNTS_SocketServerService<any>[] {
197
- return [
198
- Chat_SocketServerService.getInstance(),
199
- ];
200
- }
201
- }
202
-
203
- // Start the application
204
- const app = new App();
205
- ```
206
-
207
- ## Core Concepts
208
-
209
- Dynamo-NTS uses [Dynamo FSM](https://www.npmjs.com/package/@futdevpro/fsm-dynamo) as its foundation, implementing all server-side components defined in the FSM architecture. All types, interfaces, and base models are provided by FSM, ensuring full type safety and consistency.
210
-
211
- ### Extensibility and Customization
212
-
213
- Dynamo-NTS is designed with extensibility in mind. Every component, service, and class can be overridden or extended to meet your specific requirements:
214
-
215
- - **Service Override**: All services (authentication, email, data services, etc.) can be extended or completely replaced with custom implementations
216
- - **Method Override**: Abstract methods in base classes allow you to customize behavior while maintaining the framework structure
217
- - **Configuration Override**: Global settings, route security, and application parameters can be overridden at any level
218
- - **Type Safety**: All overrides maintain full TypeScript type safety, with all types and interfaces available at compile time
219
-
220
- This design philosophy ensures that Dynamo-NTS provides a solid foundation while remaining fully customizable for your specific use cases.
221
-
222
- ### Complete Type Information
223
-
224
- All types, interfaces, and definitions are included in the compiled output, ensuring excellent readability and maintainability. When you compile your project, you have access to:
225
-
226
- - Complete type definitions for all services, models, and interfaces
227
- - Full IntelliSense support in your IDE
228
- - Compile-time type checking for all framework components
229
- - Self-documenting code through TypeScript's type system
230
-
231
- This approach eliminates the need to reference external documentation during development—everything you need is available in your IDE's autocomplete and type hints.
232
-
233
- ### Application Classes
234
-
235
- Dynamo-NTS provides two main application base classes that simplify Express server setup:
236
-
237
- - **`DyNTS_App`**: Basic application class for standard HTTP server applications without real-time socket support
238
- - **`DyNTS_AppExtended`**: Extended application class that includes built-in socket server capabilities for real-time communication (simplifies Socket.io setup)
239
-
240
- Both classes abstract away Express server configuration, requiring you to implement several abstract methods with simple parameter objects:
241
-
242
- - `getAppParams()`: Define application parameters (name, version, database name, etc.) - replaces Express app initialization
243
- - `getGlobalServiceCollection()`: Configure global services (authentication, email, database models) - replaces manual service registration
244
- - `getPortSettings()`: Configure HTTP/HTTPS ports - replaces Express server.listen() configuration
245
- - `getRoutingModules()`: Define API routes and controllers - replaces Express router setup
246
-
247
- ### Data Services
248
-
249
- Data services provide a structured way to interact with MongoDB, simplifying Mongoose model and schema definitions:
250
-
251
- - **`DyNTS_DBService<T>`**: Low-level MongoDB service for direct database operations (simplifies Mongoose model creation)
252
- - **`DyNTS_DataService<T>`**: High-level data service with business logic, validation, and dependency management (simplifies MongoDB CRUD operations)
253
- - **`DyNTS_ArchiveDataService<T>`**: Service for managing archived data in separate collections
254
-
255
- Instead of manually creating Mongoose schemas and models, you define data models through `DyFM_DataModel_Params` (from FSM), and Dynamo-NTS handles schema generation, model creation, and connection management automatically. Data services handle CRUD operations, data validation, dependency tracking, and provide methods for searching, filtering, and managing data relationships.
256
-
257
- ### Atomic MongoDB transactions
258
-
259
- `DyNTS_MongoTransaction_ControlService` is the shared Bedrock entry point for business operations that must
260
- commit several MongoDB writes as one unit. The callback receives the same Mongoose `ClientSession` that must
261
- be attached to every participating query or write:
262
-
263
- ```typescript
264
- import { ClientSession } from 'mongoose';
265
-
266
- import { DyNTS_MongoTransaction_ControlService } from '@futdevpro/nts-dynamo';
267
-
268
- const transactionService: DyNTS_MongoTransaction_ControlService =
269
- DyNTS_MongoTransaction_ControlService.getInstance();
270
-
271
- const pipelineId: string = await transactionService.execute<string>({
272
- transactionName: 'publish-pipeline-version',
273
- issuer: 'pipeline-persistence-service',
274
- maxCommitTimeMs: 3_000,
275
- task: async (session: ClientSession): Promise<string> => {
276
- // Every MongoDB operation in this callback must use `session`.
277
- // Example: await model.updateOne(filter, update, { session: session });
278
- // Example: await auditModel.create([ event ], { session: session });
279
- return 'pipeline-id';
280
- },
281
- });
282
- ```
283
-
284
- The service uses snapshot reads, majority writes and primary routing, always closes the session, and emits
285
- stable content-free error codes. MongoDB transactions require a replica set or sharded deployment; a standalone
286
- MongoDB instance is intentionally not treated as transaction-capable. Mongoose may retry the callback after a
287
- transient transaction error, so the callback must not perform non-transactional side effects such as sending
288
- messages or mutating external systems.
289
-
290
- ### Routing System
291
-
292
- The routing system provides a structured approach to defining RESTful API endpoints, simplifying Express router configuration:
293
-
294
- - **`DyNTS_RoutingModule`**: Groups related controllers under a common route path (replaces Express Router setup)
295
- - **`DyNTS_Controller`**: Abstract base class for defining HTTP endpoints (simplifies Express route handlers)
296
- - **`DyNTS_Endpoint_Params`**: Configuration for individual API endpoints (replaces Express route definitions)
297
-
298
- Instead of manually setting up Express routers and route handlers, you define endpoints through parameter objects. Controllers define endpoints with support for:
299
- - Multiple HTTP methods (GET, POST, PUT, PATCH, DELETE)
300
- - Pre-processing middleware (authentication, validation)
301
- - Task functions for handling requests
302
- - Route security levels (open, secure, both)
303
-
304
- ### Global Services
305
-
306
- The `DyNTS_GlobalService` provides centralized access to:
307
-
308
- - Authentication service
309
- - Email service collection
310
- - Database models registry
311
- - Error handlers
312
- - Socket server instances
313
-
314
- ### Authentication
315
-
316
- Dynamo-NTS provides an abstract `DyNTS_AuthService` class that you can extend to implement your authentication logic. The framework supports:
317
-
318
- - Token-based authentication
319
- - OAuth2 flows (via the OAuth2 module)
320
- - Session management
321
- - Route-level security configuration
322
-
323
- For product-local accounts, the optional `@futdevpro/nts-dynamo/account-security` entry point adds production
324
- security primitives without coupling a product to a shared account provider:
325
-
326
- - versioned adaptive password hashing and rehash detection;
327
- - hash-only email-verification and password-reset challenges with atomic one-time consumption;
328
- - opaque, hash-only access credentials backed by revocable server-side sessions;
329
- - one-time refresh rotation, replay detection, session listing and subject-wide revocation.
330
-
331
- Persistence remains application-owned through explicit atomic adapters. Transports must never put the raw
332
- credentials in URLs, logs, analytics or durable client storage. A consuming application must also apply its
333
- rate-limit, authorization, cookie/storage and audit-redaction policy at the API boundary.
334
-
335
- ### Distributed rate limiting
336
-
337
- The `@futdevpro/nts-dynamo/rate-limit` entry point provides an atomic rate-limit boundary for HTTP services:
338
-
339
- - an exact sliding-window in-memory store for deterministic tests and explicitly single-instance development;
340
- - an application-owned shared-store contract for production deployments;
341
- - a production configuration gate that requires both shared persistence and explicit opaque subject/endpoint
342
- extractors;
343
- - validated positive limits, windows and weighted request costs with stable, content-free failures;
344
- - trusted `req.ip` as the safe local default instead of reading caller-controlled forwarding headers directly;
345
- - explicit opportunistic local cleanup with no timer, polling loop or hidden background task.
346
-
347
- Production consumers must implement the shared store with one atomic permit decision across every application
348
- instance. They must derive non-sensitive, purpose-scoped bucket identifiers and must not persist or log raw IP
349
- addresses, credentials, email addresses or other request content as rate-limit keys.
350
-
351
- ### Privacy lifecycle
352
-
353
- The optional `@futdevpro/nts-dynamo/privacy-lifecycle` entry point provides the shared machinery for standalone
354
- GDPR-capable products:
355
-
356
- - identity-gated, deadline-bearing data-subject requests;
357
- - explicit `received → identity-verified → scoped → planned → executing → verifying` processing;
358
- - deterministic product-domain contributors with resumable partial outcomes and documented retention bases;
359
- - append-only, checksummed legal acceptances;
360
- - versioned, purpose-specific consent grants and withdrawals.
361
-
362
- The Bedrock module coordinates state and evidence only. Each consuming product must register every data domain,
363
- implement hard-delete/anonymization/export behavior, and provide transaction-safe persistence. A request is
364
- never reported complete while a registered contributor has a failed outcome.
365
-
366
- ## Modules Overview
367
-
368
- Dynamo-NTS is organized into focused modules, each providing specific functionality:
369
-
370
- ### Main Module
371
-
372
- The core foundation providing essential components:
373
-
374
- - **Collections**: Archive utilities, global settings, environment configuration
375
- - **Enums**: Data model types, service functions, route security levels
376
- - **Models**: Application configuration interfaces, control models, database types
377
- - **Services**: Core services for API communication, authentication, data management, routing
378
-
379
- ### AI Module
380
-
381
- Provides abstractions and implementations for AI operations:
382
-
383
- - **Abstract Service Bases**: Base classes for AI providers, LLM services, LLM chat services, and embedding services
384
- - **OpenAI Implementation**: Complete OpenAI integration with LLM, chat, and embedding support
385
- - **Document AI**: Document chunking and preprocessing for AI models
386
- - **Vector Search**: MongoDB Atlas vector database operations with automatic data vectorization
387
-
388
- #### OpenAI-Compatible Providers
389
-
390
- The OAI service-ek (`DyNTS_OAI_LLM_ServiceBase`, `DyNTS_OAI_LLMChat_ServiceBase`, `DyNTS_OAI_Embedding_ControlService`) bármely OpenAI-API-kompatibilis endpoint-tal működnek — lokál LLM (LM Studio, Ollama), self-hosted (vLLM, LocalAI) is — a `DyFM_OAI_ClientOptions.baseURL` mező segítségével. Részletek + provider-konfig sample-ök: [`__documentations/2026-05-17-oai-compatible-providers.md`](__documentations/2026-05-17-oai-compatible-providers.md).
391
-
392
- ### Assistant Module
393
-
394
- Platform and AI provider agnostic solutions for creating intelligent assistants:
395
-
396
- - Integrates communication providers (bot) with AI providers (LLM Chat)
397
- - Message conversion utilities
398
- - Conversation management
399
- - Configurable settings for system prompts and message filtering
400
-
401
- ### Bot Module
402
-
403
- Platform-agnostic bot functionality:
404
-
405
- - Message, channel, and user wrappers for any messaging platform
406
- - Command system for bot commands
407
- - Routine system for scheduled and event-driven tasks
408
- - IO management for bot interactions
409
- - Provider support for Discord, Slack, and Teams
410
-
411
- ### Socket Module
412
-
413
- Real-time communication capabilities that simplify Socket.io setup:
414
-
415
- - Socket client and server implementations with secure and open connection options (simplifies Socket.io server initialization)
416
- - Event handling system for managing real-time communications (replaces manual Socket.io event handler setup)
417
- - Presence tracking for monitoring connected clients
418
- - Error handling and logging for reliable operation
419
- - Extended application class with built-in socket server capabilities (automatically configures Socket.io with Express server)
420
-
421
- ### Messaging Module
422
-
423
- Backend implementation for unified messaging system:
424
-
425
- - Data services for messages and conversations
426
- - Control services for business logic orchestration
427
- - Real-time socket events
428
- - RESTful HTTP endpoints
429
- - Integration with bot and assistant modules
430
-
431
- ### OAuth2 Module
432
-
433
- Complete OAuth2.0 protocol implementation:
434
-
435
- - OAuth2 authorization and token management
436
- - Client management and user authentication
437
- - Token exchange and refresh operations
438
- - Authorization code and access token generation
439
-
440
- ### Server Module
441
-
442
- Solutions for basic server endpoints:
443
-
444
- - Error handling for saving and retrieving server errors
445
- - Server status monitoring with version and uptime information
446
- - Server status snapshots for saving and retrieving status at specific times
447
- - Error statistics for monitoring and analysis
448
-
449
- #### Content-free database readiness probe
450
-
451
- Applications can perform one foreground readiness check against their own Mongoose connection without
452
- starting a timer, listener, retry loop, subscription, process hook, or background task:
453
-
454
- ```typescript
455
- import {
456
- DyNTS_DbReadinessProbe_ControlService,
457
- DyNTS_DbReadinessProbeResult_Interface,
458
- } from '@futdevpro/nts-dynamo/server';
459
-
460
- const result: DyNTS_DbReadinessProbeResult_Interface =
461
- await DyNTS_DbReadinessProbe_ControlService.probe({
462
- connection: mongoose.connection,
463
- });
464
- ```
465
-
466
- The `dynts-db-readiness/1` result contains exactly six allowlisted fields: contract version, readiness,
467
- normalized connection state, ping success, bounded stage, and stable result code. It never contains a host,
468
- database name, URI, model metadata, credentials, driver error text, or arbitrary error properties. Failures
469
- resolve to a content-free, fail-closed result and the probe writes no log output.
470
-
471
- Timeout policy and cancellation are caller-owned. The probe observes the supplied `AbortSignal` before and
472
- after its single ping, but it does not create a timeout or interrupt an already-running driver operation.
473
- Configure the driver's operation timeout and abort the supplied signal at the application boundary.
474
-
475
- ### Defaults Module
476
-
477
- Default implementations for common services:
478
-
479
- - Default user data model and service for authentication and user management
480
- - Default authentication service with basic token-based authentication
481
- - Default socket events service with graceful degradation
482
- - All services can be extended or replaced with custom implementations
483
-
484
- ### Custom Data Module
485
-
486
- Tools for managing custom data:
487
-
488
- - Data service for handling custom data operations with optional initialization
489
- - Controller with RESTful endpoints for data operations
490
- - GET endpoint for retrieving custom data by ID
491
- - POST endpoint for modifying custom data
492
- - Configurable routing module with optional security overrides
493
-
494
- ### Test Module
495
-
496
- Testing and monitoring tools:
497
-
498
- - Test endpoints for different HTTP methods (GET, POST, DELETE)
499
- - Server status endpoint with version and uptime information
500
- - Configurable routing module with security override options
501
- - Automatic controller registration for easy setup
502
-
503
- ### Usage Module
504
-
505
- Session and usage tracking tools:
506
-
507
- - Session management tools for creating, updating, and closing sessions
508
- - Usage data collection and analysis tools
509
- - Location tracking from HTTP requests
510
- - Usage statistics retrieval with time range filtering
511
- - Daily usage statistics calculation
512
-
513
- ## Usage Examples
514
-
515
- ### Basic Application Setup
516
-
517
- This example shows a complete application setup using `DyNTS_AppExtended`:
518
-
519
- ```typescript
520
- import {
521
- DyNTS_AppExtended,
522
- DyNTS_App_Params,
523
- DyNTS_GlobalService_Settings,
524
- DyNTS_Http_Settings,
525
- DyNTS_RoutingModule
526
- } from '@futdevpro/nts-dynamo';
527
- import { DyNTS_SocketServerService } from '@futdevpro/nts-dynamo/socket';
528
-
529
- export class App extends DyNTS_AppExtended {
530
-
531
- getAppParams(): DyNTS_App_Params {
532
- return new DyNTS_App_Params({
533
- name: 'My Server',
534
- version: '1.0.0',
535
- dbName: 'myapp',
536
- });
537
- }
538
-
539
- getGlobalServiceCollection(): DyNTS_GlobalService_Settings {
540
- return {
541
- authService: AuthService.getInstance(),
542
- dbModels: [
543
- // Your data models
544
- ],
545
- };
546
- }
547
-
548
- getPortSettings(): DyNTS_Http_Settings {
549
- return new DyNTS_Http_Settings({
550
- httpPort: 3000,
551
- });
552
- }
553
-
554
- getRoutingModules(): DyNTS_RoutingModule[] {
555
- return [
556
- new DyNTS_RoutingModule({
557
- route: '/api',
558
- controllers: [
559
- MyController.getInstance(),
560
- ],
561
- }),
562
- ];
563
- }
564
-
565
- getSocketServices(): DyNTS_SocketServerService<any>[] {
566
- return [
567
- MySocketService.getInstance(),
568
- ];
569
- }
570
- }
571
- ```
572
-
573
- ### Routing Module Configuration
574
-
575
- Multiple routing modules can be configured to organize your API:
576
-
577
- ```typescript
578
- getRoutingModules(): DyNTS_RoutingModule[] {
579
- return [
580
- new DyNTS_RoutingModule({
581
- route: '/user',
582
- controllers: [
583
- User_Controller.getInstance(),
584
- UserData_Controller.getInstance(),
585
- UserSettings_Controller.getInstance(),
586
- ],
587
- }),
588
- new DyNTS_RoutingModule({
589
- route: '/project',
590
- controllers: [
591
- Project_Controller.getInstance(),
592
- ProjectExtension_Controller.getInstance(),
593
- ],
594
- }),
595
- new DyNTS_RoutingModule({
596
- route: '/server',
597
- controllers: [
598
- ServerStatus_Controller.getInstance(),
599
- ],
600
- }),
601
- DyNTS_getTestRoutingModule(),
602
- DyNTS_getUsageRoutingModule(),
603
- ];
604
- }
605
- ```
606
-
607
- ### Controller Implementation
608
-
609
- Controllers define API endpoints with authentication and business logic:
610
-
611
- ```typescript
612
- import { Request, Response } from 'express';
613
- import { DyNTS_Controller, DyNTS_Endpoint_Params } from '@futdevpro/nts-dynamo';
614
- import { DyFM_HttpCallType } from '@futdevpro/fsm-dynamo';
615
-
616
- export class User_Controller extends DyNTS_Controller {
617
-
618
- static getInstance(): User_Controller {
619
- return User_Controller.getSingletonInstance();
620
- }
621
-
622
- private authService: AuthService = AuthService.getInstance();
623
-
624
- setupEndpoints(): void {
625
- this.endpoints = [
626
- new DyNTS_Endpoint_Params({
627
- name: 'getUser',
628
- type: DyFM_HttpCallType.get,
629
- endpoint: '/get/:userId',
630
- preProcesses: [this.authService.authenticate_tokenSelf],
631
- tasks: [
632
- async (req: Request, res: Response, issuer: string): Promise<void> => {
633
- const userService = new User_DataService({ issuer });
634
- await userService.getDataById(req.params.userId);
635
- res.send(userService.data);
636
- },
637
- ],
638
- }),
639
- new DyNTS_Endpoint_Params({
640
- name: 'updateUser',
641
- type: DyFM_HttpCallType.post,
642
- endpoint: '/update',
643
- preProcesses: [this.authService.authenticate_tokenSelf],
644
- tasks: [
645
- async (req: Request, res: Response, issuer: string): Promise<void> => {
646
- const userService = new User_DataService({ issuer });
647
- await userService.saveData(req.body);
648
- res.send(userService.data);
649
- },
650
- ],
651
- }),
652
- ];
653
- }
654
- }
655
- ```
656
-
657
- ### Data Service Implementation
658
-
659
- Data services provide a structured way to interact with MongoDB:
660
-
661
- ```typescript
662
- import { DyNTS_DataService } from '@futdevpro/nts-dynamo';
663
- import { DyFM_DataModel_Params } from '@futdevpro/fsm-dynamo'; // FSM provides the data model parameter definition
664
-
665
- // Define your data model parameters
666
- const userDataParams: DyFM_DataModel_Params<UserData> = new DyFM_DataModel_Params({
667
- dataName: 'userData',
668
- typeSample: {
669
- userId: '',
670
- preferences: {},
671
- },
672
- // ... additional configuration
673
- });
674
-
675
- export class User_DataService extends DyNTS_DataService<UserData> {
676
- constructor(params: { issuer: string }) {
677
- super(userDataParams);
678
- this.issuer = params.issuer;
679
- }
680
-
681
- // Custom business logic methods
682
- async getUserPreferences(userId: string): Promise<UserPreferences> {
683
- await this.getDataByDependencyId({ userId });
684
- return this.data?.preferences || {};
685
- }
686
- }
687
- ```
688
-
689
- ### Socket Server Service
690
-
691
- Socket services enable real-time communication:
692
-
693
- ```typescript
694
- import { DyNTS_SocketServerService, DyNTS_SocketPresence } from '@futdevpro/nts-dynamo/socket';
695
-
696
- export class Chat_SocketServerService extends DyNTS_SocketServerService<DyNTS_SocketPresence, any> {
697
-
698
- static getInstance(): Chat_SocketServerService {
699
- return Chat_SocketServerService.getSingletonInstance();
700
- }
701
-
702
- protected setupSocketEvents(): void {
703
- this.socketServer.on('connection', (socket) => {
704
- socket.on('joinRoom', (roomId: string) => {
705
- socket.join(roomId);
706
- });
707
-
708
- socket.on('sendMessage', async (data: { roomId: string; message: string }) => {
709
- this.socketServer.to(data.roomId).emit('newMessage', data);
710
- });
711
- });
712
- }
713
- }
714
- ```
715
-
716
- ### Vector Search with AI
717
-
718
- Dynamo-NTS provides built-in support for MongoDB Atlas vector search with automatic vectorization:
719
-
720
- ```typescript
721
- import { DyNTS_OAI_VectorDataService } from '@futdevpro/nts-dynamo/ai/open-ai';
722
-
723
- export class Knowledge_DataService extends DyNTS_OAI_VectorDataService<Knowledge> {
724
-
725
- constructor() {
726
- super(knowledgeDataParams);
727
- }
728
-
729
- async searchSimilarContent(query: string, limit: number = 10): Promise<Knowledge[]> {
730
- return await this.vectorSearch({
731
- input: query,
732
- searchInKey: 'content', // Property that has vectorization enabled
733
- limit: limit,
734
- numberOfCandidates: 100,
735
- });
736
- }
737
- }
738
- ```
739
-
740
- The vector search automatically:
741
- - Creates embeddings for search queries using the configured AI provider
742
- - Performs semantic search in MongoDB Atlas vector database
743
- - Returns results sorted by relevance
744
- - Supports filtering with additional MongoDB queries
745
-
746
- ## Ecosystem Integration
747
-
748
- Dynamo-NTS is part of the unified **Dynamo ecosystem**, which consists of several interconnected packages:
749
-
750
- ### Dynamo FSM (Full Stack Module)
751
-
752
- The foundational package [`@futdevpro/fsm-dynamo`](https://www.npmjs.com/package/@futdevpro/fsm-dynamo) that provides:
753
- - Core interfaces and types shared across the ecosystem
754
- - Base model definitions (used by all Dynamo-NTS data services)
755
- - Utility functions
756
- - Type definitions for system-wide use
757
- - Data model parameter definitions (`DyFM_DataModel_Params`)
758
-
759
- Dynamo-NTS is built on top of Dynamo FSM and implements the server-side components of the FSM architecture. All data models, interfaces, and type definitions used in Dynamo-NTS are provided by FSM, ensuring consistency and type safety across the entire ecosystem.
760
-
761
- ### Dynamo NGX (AngularX)
762
-
763
- The frontend counterpart [`@futdevpro/dynamo-ngx`](https://www.npmjs.com/package/@futdevpro/dynamo-ngx) provides:
764
- - Angular components and services
765
- - Frontend models that integrate with Dynamo-NTS backend (using shared FSM types)
766
- - Real-time communication clients (connects to Dynamo-NTS socket services)
767
- - Form management and data table components
768
-
769
- ### Unified Patterns
770
-
771
- The Dynamo ecosystem enforces consistent patterns across all packages:
772
-
773
- - **Naming Conventions**: Consistent prefixes (`DyNTS_` for backend, `DyNX_` for frontend, `DyFM_` for shared)
774
- - **Type Safety**: Full TypeScript support with shared type definitions
775
- - **Architecture Patterns**: Consistent service patterns, data models, and API structures
776
- - **Error Handling**: Unified error handling across the stack
777
- - **Logging**: Consistent logging patterns and utilities
778
-
779
- This unified approach ensures that:
780
- - Developers learn one set of patterns that apply everywhere
781
- - Frontend and backend code integrate seamlessly
782
- - Type safety is maintained across the entire stack
783
- - Maintenance and updates are simplified
784
-
785
- ## API Reference
786
-
787
- For detailed API documentation, see:
788
-
789
- - [Dynamo-NTS Documentation](fdp-documentations/specifications/dynamo-packages/dynamo-nts/dynamo-nts.md)
790
- - [Dynamo FSM Documentation](fdp-documentations/specifications/dynamo-packages/dynamo-fsm/dynamo-fsm.md)
791
- - [Dynamo Ecosystem Overview](fdp-documentations/specifications/dynamo-packages/dynamo_packages.md)
792
-
793
- ## License
794
-
795
- ISC
796
-
797
- ## Support
798
-
799
- For issues, questions, or contributions, please refer to the project repository.
1
+ # Dynamo-NTS
2
+
3
+ ![Dynamo-NTS Logo](src/_assets/dynamo-nts-logo-256.png)
4
+
5
+ **Dynamo-NTS** (NodeTS) is a comprehensive backend framework for building robust, secure, and scalable Node.js applications with TypeScript. Built on top of [Dynamo FSM](https://www.npmjs.com/package/@futdevpro/fsm-dynamo) (`@futdevpro/fsm-dynamo`), it provides a structured approach to server-side development with clear separation of concerns, extensive configuration options, and production-ready implementations for common backend tasks.
6
+
7
+ Dynamo-NTS uses **[Dynamo FSM](https://www.npmjs.com/package/@futdevpro/fsm-dynamo)** as its foundational layer, implementing the server-side components of the FSM architecture. All core interfaces, types, and utilities are provided by FSM, ensuring consistency and type safety across the entire Dynamo ecosystem.
8
+
9
+ Dynamo-NTS is part of the unified **Dynamo ecosystem**, a full-stack development framework designed to accelerate the development of scalable web applications. The ecosystem consists of interconnected packages that work together seamlessly, with Dynamo-NTS serving as the backend implementation layer. The frontend counterpart is **[Dynamo NGX](https://www.npmjs.com/package/@futdevpro/ngx-dynamo)**, which uses **[Dynamo NGX Models](https://www.npmjs.com/package/@futdevpro/ngx-dynamo-models)** for type-safe model definitions.
10
+
11
+ ### Design Philosophy
12
+
13
+ Dynamo-NTS is built with two key principles:
14
+
15
+ - **Full Override Capability**: Every component, service, and class can be overridden or extended. The framework provides a solid foundation with sensible defaults, but you have complete control to customize or replace any part to fit your specific needs. This makes Dynamo-NTS highly customizable and adaptable to any project requirements.
16
+
17
+ - **Complete Type Information**: All types, interfaces, and definitions are included in the compiled output. This ensures excellent readability and maintainability—everything you need is available at compile time through TypeScript's type system, providing full IntelliSense support and eliminating the need to reference external documentation during development.
18
+
19
+ ### Simplified System Definitions
20
+
21
+ Dynamo-NTS simplifies complex system definitions by abstracting common backend infrastructure into simple parameterization. Instead of manually configuring various libraries and services, you define your application through straightforward parameter objects:
22
+
23
+ - **Express Usage**: HTTP/HTTPS server setup, routing, middleware, and error handling are configured through `DyNTS_App_Params`, `DyNTS_Http_Settings`, and `DyNTS_RoutingModule` parameters (simplifies Express server initialization and route management)
24
+ - **MongoDB/Mongoose Usage**: Database connections, models, schemas, and operations are managed through `DyNTS_DBService` and `DyNTS_DataService` with simple data model parameter definitions (simplifies Mongoose schema creation and model management)
25
+ - **Socket.io Usage**: Real-time communication setup, event handling, and presence tracking are configured through `DyNTS_SocketServerService` parameters and the `DyNTS_AppExtended` class (simplifies Socket.io server initialization and event management)
26
+ - **Nodemailer Usage**: Email sending with templating, attachments, and async delivery is handled through `DyNTS_EmailService` with template component definitions (simplifies Nodemailer transporter setup and email template management)
27
+ - **OAuth2 Implementation**: Complete OAuth2.0 protocol flows including authorization codes, token exchange, and refresh tokens are managed through `DyNTS_OAuth2_Controller` and `DyNTS_OAuth2_AuthService` (simplifies complex OAuth2 flow implementation)
28
+ - **Axios Usage**: HTTP client requests to external APIs are standardized through `DyNTS_ApiService` with `DyNTS_ApiCall_Params` configuration (simplifies Axios request setup, error handling, and response management)
29
+ - **Discord.js / Slack / Teams Bot Development**: Platform-agnostic bot framework through `DyNTS_Bot_MessagingProvider_ServiceBase` and bot modules (simplifies Discord.js, Slack, and Teams bot development with unified interfaces)
30
+ - **OpenAI / AI Provider Integration**: AI/LLM operations including chat, embeddings, and vector search are abstracted through `DyNTS_AI_Provider_ServiceBase` and provider implementations (simplifies OpenAI SDK usage and enables multi-provider architecture)
31
+ - **Location Tracking**: Optional, local-only IP geolocation through `geoip-lite`; addresses are not sent to an external service or written to logs by Dynamo-NTS
32
+
33
+ This parameterization approach eliminates boilerplate code and provides a consistent, type-safe interface for all backend operations. Instead of learning multiple library APIs and their configuration patterns, developers work with unified Dynamo-NTS parameter objects that handle the underlying complexity.
34
+
35
+ ### Content-free process diagnostics
36
+
37
+ `DyNTS_App` projects bootstrap failures, unhandled promise rejections, database connection/runtime failures,
38
+ HTTP/HTTPS server errors, routing failures and Express fallbacks through the versioned
39
+ `dynts-safe-diagnostic/1` contract before framework-owned logging or error forwarding. The public allowlist is
40
+ limited to `contractVersion`, `code`, `stage`, `causeType`, `fingerprint` and `status`. Raw error messages,
41
+ stacks, rejected promises, requests and database URIs are excluded. The fingerprint is derived only from the
42
+ allowlisted classification, never from raw failure content.
43
+
44
+ Consumers can use `DyNTS_SafeDiagnostic_ControlService.project()` when they need the same deterministic
45
+ projection without logging, `report()` for safe framework logging, and `toError()` when a content-free
46
+ `DyFM_Error` must cross an existing error-handler boundary. See
47
+ [`__documentations/2026-08-22-content-free-process-error-boundary.md`](./__documentations/2026-08-22-content-free-process-error-boundary.md)
48
+ for the normative boundary and verification matrix.
49
+
50
+ ## Table of Contents
51
+
52
+ - [Installation](#installation)
53
+ - [Quick Start](#quick-start)
54
+ - [Core Concepts](#core-concepts)
55
+ - [Modules Overview](#modules-overview)
56
+ - [Usage Examples](#usage-examples)
57
+ - [Ecosystem Integration](#ecosystem-integration)
58
+ - [API Reference](#api-reference)
59
+
60
+ ## Installation
61
+
62
+ Install Dynamo-NTS using pnpm (recommended) or npm:
63
+
64
+ ```bash
65
+ pnpm add @futdevpro/dynamo-nts
66
+ # or
67
+ npm install @futdevpro/dynamo-nts
68
+ ```
69
+
70
+ ### Peer Dependencies
71
+
72
+ Dynamo-NTS requires peer dependencies that are divided into two categories: core dependencies (required for the main module) and module-specific dependencies (required only when using specific modules).
73
+
74
+ #### Core Dependencies (Required)
75
+
76
+ These dependencies are required for the main Dynamo-NTS functionality:
77
+
78
+ - [`@futdevpro/fsm-dynamo`](https://www.npmjs.com/package/@futdevpro/fsm-dynamo) - The foundational package providing core interfaces and utilities (always required)
79
+ - `express` - Web framework for Node.js (simplified through Dynamo-NTS parameterization)
80
+ - `mongoose` - MongoDB object modeling (simplified through Dynamo-NTS data services)
81
+ - `axios` - HTTP client (simplified through Dynamo-NTS API service)
82
+ - `body-parser` - Request body parsing middleware
83
+ - `dotenv` - Environment variable management
84
+ - `rxjs` - Reactive programming library
85
+ - `@types/express` - TypeScript types for Express
86
+ - `@types/node` - TypeScript types for Node.js
87
+ - `ts-node` - TypeScript execution environment
88
+
89
+ Install core dependencies:
90
+
91
+ ```bash
92
+ pnpm add @futdevpro/fsm-dynamo express mongoose axios body-parser dotenv rxjs @types/express @types/node ts-node
93
+ ```
94
+
95
+ #### Module-Specific Dependencies (Optional)
96
+
97
+ These dependencies are only required when using specific modules:
98
+
99
+ - **Socket Module**: `socket.io` - Real-time communication (simplified through Dynamo-NTS socket services)
100
+ - **Email Service**: `nodemailer` - Email sending (simplified through Dynamo-NTS email services)
101
+ - **Usage Module**: `geoip-lite` and `@types/geoip-lite` - optional, local-only IP geolocation. The provider is loaded only when a lookup is requested. Without it, lookup methods return `null` and the rest of Dynamo-NTS remains usable. The supported secure `geoip-lite` line requires Node.js 24 or newer.
102
+ - **Bot Module (Discord)**: `discord.js` - Discord bot development (simplified through Dynamo-NTS bot module)
103
+ - **AI Module (OpenAI)**: `openai` - OpenAI API integration (simplified through Dynamo-NTS AI module)
104
+
105
+ The GeoIP lookup itself does not transmit or log an address. Calling the Usage module can persist the
106
+ request address and derived location in the consumer's own data store. Consumers enabling that capability
107
+ must define the applicable lawful basis, user-facing transparency, access controls, retention and deletion.
108
+
109
+ Install module-specific dependencies as needed:
110
+
111
+ ```bash
112
+ # For Socket module
113
+ pnpm add socket.io
114
+
115
+ # For Email service
116
+ pnpm add nodemailer
117
+
118
+ # For Usage module
119
+ pnpm add geoip-lite@^2.0.3 @types/geoip-lite@^1.4.4
120
+
121
+ # For Bot module (Discord)
122
+ pnpm add discord.js
123
+
124
+ # For AI module (OpenAI)
125
+ pnpm add openai
126
+ ```
127
+
128
+ ## Quick Start
129
+
130
+ The following example demonstrates how to set up a basic Dynamo-NTS application with routing and socket support:
131
+
132
+ ```typescript
133
+ import {
134
+ DyNTS_AppExtended,
135
+ DyNTS_App_Params,
136
+ DyNTS_GlobalService_Settings,
137
+ DyNTS_Http_Settings,
138
+ DyNTS_RoutingModule
139
+ } from '@futdevpro/nts-dynamo';
140
+ import {
141
+ DyNTS_SocketServerService
142
+ } from '@futdevpro/nts-dynamo/socket';
143
+ import { DyFM_usageSession_dataParams } from '@futdevpro/fsm-dynamo/usage';
144
+ import { DyFM_customData_dataParams } from '@futdevpro/fsm-dynamo/custom-data';
145
+ import { DyNTS_getUsageRoutingModule } from '@futdevpro/nts-dynamo/usage';
146
+ import { DyNTS_getTestRoutingModule } from '@futdevpro/nts-dynamo/test';
147
+
148
+ import { AuthService } from './core-services/auth.service';
149
+ import { Email_ServiceCollection } from './core-services/email.service-collection';
150
+ import { User_Controller } from './routes/user/user.controller';
151
+ import { Chat_SocketServerService } from './socket-services/chat.socket-server-service';
152
+
153
+ export class App extends DyNTS_AppExtended {
154
+
155
+ getAppParams(): DyNTS_App_Params {
156
+ return new DyNTS_App_Params({
157
+ name: 'My Application',
158
+ version: '1.0.0',
159
+ dbName: 'myapp',
160
+ dbUri: process.env.MONGO_URL || 'mongodb://localhost:27017/myapp',
161
+ systemShortCodeName: 'MYAPP',
162
+ });
163
+ }
164
+
165
+ getGlobalServiceCollection(): DyNTS_GlobalService_Settings {
166
+ return {
167
+ authService: AuthService.getInstance(),
168
+ emailServiceCollection: Email_ServiceCollection.getInstance(),
169
+ dbModels: [
170
+ // Your data model parameters here
171
+ DyFM_usageSession_dataParams,
172
+ DyFM_customData_dataParams,
173
+ ],
174
+ };
175
+ }
176
+
177
+ getPortSettings(): DyNTS_Http_Settings {
178
+ return new DyNTS_Http_Settings({
179
+ httpPort: 3000,
180
+ });
181
+ }
182
+
183
+ getRoutingModules(): DyNTS_RoutingModule[] {
184
+ return [
185
+ new DyNTS_RoutingModule({
186
+ route: '/user',
187
+ controllers: [
188
+ User_Controller.getInstance(),
189
+ ],
190
+ }),
191
+ DyNTS_getTestRoutingModule(),
192
+ DyNTS_getUsageRoutingModule(),
193
+ ];
194
+ }
195
+
196
+ getSocketServices(): DyNTS_SocketServerService<any>[] {
197
+ return [
198
+ Chat_SocketServerService.getInstance(),
199
+ ];
200
+ }
201
+ }
202
+
203
+ // Start the application
204
+ const app = new App();
205
+ ```
206
+
207
+ ## Core Concepts
208
+
209
+ Dynamo-NTS uses [Dynamo FSM](https://www.npmjs.com/package/@futdevpro/fsm-dynamo) as its foundation, implementing all server-side components defined in the FSM architecture. All types, interfaces, and base models are provided by FSM, ensuring full type safety and consistency.
210
+
211
+ ### Extensibility and Customization
212
+
213
+ Dynamo-NTS is designed with extensibility in mind. Every component, service, and class can be overridden or extended to meet your specific requirements:
214
+
215
+ - **Service Override**: All services (authentication, email, data services, etc.) can be extended or completely replaced with custom implementations
216
+ - **Method Override**: Abstract methods in base classes allow you to customize behavior while maintaining the framework structure
217
+ - **Configuration Override**: Global settings, route security, and application parameters can be overridden at any level
218
+ - **Type Safety**: All overrides maintain full TypeScript type safety, with all types and interfaces available at compile time
219
+
220
+ This design philosophy ensures that Dynamo-NTS provides a solid foundation while remaining fully customizable for your specific use cases.
221
+
222
+ ### Complete Type Information
223
+
224
+ All types, interfaces, and definitions are included in the compiled output, ensuring excellent readability and maintainability. When you compile your project, you have access to:
225
+
226
+ - Complete type definitions for all services, models, and interfaces
227
+ - Full IntelliSense support in your IDE
228
+ - Compile-time type checking for all framework components
229
+ - Self-documenting code through TypeScript's type system
230
+
231
+ This approach eliminates the need to reference external documentation during development—everything you need is available in your IDE's autocomplete and type hints.
232
+
233
+ ### Application Classes
234
+
235
+ Dynamo-NTS provides two main application base classes that simplify Express server setup:
236
+
237
+ - **`DyNTS_App`**: Basic application class for standard HTTP server applications without real-time socket support
238
+ - **`DyNTS_AppExtended`**: Extended application class that includes built-in socket server capabilities for real-time communication (simplifies Socket.io setup)
239
+
240
+ Both classes abstract away Express server configuration, requiring you to implement several abstract methods with simple parameter objects:
241
+
242
+ - `getAppParams()`: Define application parameters (name, version, database name, etc.) - replaces Express app initialization
243
+ - `getGlobalServiceCollection()`: Configure global services (authentication, email, database models) - replaces manual service registration
244
+ - `getPortSettings()`: Configure HTTP/HTTPS ports - replaces Express server.listen() configuration
245
+ - `getRoutingModules()`: Define API routes and controllers - replaces Express router setup
246
+
247
+ ### Data Services
248
+
249
+ Data services provide a structured way to interact with MongoDB, simplifying Mongoose model and schema definitions:
250
+
251
+ - **`DyNTS_DBService<T>`**: Low-level MongoDB service for direct database operations (simplifies Mongoose model creation)
252
+ - **`DyNTS_DataService<T>`**: High-level data service with business logic, validation, and dependency management (simplifies MongoDB CRUD operations)
253
+ - **`DyNTS_ArchiveDataService<T>`**: Service for managing archived data in separate collections
254
+
255
+ Instead of manually creating Mongoose schemas and models, you define data models through `DyFM_DataModel_Params` (from FSM), and Dynamo-NTS handles schema generation, model creation, and connection management automatically. Data services handle CRUD operations, data validation, dependency tracking, and provide methods for searching, filtering, and managing data relationships.
256
+
257
+ ### Atomic MongoDB transactions
258
+
259
+ `DyNTS_MongoTransaction_ControlService` is the shared Bedrock entry point for business operations that must
260
+ commit several MongoDB writes as one unit. The callback receives the same Mongoose `ClientSession` that must
261
+ be attached to every participating query or write:
262
+
263
+ ```typescript
264
+ import { ClientSession } from 'mongoose';
265
+
266
+ import { DyNTS_MongoTransaction_ControlService } from '@futdevpro/nts-dynamo';
267
+
268
+ const transactionService: DyNTS_MongoTransaction_ControlService =
269
+ DyNTS_MongoTransaction_ControlService.getInstance();
270
+
271
+ const pipelineId: string = await transactionService.execute<string>({
272
+ transactionName: 'publish-pipeline-version',
273
+ issuer: 'pipeline-persistence-service',
274
+ maxCommitTimeMs: 3_000,
275
+ task: async (session: ClientSession): Promise<string> => {
276
+ // Every MongoDB operation in this callback must use `session`.
277
+ // Example: await model.updateOne(filter, update, { session: session });
278
+ // Example: await auditModel.create([ event ], { session: session });
279
+ return 'pipeline-id';
280
+ },
281
+ });
282
+ ```
283
+
284
+ The service uses snapshot reads, majority writes and primary routing, always closes the session, and emits
285
+ stable content-free error codes. MongoDB transactions require a replica set or sharded deployment; a standalone
286
+ MongoDB instance is intentionally not treated as transaction-capable. Mongoose may retry the callback after a
287
+ transient transaction error, so the callback must not perform non-transactional side effects such as sending
288
+ messages or mutating external systems.
289
+
290
+ ### Routing System
291
+
292
+ The routing system provides a structured approach to defining RESTful API endpoints, simplifying Express router configuration:
293
+
294
+ - **`DyNTS_RoutingModule`**: Groups related controllers under a common route path (replaces Express Router setup)
295
+ - **`DyNTS_Controller`**: Abstract base class for defining HTTP endpoints (simplifies Express route handlers)
296
+ - **`DyNTS_Endpoint_Params`**: Configuration for individual API endpoints (replaces Express route definitions)
297
+
298
+ Instead of manually setting up Express routers and route handlers, you define endpoints through parameter objects. Controllers define endpoints with support for:
299
+ - Multiple HTTP methods (GET, POST, PUT, PATCH, DELETE)
300
+ - Pre-processing middleware (authentication, validation)
301
+ - Task functions for handling requests
302
+ - Route security levels (open, secure, both)
303
+
304
+ ### Global Services
305
+
306
+ The `DyNTS_GlobalService` provides centralized access to:
307
+
308
+ - Authentication service
309
+ - Email service collection
310
+ - Database models registry
311
+ - Error handlers
312
+ - Socket server instances
313
+
314
+ ### Authentication
315
+
316
+ Dynamo-NTS provides an abstract `DyNTS_AuthService` class that you can extend to implement your authentication logic. The framework supports:
317
+
318
+ - Token-based authentication
319
+ - OAuth2 flows (via the OAuth2 module)
320
+ - Session management
321
+ - Route-level security configuration
322
+
323
+ For product-local accounts, the optional `@futdevpro/nts-dynamo/account-security` entry point adds production
324
+ security primitives without coupling a product to a shared account provider:
325
+
326
+ - versioned adaptive password hashing and rehash detection;
327
+ - hash-only email-verification and password-reset challenges with atomic one-time consumption;
328
+ - opaque, hash-only access credentials backed by revocable server-side sessions;
329
+ - one-time refresh rotation, replay detection, session listing and subject-wide revocation.
330
+
331
+ Persistence remains application-owned through explicit atomic adapters. Transports must never put the raw
332
+ credentials in URLs, logs, analytics or durable client storage. A consuming application must also apply its
333
+ rate-limit, authorization, cookie/storage and audit-redaction policy at the API boundary.
334
+
335
+ ### Distributed rate limiting
336
+
337
+ The `@futdevpro/nts-dynamo/rate-limit` entry point provides an atomic rate-limit boundary for HTTP services:
338
+
339
+ - an exact sliding-window in-memory store for deterministic tests and explicitly single-instance development;
340
+ - an application-owned shared-store contract for production deployments;
341
+ - a production configuration gate that requires both shared persistence and explicit opaque subject/endpoint
342
+ extractors;
343
+ - validated positive limits, windows and weighted request costs with stable, content-free failures;
344
+ - trusted `req.ip` as the safe local default instead of reading caller-controlled forwarding headers directly;
345
+ - explicit opportunistic local cleanup with no timer, polling loop or hidden background task.
346
+
347
+ Production consumers must implement the shared store with one atomic permit decision across every application
348
+ instance. They must derive non-sensitive, purpose-scoped bucket identifiers and must not persist or log raw IP
349
+ addresses, credentials, email addresses or other request content as rate-limit keys.
350
+
351
+ ### Privacy lifecycle
352
+
353
+ The optional `@futdevpro/nts-dynamo/privacy-lifecycle` entry point provides the shared machinery for standalone
354
+ GDPR-capable products:
355
+
356
+ - identity-gated, deadline-bearing data-subject requests;
357
+ - explicit `received → identity-verified → scoped → planned → executing → verifying` processing;
358
+ - deterministic product-domain contributors with resumable partial outcomes and documented retention bases;
359
+ - append-only, checksummed legal acceptances;
360
+ - versioned, purpose-specific consent grants and withdrawals.
361
+
362
+ The Bedrock module coordinates state and evidence only. Each consuming product must register every data domain,
363
+ implement hard-delete/anonymization/export behavior, and provide transaction-safe persistence. A request is
364
+ never reported complete while a registered contributor has a failed outcome.
365
+
366
+ ## Modules Overview
367
+
368
+ Dynamo-NTS is organized into focused modules, each providing specific functionality:
369
+
370
+ ### Main Module
371
+
372
+ The core foundation providing essential components:
373
+
374
+ - **Collections**: Archive utilities, global settings, environment configuration
375
+ - **Enums**: Data model types, service functions, route security levels
376
+ - **Models**: Application configuration interfaces, control models, database types
377
+ - **Services**: Core services for API communication, authentication, data management, routing
378
+
379
+ ### AI Module
380
+
381
+ Provides abstractions and implementations for AI operations:
382
+
383
+ - **Abstract Service Bases**: Base classes for AI providers, LLM services, LLM chat services, and embedding services
384
+ - **OpenAI Implementation**: Complete OpenAI integration with LLM, chat, and embedding support
385
+ - **Document AI**: Document chunking and preprocessing for AI models
386
+ - **Vector Search**: MongoDB Atlas vector database operations with automatic data vectorization
387
+
388
+ #### OpenAI-Compatible Providers
389
+
390
+ The OAI service-ek (`DyNTS_OAI_LLM_ServiceBase`, `DyNTS_OAI_LLMChat_ServiceBase`, `DyNTS_OAI_Embedding_ControlService`) bármely OpenAI-API-kompatibilis endpoint-tal működnek — lokál LLM (LM Studio, Ollama), self-hosted (vLLM, LocalAI) is — a `DyFM_OAI_ClientOptions.baseURL` mező segítségével. Részletek + provider-konfig sample-ök: [`__documentations/2026-05-17-oai-compatible-providers.md`](__documentations/2026-05-17-oai-compatible-providers.md).
391
+
392
+ ### Assistant Module
393
+
394
+ Platform and AI provider agnostic solutions for creating intelligent assistants:
395
+
396
+ - Integrates communication providers (bot) with AI providers (LLM Chat)
397
+ - Message conversion utilities
398
+ - Conversation management
399
+ - Configurable settings for system prompts and message filtering
400
+
401
+ ### Bot Module
402
+
403
+ Platform-agnostic bot functionality:
404
+
405
+ - Message, channel, and user wrappers for any messaging platform
406
+ - Command system for bot commands
407
+ - Routine system for scheduled and event-driven tasks
408
+ - IO management for bot interactions
409
+ - Provider support for Discord, Slack, and Teams
410
+
411
+ ### Socket Module
412
+
413
+ Real-time communication capabilities that simplify Socket.io setup:
414
+
415
+ - Socket client and server implementations with secure and open connection options (simplifies Socket.io server initialization)
416
+ - Event handling system for managing real-time communications (replaces manual Socket.io event handler setup)
417
+ - Presence tracking for monitoring connected clients
418
+ - Error handling and logging for reliable operation
419
+ - Extended application class with built-in socket server capabilities (automatically configures Socket.io with Express server)
420
+
421
+ ### Messaging Module
422
+
423
+ Backend implementation for unified messaging system:
424
+
425
+ - Data services for messages and conversations
426
+ - Control services for business logic orchestration
427
+ - Real-time socket events
428
+ - RESTful HTTP endpoints
429
+ - Integration with bot and assistant modules
430
+
431
+ ### OAuth2 Module
432
+
433
+ Complete OAuth2.0 protocol implementation:
434
+
435
+ - OAuth2 authorization and token management
436
+ - Client management and user authentication
437
+ - Token exchange and refresh operations
438
+ - Authorization code and access token generation
439
+
440
+ ### Server Module
441
+
442
+ Solutions for basic server endpoints:
443
+
444
+ - Error handling for saving and retrieving server errors
445
+ - Server status monitoring with version and uptime information
446
+ - Server status snapshots for saving and retrieving status at specific times
447
+ - Error statistics for monitoring and analysis
448
+
449
+ #### Content-free database readiness probe
450
+
451
+ Applications can perform one foreground readiness check against their own Mongoose connection without
452
+ starting a timer, listener, retry loop, subscription, process hook, or background task:
453
+
454
+ ```typescript
455
+ import {
456
+ DyNTS_DbReadinessProbe_ControlService,
457
+ DyNTS_DbReadinessProbeResult_Interface,
458
+ } from '@futdevpro/nts-dynamo/server';
459
+
460
+ const result: DyNTS_DbReadinessProbeResult_Interface =
461
+ await DyNTS_DbReadinessProbe_ControlService.probe({
462
+ connection: mongoose.connection,
463
+ });
464
+ ```
465
+
466
+ The `dynts-db-readiness/1` result contains exactly six allowlisted fields: contract version, readiness,
467
+ normalized connection state, ping success, bounded stage, and stable result code. It never contains a host,
468
+ database name, URI, model metadata, credentials, driver error text, or arbitrary error properties. Failures
469
+ resolve to a content-free, fail-closed result and the probe writes no log output.
470
+
471
+ Timeout policy and cancellation are caller-owned. The probe observes the supplied `AbortSignal` before and
472
+ after its single ping, but it does not create a timeout or interrupt an already-running driver operation.
473
+ Configure the driver's operation timeout and abort the supplied signal at the application boundary.
474
+
475
+ ### Defaults Module
476
+
477
+ Default implementations for common services:
478
+
479
+ - Default user data model and service for authentication and user management
480
+ - Default authentication service with basic token-based authentication
481
+ - Default socket events service with graceful degradation
482
+ - All services can be extended or replaced with custom implementations
483
+
484
+ ### Custom Data Module
485
+
486
+ Tools for managing custom data:
487
+
488
+ - Data service for handling custom data operations with optional initialization
489
+ - Controller with RESTful endpoints for data operations
490
+ - GET endpoint for retrieving custom data by ID
491
+ - POST endpoint for modifying custom data
492
+ - Configurable routing module with optional security overrides
493
+
494
+ ### Test Module
495
+
496
+ Testing and monitoring tools:
497
+
498
+ - Test endpoints for different HTTP methods (GET, POST, DELETE)
499
+ - Server status endpoint with version and uptime information
500
+ - Configurable routing module with security override options
501
+ - Automatic controller registration for easy setup
502
+
503
+ ### Usage Module
504
+
505
+ Session and usage tracking tools:
506
+
507
+ - Session management tools for creating, updating, and closing sessions
508
+ - Usage data collection and analysis tools
509
+ - Location tracking from HTTP requests
510
+ - Usage statistics retrieval with time range filtering
511
+ - Daily usage statistics calculation
512
+
513
+ ## Usage Examples
514
+
515
+ ### Basic Application Setup
516
+
517
+ This example shows a complete application setup using `DyNTS_AppExtended`:
518
+
519
+ ```typescript
520
+ import {
521
+ DyNTS_AppExtended,
522
+ DyNTS_App_Params,
523
+ DyNTS_GlobalService_Settings,
524
+ DyNTS_Http_Settings,
525
+ DyNTS_RoutingModule
526
+ } from '@futdevpro/nts-dynamo';
527
+ import { DyNTS_SocketServerService } from '@futdevpro/nts-dynamo/socket';
528
+
529
+ export class App extends DyNTS_AppExtended {
530
+
531
+ getAppParams(): DyNTS_App_Params {
532
+ return new DyNTS_App_Params({
533
+ name: 'My Server',
534
+ version: '1.0.0',
535
+ dbName: 'myapp',
536
+ });
537
+ }
538
+
539
+ getGlobalServiceCollection(): DyNTS_GlobalService_Settings {
540
+ return {
541
+ authService: AuthService.getInstance(),
542
+ dbModels: [
543
+ // Your data models
544
+ ],
545
+ };
546
+ }
547
+
548
+ getPortSettings(): DyNTS_Http_Settings {
549
+ return new DyNTS_Http_Settings({
550
+ httpPort: 3000,
551
+ });
552
+ }
553
+
554
+ getRoutingModules(): DyNTS_RoutingModule[] {
555
+ return [
556
+ new DyNTS_RoutingModule({
557
+ route: '/api',
558
+ controllers: [
559
+ MyController.getInstance(),
560
+ ],
561
+ }),
562
+ ];
563
+ }
564
+
565
+ getSocketServices(): DyNTS_SocketServerService<any>[] {
566
+ return [
567
+ MySocketService.getInstance(),
568
+ ];
569
+ }
570
+ }
571
+ ```
572
+
573
+ ### Routing Module Configuration
574
+
575
+ Multiple routing modules can be configured to organize your API:
576
+
577
+ ```typescript
578
+ getRoutingModules(): DyNTS_RoutingModule[] {
579
+ return [
580
+ new DyNTS_RoutingModule({
581
+ route: '/user',
582
+ controllers: [
583
+ User_Controller.getInstance(),
584
+ UserData_Controller.getInstance(),
585
+ UserSettings_Controller.getInstance(),
586
+ ],
587
+ }),
588
+ new DyNTS_RoutingModule({
589
+ route: '/project',
590
+ controllers: [
591
+ Project_Controller.getInstance(),
592
+ ProjectExtension_Controller.getInstance(),
593
+ ],
594
+ }),
595
+ new DyNTS_RoutingModule({
596
+ route: '/server',
597
+ controllers: [
598
+ ServerStatus_Controller.getInstance(),
599
+ ],
600
+ }),
601
+ DyNTS_getTestRoutingModule(),
602
+ DyNTS_getUsageRoutingModule(),
603
+ ];
604
+ }
605
+ ```
606
+
607
+ ### Controller Implementation
608
+
609
+ Controllers define API endpoints with authentication and business logic:
610
+
611
+ ```typescript
612
+ import { Request, Response } from 'express';
613
+ import { DyNTS_Controller, DyNTS_Endpoint_Params } from '@futdevpro/nts-dynamo';
614
+ import { DyFM_HttpCallType } from '@futdevpro/fsm-dynamo';
615
+
616
+ export class User_Controller extends DyNTS_Controller {
617
+
618
+ static getInstance(): User_Controller {
619
+ return User_Controller.getSingletonInstance();
620
+ }
621
+
622
+ private authService: AuthService = AuthService.getInstance();
623
+
624
+ setupEndpoints(): void {
625
+ this.endpoints = [
626
+ new DyNTS_Endpoint_Params({
627
+ name: 'getUser',
628
+ type: DyFM_HttpCallType.get,
629
+ endpoint: '/get/:userId',
630
+ preProcesses: [this.authService.authenticate_tokenSelf],
631
+ tasks: [
632
+ async (req: Request, res: Response, issuer: string): Promise<void> => {
633
+ const userService = new User_DataService({ issuer });
634
+ await userService.getDataById(req.params.userId);
635
+ res.send(userService.data);
636
+ },
637
+ ],
638
+ }),
639
+ new DyNTS_Endpoint_Params({
640
+ name: 'updateUser',
641
+ type: DyFM_HttpCallType.post,
642
+ endpoint: '/update',
643
+ preProcesses: [this.authService.authenticate_tokenSelf],
644
+ tasks: [
645
+ async (req: Request, res: Response, issuer: string): Promise<void> => {
646
+ const userService = new User_DataService({ issuer });
647
+ await userService.saveData(req.body);
648
+ res.send(userService.data);
649
+ },
650
+ ],
651
+ }),
652
+ ];
653
+ }
654
+ }
655
+ ```
656
+
657
+ ### Data Service Implementation
658
+
659
+ Data services provide a structured way to interact with MongoDB:
660
+
661
+ ```typescript
662
+ import { DyNTS_DataService } from '@futdevpro/nts-dynamo';
663
+ import { DyFM_DataModel_Params } from '@futdevpro/fsm-dynamo'; // FSM provides the data model parameter definition
664
+
665
+ // Define your data model parameters
666
+ const userDataParams: DyFM_DataModel_Params<UserData> = new DyFM_DataModel_Params({
667
+ dataName: 'userData',
668
+ typeSample: {
669
+ userId: '',
670
+ preferences: {},
671
+ },
672
+ // ... additional configuration
673
+ });
674
+
675
+ export class User_DataService extends DyNTS_DataService<UserData> {
676
+ constructor(params: { issuer: string }) {
677
+ super(userDataParams);
678
+ this.issuer = params.issuer;
679
+ }
680
+
681
+ // Custom business logic methods
682
+ async getUserPreferences(userId: string): Promise<UserPreferences> {
683
+ await this.getDataByDependencyId({ userId });
684
+ return this.data?.preferences || {};
685
+ }
686
+ }
687
+ ```
688
+
689
+ ### Socket Server Service
690
+
691
+ Socket services enable real-time communication:
692
+
693
+ ```typescript
694
+ import { DyNTS_SocketServerService, DyNTS_SocketPresence } from '@futdevpro/nts-dynamo/socket';
695
+
696
+ export class Chat_SocketServerService extends DyNTS_SocketServerService<DyNTS_SocketPresence, any> {
697
+
698
+ static getInstance(): Chat_SocketServerService {
699
+ return Chat_SocketServerService.getSingletonInstance();
700
+ }
701
+
702
+ protected setupSocketEvents(): void {
703
+ this.socketServer.on('connection', (socket) => {
704
+ socket.on('joinRoom', (roomId: string) => {
705
+ socket.join(roomId);
706
+ });
707
+
708
+ socket.on('sendMessage', async (data: { roomId: string; message: string }) => {
709
+ this.socketServer.to(data.roomId).emit('newMessage', data);
710
+ });
711
+ });
712
+ }
713
+ }
714
+ ```
715
+
716
+ ### Vector Search with AI
717
+
718
+ Dynamo-NTS provides built-in support for MongoDB Atlas vector search with automatic vectorization:
719
+
720
+ ```typescript
721
+ import { DyNTS_OAI_VectorDataService } from '@futdevpro/nts-dynamo/ai/open-ai';
722
+
723
+ export class Knowledge_DataService extends DyNTS_OAI_VectorDataService<Knowledge> {
724
+
725
+ constructor() {
726
+ super(knowledgeDataParams);
727
+ }
728
+
729
+ async searchSimilarContent(query: string, limit: number = 10): Promise<Knowledge[]> {
730
+ return await this.vectorSearch({
731
+ input: query,
732
+ searchInKey: 'content', // Property that has vectorization enabled
733
+ limit: limit,
734
+ numberOfCandidates: 100,
735
+ });
736
+ }
737
+ }
738
+ ```
739
+
740
+ The vector search automatically:
741
+ - Creates embeddings for search queries using the configured AI provider
742
+ - Performs semantic search in MongoDB Atlas vector database
743
+ - Returns results sorted by relevance
744
+ - Supports filtering with additional MongoDB queries
745
+
746
+ ## Ecosystem Integration
747
+
748
+ Dynamo-NTS is part of the unified **Dynamo ecosystem**, which consists of several interconnected packages:
749
+
750
+ ### Dynamo FSM (Full Stack Module)
751
+
752
+ The foundational package [`@futdevpro/fsm-dynamo`](https://www.npmjs.com/package/@futdevpro/fsm-dynamo) that provides:
753
+ - Core interfaces and types shared across the ecosystem
754
+ - Base model definitions (used by all Dynamo-NTS data services)
755
+ - Utility functions
756
+ - Type definitions for system-wide use
757
+ - Data model parameter definitions (`DyFM_DataModel_Params`)
758
+
759
+ Dynamo-NTS is built on top of Dynamo FSM and implements the server-side components of the FSM architecture. All data models, interfaces, and type definitions used in Dynamo-NTS are provided by FSM, ensuring consistency and type safety across the entire ecosystem.
760
+
761
+ ### Dynamo NGX (AngularX)
762
+
763
+ The frontend counterpart [`@futdevpro/dynamo-ngx`](https://www.npmjs.com/package/@futdevpro/dynamo-ngx) provides:
764
+ - Angular components and services
765
+ - Frontend models that integrate with Dynamo-NTS backend (using shared FSM types)
766
+ - Real-time communication clients (connects to Dynamo-NTS socket services)
767
+ - Form management and data table components
768
+
769
+ ### Unified Patterns
770
+
771
+ The Dynamo ecosystem enforces consistent patterns across all packages:
772
+
773
+ - **Naming Conventions**: Consistent prefixes (`DyNTS_` for backend, `DyNX_` for frontend, `DyFM_` for shared)
774
+ - **Type Safety**: Full TypeScript support with shared type definitions
775
+ - **Architecture Patterns**: Consistent service patterns, data models, and API structures
776
+ - **Error Handling**: Unified error handling across the stack
777
+ - **Logging**: Consistent logging patterns and utilities
778
+
779
+ This unified approach ensures that:
780
+ - Developers learn one set of patterns that apply everywhere
781
+ - Frontend and backend code integrate seamlessly
782
+ - Type safety is maintained across the entire stack
783
+ - Maintenance and updates are simplified
784
+
785
+ ## API Reference
786
+
787
+ For detailed API documentation, see:
788
+
789
+ - [Dynamo-NTS Documentation](fdp-documentations/specifications/dynamo-packages/dynamo-nts/dynamo-nts.md)
790
+ - [Dynamo FSM Documentation](fdp-documentations/specifications/dynamo-packages/dynamo-fsm/dynamo-fsm.md)
791
+ - [Dynamo Ecosystem Overview](fdp-documentations/specifications/dynamo-packages/dynamo_packages.md)
792
+
793
+ ## License
794
+
795
+ ISC
796
+
797
+ ## Support
798
+
799
+ For issues, questions, or contributions, please refer to the project repository.