feat: Initialize NestJS backend project with Prisma, core modules, configuration, and common utilities.
This commit is contained in:
54
src/app.module.ts
Normal file
54
src/app.module.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
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 {}
|
||||
Reference in New Issue
Block a user