Strapi integration with other typescript aplications in a monorepo

hello, im a freelance web developer who mostly uses strapi for create quick and simple CRUD API’s and a Backoffice to hand over to my client’s content managers.

Im starting to migrate from Javascript to Typescript for my projects, and i wanted to create type definitions for the objects in my strapi APIs to consume in my client applications, but as far as i know there isn’t a way for strapi to automatically provide those for me. is there a way (be it with a plugin or anything else) to get strapi to generate and export type definitions automatically for me, so i can then import them in my other applications located in the same codebase?

If there isn’t already a way to do this, i think it might be interesting to maybe look into developing such a feature. I don’t know how large the demand for something like that would be for the rest of the strapi community, but to me it’s an incredibly attractive one, especially for larger projects with more devs involved.

i wasn’t sure if i should post this here in the strapi forums or if in a github issue, so sorry if this is the wrong place for my inquiry

1 Like

We don’t entirely support typescript currently, and it’s something we are looking into. For the moment we don’t really have any suggestions on implementing it at a project level.


Some have already tried/started to implement it:

But we are still doing some internal discussion and right now it’s not a priority for us. We would rather do it -right- than -fast-


Now near one year later. Some new Status to your internal discussions?
Here is a Medium Post from someone who did it by itself.
Maybe you can use it as inspiration:


If you simply want to generate types for your API definitions for consumption in external projects, you can utilise the OpenAPI spec to do so. There’s many OpenAPI code generators available but I personally use the “typescript-fetch” template to generate both a HTTP REST client and the model definitions in TypeScript.

You can see in the screenshot below I’m consuming an endpoint for a single type called “Document”. You can see the auto-generate client and the model (Document):

This works great, but there’s a caveat. The documentation plugin doesn’t generate an OpenAPI spec that matches the API response types! (See Why is the documentation extension (OpenAPI) generating the wrong data type?) Luckily Strapi is very configurable and you can override API definitions to match the response types.

1 Like