AponiaJSDocs
Get started

Project structure

Understand the flat starter and feature layout generated by the AponiaJS CLI.

Standard application

aponia new creates a flat starter layout:

my-api/
├── .env.example
├── .gitignore
├── aponia.json
├── package.json
├── README.md
├── tsconfig.json
├── vite.config.ts
├── src/
│   ├── app.controller.spec.ts
│   ├── app.controller.ts
│   ├── app.module.ts
│   ├── app.service.ts
│   └── main.ts
└── test/
    └── app.e2e-spec.ts

The root AppModule, controller, and service remain directly under src. The CLI does not create an artificial src/modules/app directory.

Feature directories

Later features belong directly under src/<feature>:

src/
├── app.module.ts
├── main.ts
└── greeting/
    ├── entities/
    │   └── greeting.entity.ts
    ├── greeting.controller.spec.ts
    ├── greeting.controller.ts
    ├── greeting.model.ts
    ├── greeting.module.ts
    ├── greeting.service.spec.ts
    └── greeting.service.ts

A REST CRUD resource generates the entities/ and *.model.ts files shown above; the model file holds the @Validation() classes the controller uses in its route slots. A plain aponia g controller or aponia g service generates only the matching file and its spec.

Keep feature-owned controllers, services, modules, validation models, entities, and tests together. Create top-level common, config, or database folders only for code genuinely shared by multiple features.

File responsibilities

FileResponsibility
main.tsCreate the application and start listening.
*.module.tsDeclare imports, controllers, providers, and exports.
*.controller.tsOwn decorated HTTP routes and delegate behavior.
*.service.tsContain reusable application behavior.
*.model.tsOwn route validators, route schemas, and their derived input types.
*.spec.tsUnit tests colocated with the owning class.
test/*.e2e-spec.tsEnd-to-end tests for the application boundary.
aponia.jsonCLI source root, project, and generation defaults.

Use the CLI generate reference to add files to this structure.

On this page