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?

3 Answers

Harun Ndogo
Harun Ndogo
Jun 14

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

Harun Ndogo
Harun Ndogo
Jun 14

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

Harun Ndogo
Harun Ndogo
Jun 14

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

Your Answer