What’s the best way to structure a Node.js + TypeScript API?Jun 14

I just started using TypeScript for a Node API and I’m unsure about folder structure and organizing code. What has worked well for you?

Node.jsTypeScript
3
Answers (3)
Harun Ndogo
Harun NdogoJun 14

Use tsconfig-paths for aliasing @root/controllers, etc. Makes imports clean.

Harun Ndogo
Harun NdogoJun 14

Create a types/ or interfaces/ folder for global types.

Harun Ndogo
Harun NdogoJun 14

Group files by feature/domain: users/, auth/, products/. Inside each: controller, service, model.

Leave an answer