What’s the best way to structure a Node.js + TypeScript API?5 days ago

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
Answers (3)
Harun Ndogo5 days ago

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

Harun Ndogo5 days ago

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

Harun Ndogo5 days ago

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

Leave an answer