Question: Clarity regarding templating and use of strapi bootstrap

System Information
  • 4.11.0:
  • OSX:
  • sqlite:
  • 18.14.2:
  • 9.5.0
  • N/A:

Hello everyone, I’m using strapi to build a cms for a very tiny project. just to try it out.
For development I have the need to boilerplate some data and users.

According to the docs and other forum posts the bootstrap function seems to be the right place to do so.
Now to me it is very unclear which apis should be used to create users and data. For automatic creation of an admin user I have found multiple answers on the forum, all using a different method and none of those methods are mentioned anywhere in the official docs.

Also none of the Typescript highlighting even suggests any of those methods being available in the first place. Where do people get those infos if not from the docs?
I have generated the types in the ./types/schemas.d.ts file and added "typeRoots": ["./node_modules/@types", "./types"] to the package.json file. I still don’t get any autocomplete.

Can anyone point me to some official resources or brief me on the best practices for this?

I looked at these:

If you want seeding of data I would look at data management aka import/export

If you want to hardcode stuff you do that on bootstrap

You are correct the uses ceases you are talking about are not documented properly. however you can use the strapi.entityService calls to add records to the db when needed