55 lines
1.3 KiB
TypeScript
55 lines
1.3 KiB
TypeScript
|
|
import { Module } from '@nestjs/common';
|
||
|
|
import { ConfigModule } from '@nestjs/config';
|
||
|
|
import { ThrottlerModule, ThrottlerGuard } from '@nestjs/throttler';
|
||
|
|
import { APP_GUARD } from '@nestjs/core';
|
||
|
|
import { ScheduleModule } from '@nestjs/schedule';
|
||
|
|
import { EventEmitterModule } from '@nestjs/event-emitter';
|
||
|
|
|
||
|
|
import { configuration } from './config';
|
||
|
|
import { PrismaModule } from './prisma';
|
||
|
|
import { AppController } from './app.controller';
|
||
|
|
import { AppService } from './app.service';
|
||
|
|
|
||
|
|
@Module({
|
||
|
|
imports: [
|
||
|
|
// Configuration
|
||
|
|
ConfigModule.forRoot({
|
||
|
|
isGlobal: true,
|
||
|
|
load: [configuration],
|
||
|
|
envFilePath: ['.env.local', '.env'],
|
||
|
|
}),
|
||
|
|
|
||
|
|
// Rate Limiting
|
||
|
|
ThrottlerModule.forRoot([
|
||
|
|
{
|
||
|
|
ttl: 60000, // 60 seconds
|
||
|
|
limit: 100, // 100 requests per minute
|
||
|
|
},
|
||
|
|
]),
|
||
|
|
|
||
|
|
// Task Scheduling
|
||
|
|
ScheduleModule.forRoot(),
|
||
|
|
|
||
|
|
// Event Emitter
|
||
|
|
EventEmitterModule.forRoot(),
|
||
|
|
|
||
|
|
// Database
|
||
|
|
PrismaModule,
|
||
|
|
|
||
|
|
// Feature Modules (will be added as we develop them)
|
||
|
|
// AuthModule,
|
||
|
|
// UsersModule,
|
||
|
|
// AgentsModule,
|
||
|
|
],
|
||
|
|
controllers: [AppController],
|
||
|
|
providers: [
|
||
|
|
AppService,
|
||
|
|
// Global Rate Limiting Guard
|
||
|
|
{
|
||
|
|
provide: APP_GUARD,
|
||
|
|
useClass: ThrottlerGuard,
|
||
|
|
},
|
||
|
|
],
|
||
|
|
})
|
||
|
|
export class AppModule {}
|