Project Structure
Nova doesn't enforce a specific folder structure, but here's a recommended layout inspired by clean architecture principles.
Recommended Structure
Project Tree folder
my-nova-app/
├── src/
│ ├── main.ts # Entry point
│ ├── app.module.ts # Root module
│ ├── users/
│ │ ├── user.controller.ts # Controller with routes
│ │ ├── user.service.ts # Business logic service
│ │ ├── user.module.ts # Feature module
│ │ └── dto/
│ │ └── create-user.ts # Zod schemas
│ ├── products/
│ │ ├── product.controller.ts
│ │ ├── product.service.ts
│ │ └── product.module.ts
│ └── shared/
│ ├── middlewares/ # Custom middlewares
│ └── exceptions/ # Custom exceptions
├── tsconfig.json
└── package.json Key Files
Entry Point — main.ts
This is where you create the Nova application, configure security plugins, and start the server.
src/main.ts TypeScript
import 'reflect-metadata';
import { NovaFactory, Security } from '@abrahambass/nova';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NovaFactory.create({
logger: true,
});
await app.security([
Security.cors(),
Security.helmet(),
]);
app.include(AppModule);
await app.listen(3000);
}
bootstrap(); Root Module — app.module.ts
The root module aggregates all feature modules.
src/app.module.ts TypeScript
import { Module } from '@abrahambass/nova';
import { UserModule } from './users/user.module';
import { ProductModule } from './products/product.module';
export const AppModule = new Module()
.include(UserModule)
.include(ProductModule);