Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript π€
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
title: Organize by Feature Modules impact: CRITICAL impactDescription: "3-5x faster onboarding and development" tags: architecture, modules, organization
Organize by Feature Modules
Organize your application into feature modules that encapsulate related functionality. Each feature module should be self-contained with its own controllers, services, entities, and DTOs. Avoid organizing by technical layer (all controllers together, all services together). This enables 3-5x faster onboarding and feature development.
Incorrect (technical layer organization):
// Technical layer organization (anti-pattern)
src/
βββ controllers/
β βββ users.controller.ts
β βββ orders.controller.ts
β βββ products.controller.ts
βββ services/
β βββ users.service.ts
β βββ orders.service.ts
β βββ products.service.ts
βββ entities/
β βββ user.entity.ts
β βββ order.entity.ts
β βββ product.entity.ts
βββ app.module.ts // Imports everything directly
Correct (feature module organization):
// Feature module organization
src/
βββ users/
β βββ dto/
β β βββ create-user.dto.ts
β β βββ update-user.dto.ts
β βββ entities/
β β βββ user.entity.ts
β βββ users.controller.ts
β βββ users.service.ts
β βββ users.repository.ts
β βββ users.module.ts
βββ orders/
β βββ dto/
β βββ entities/
β βββ orders.controller.ts
β βββ orders.service.ts
β βββ orders.module.ts
βββ shared/
β βββ guards/
β βββ interceptors/
β βββ filters/
β βββ shared.module.ts
βββ app.module.ts
// users.module.ts
@Module({
imports: [TypeOrmModule.forFeature([User])],
controllers: [UsersController],
providers: [UsersService, UsersRepository],
exports: [UsersService], // Only export what others need
})
export class UsersModule {}
// app.module.ts
@Module({
imports: [
ConfigModule.forRoot(),
TypeOrmModule.forRoot(),
UsersModule,
OrdersModule,
SharedModule,
],
})
export class AppModule {}
Reference: NestJS Modules