Ask HN: Best way to structure/architect an API with ExpressJS/TypeScript?
I've got major maintainability problems with my kind of amateurish webapp. I spent a bit of time the other day writing a bunch code that I just found out I had already written awhile back. I see a bunch of guides on Google but it's hard to judge how good they are without references/reviews. Are there some in depth guides on separation of concerns, service-oriented architecture, MVC, file structure, etc using Express? Or perhaps a really good reference project or two?
7 comments
[ 3.5 ms ] story [ 29.4 ms ] threadHere's some practical advice. I would just look at loads of starter projects by googling "express typescript starter github" then explore each project. Things to remember when searching:
- Most starter projects have too many use cases, so you can actually delete parts you don't need.
- You don't need to use a single architecture, it may be better to combine things you like about a few different types
For me it provides enough structure without being a super opinionated framework. It handles route and doc generation based off your models and controllers, but everything else is up to you, which is perfect for me.