2025-09-01 15:11:42 +09:00
|
|
|
import { Module } from "@nestjs/common";
|
2025-12-26 13:04:15 +09:00
|
|
|
import { APP_INTERCEPTOR, APP_PIPE } from "@nestjs/core";
|
2025-09-01 15:11:42 +09:00
|
|
|
import { RouterModule } from "@nestjs/core";
|
2025-12-11 11:25:23 +09:00
|
|
|
import { ConfigModule } from "@nestjs/config";
|
2025-12-23 11:36:44 +09:00
|
|
|
import { ScheduleModule } from "@nestjs/schedule";
|
2025-12-26 13:04:15 +09:00
|
|
|
import { ZodSerializerInterceptor, ZodValidationPipe } from "nestjs-zod";
|
2025-08-21 15:24:40 +09:00
|
|
|
|
2025-08-30 16:45:22 +09:00
|
|
|
// Configuration
|
2025-12-10 16:08:34 +09:00
|
|
|
import { appConfig } from "@bff/core/config/app.config.js";
|
|
|
|
|
import { apiRoutes } from "@bff/core/config/router.config.js";
|
2025-08-20 18:02:50 +09:00
|
|
|
|
2025-09-17 18:43:43 +09:00
|
|
|
// Core Modules
|
2025-12-10 16:08:34 +09:00
|
|
|
import { LoggingModule } from "@bff/core/logging/logging.module.js";
|
|
|
|
|
import { SecurityModule } from "@bff/core/security/security.module.js";
|
2025-12-11 11:25:23 +09:00
|
|
|
import { RateLimitModule } from "@bff/core/rate-limiting/index.js";
|
2025-12-10 16:08:34 +09:00
|
|
|
import { PrismaModule } from "@bff/infra/database/prisma.module.js";
|
|
|
|
|
import { RedisModule } from "@bff/infra/redis/redis.module.js";
|
|
|
|
|
import { CacheModule } from "@bff/infra/cache/cache.module.js";
|
2025-12-15 11:10:50 +09:00
|
|
|
import { RealtimeModule } from "@bff/infra/realtime/realtime.module.js";
|
2025-12-10 16:08:34 +09:00
|
|
|
import { QueueModule } from "@bff/infra/queue/queue.module.js";
|
|
|
|
|
import { AuditModule } from "@bff/infra/audit/audit.module.js";
|
|
|
|
|
import { EmailModule } from "@bff/infra/email/email.module.js";
|
2025-08-30 16:45:22 +09:00
|
|
|
|
|
|
|
|
// External Integration Modules
|
2025-12-10 16:08:34 +09:00
|
|
|
import { IntegrationsModule } from "@bff/integrations/integrations.module.js";
|
|
|
|
|
import { SalesforceEventsModule } from "@bff/integrations/salesforce/events/events.module.js";
|
2025-08-30 16:45:22 +09:00
|
|
|
|
|
|
|
|
// Feature Modules
|
2025-12-10 16:08:34 +09:00
|
|
|
import { AuthModule } from "@bff/modules/auth/auth.module.js";
|
|
|
|
|
import { UsersModule } from "@bff/modules/users/users.module.js";
|
2025-12-23 17:53:08 +09:00
|
|
|
import { MeStatusModule } from "@bff/modules/me-status/me-status.module.js";
|
2025-12-10 16:08:34 +09:00
|
|
|
import { MappingsModule } from "@bff/modules/id-mappings/mappings.module.js";
|
2025-12-25 13:20:45 +09:00
|
|
|
import { ServicesModule } from "@bff/modules/services/services.module.js";
|
2025-12-10 16:08:34 +09:00
|
|
|
import { OrdersModule } from "@bff/modules/orders/orders.module.js";
|
2025-12-26 17:27:22 +09:00
|
|
|
import { BillingModule } from "@bff/modules/billing/billing.module.js";
|
2025-12-10 16:08:34 +09:00
|
|
|
import { SubscriptionsModule } from "@bff/modules/subscriptions/subscriptions.module.js";
|
|
|
|
|
import { CurrencyModule } from "@bff/modules/currency/currency.module.js";
|
|
|
|
|
import { SupportModule } from "@bff/modules/support/support.module.js";
|
2025-12-15 11:10:50 +09:00
|
|
|
import { RealtimeApiModule } from "@bff/modules/realtime/realtime.module.js";
|
2025-12-18 18:12:20 +09:00
|
|
|
import { VerificationModule } from "@bff/modules/verification/verification.module.js";
|
2025-12-23 11:36:44 +09:00
|
|
|
import { NotificationsModule } from "@bff/modules/notifications/notifications.module.js";
|
2025-08-30 16:45:22 +09:00
|
|
|
|
|
|
|
|
// System Modules
|
2025-12-10 16:08:34 +09:00
|
|
|
import { HealthModule } from "@bff/modules/health/health.module.js";
|
2025-08-30 16:45:22 +09:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Main application module
|
2025-09-01 15:11:42 +09:00
|
|
|
*
|
2025-08-30 16:45:22 +09:00
|
|
|
* Architecture:
|
|
|
|
|
* - Core infrastructure modules provide foundational services
|
|
|
|
|
* - External integration modules handle third-party services
|
|
|
|
|
* - Feature modules implement business logic
|
|
|
|
|
* - System modules provide monitoring and health checks
|
2025-09-01 15:11:42 +09:00
|
|
|
*
|
2025-08-30 16:45:22 +09:00
|
|
|
* All feature modules are grouped under "/api" prefix via RouterModule
|
|
|
|
|
* Health endpoints remain at root level for monitoring tools
|
|
|
|
|
*/
|
2025-08-20 18:02:50 +09:00
|
|
|
@Module({
|
|
|
|
|
imports: [
|
2025-08-30 16:45:22 +09:00
|
|
|
// === CONFIGURATION ===
|
|
|
|
|
ConfigModule.forRoot(appConfig),
|
2025-12-23 11:36:44 +09:00
|
|
|
ScheduleModule.forRoot(),
|
2025-08-22 17:02:49 +09:00
|
|
|
|
2025-08-30 16:45:22 +09:00
|
|
|
// === INFRASTRUCTURE ===
|
2025-08-21 15:24:40 +09:00
|
|
|
LoggingModule,
|
2025-09-26 15:51:07 +09:00
|
|
|
SecurityModule,
|
2025-12-11 11:25:23 +09:00
|
|
|
RateLimitModule,
|
2025-08-20 18:02:50 +09:00
|
|
|
|
2025-08-30 16:45:22 +09:00
|
|
|
// === CORE SERVICES ===
|
2025-08-20 18:02:50 +09:00
|
|
|
PrismaModule,
|
|
|
|
|
RedisModule,
|
2025-08-21 15:24:40 +09:00
|
|
|
CacheModule,
|
2025-12-15 11:10:50 +09:00
|
|
|
RealtimeModule,
|
2025-09-06 10:01:44 +09:00
|
|
|
QueueModule,
|
2025-08-20 18:02:50 +09:00
|
|
|
AuditModule,
|
2025-08-30 16:45:22 +09:00
|
|
|
EmailModule,
|
|
|
|
|
|
|
|
|
|
// === EXTERNAL INTEGRATIONS ===
|
2025-09-17 18:43:43 +09:00
|
|
|
IntegrationsModule,
|
2025-09-06 10:01:44 +09:00
|
|
|
SalesforceEventsModule,
|
2025-08-22 17:02:49 +09:00
|
|
|
|
2025-08-30 16:45:22 +09:00
|
|
|
// === FEATURE MODULES ===
|
2025-08-20 18:02:50 +09:00
|
|
|
AuthModule,
|
|
|
|
|
UsersModule,
|
2025-12-23 17:53:08 +09:00
|
|
|
MeStatusModule,
|
2025-08-20 18:02:50 +09:00
|
|
|
MappingsModule,
|
2025-12-25 13:20:45 +09:00
|
|
|
ServicesModule,
|
2025-08-20 18:02:50 +09:00
|
|
|
OrdersModule,
|
2025-12-26 17:27:22 +09:00
|
|
|
BillingModule,
|
2025-08-20 18:02:50 +09:00
|
|
|
SubscriptionsModule,
|
2025-10-20 13:53:35 +09:00
|
|
|
CurrencyModule,
|
2025-11-18 14:06:27 +09:00
|
|
|
SupportModule,
|
2025-12-15 11:10:50 +09:00
|
|
|
RealtimeApiModule,
|
2025-12-18 18:12:20 +09:00
|
|
|
VerificationModule,
|
2025-12-23 11:36:44 +09:00
|
|
|
NotificationsModule,
|
2025-08-30 16:45:22 +09:00
|
|
|
|
|
|
|
|
// === SYSTEM MODULES ===
|
|
|
|
|
HealthModule,
|
|
|
|
|
|
|
|
|
|
// === ROUTING ===
|
|
|
|
|
RouterModule.register(apiRoutes),
|
2025-08-20 18:02:50 +09:00
|
|
|
],
|
2025-10-02 16:33:25 +09:00
|
|
|
providers: [
|
|
|
|
|
{
|
|
|
|
|
provide: APP_PIPE,
|
|
|
|
|
useClass: ZodValidationPipe,
|
|
|
|
|
},
|
2025-12-26 13:04:15 +09:00
|
|
|
{
|
|
|
|
|
provide: APP_INTERCEPTOR,
|
|
|
|
|
useClass: ZodSerializerInterceptor,
|
|
|
|
|
},
|
2025-10-02 16:33:25 +09:00
|
|
|
],
|
2025-08-20 18:02:50 +09:00
|
|
|
})
|
2025-09-01 15:11:42 +09:00
|
|
|
export class AppModule {}
|