Is nested routes “ok” practice

System Information
  • Strapi Version: 3.4.1
  • Operating System: Docker
  • Database: mongoDB
  • Node Version: 14.15.3
  • NPM Version: 6.14.9
  • Yarn Version: 1.22.5

Hello dear strapi community,

I am building an app which has a tree-like data structure.
There is a workspace which has many projects where each of it has many …
You get the idea.

Each part has its own content-type in stapi.
Now I am thinking about nesting all requests route-wise.


I would forbid direct access via /projects/:id or at least leave it to the app maintainers.

I saw this route design in Toggl Plans and for nested data structure it kind of makes sense to me.
On the other hand you have to provide the ids of parental entities with every request.

What do you think? Do you see advantages and/or disadvantages compared to api route design with zero level endpoints?

All the best for 2021!

Cheers, Matthi

Hi @MatthiasDunker, I currently studying strapi’s (strapi v3) structure. Did you ended up using the nested api design? If yes, may I know how did you approach it at route and controller levels. Thank you!

Hey @prasetyaputraa ,
unfortunately, I did not do it with strapi. Back then I ended up in making multiple requests to get all data.
Meanwhile, I use prisma a lot when data structure gets complicated (like in business apps) and data maintainability via ui does not habe priority.
All the best!