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.tsThe 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.tsA 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
| File | Responsibility |
|---|---|
main.ts | Create the application and start listening. |
*.module.ts | Declare imports, controllers, providers, and exports. |
*.controller.ts | Own decorated HTTP routes and delegate behavior. |
*.service.ts | Contain reusable application behavior. |
*.model.ts | Own route validators, route schemas, and their derived input types. |
*.spec.ts | Unit tests colocated with the owning class. |
test/*.e2e-spec.ts | End-to-end tests for the application boundary. |
aponia.json | CLI source root, project, and generation defaults. |
Use the CLI generate reference to add files to this structure.