I have a functional web app built with Nuxt2 (Vue2) and uses Strapi (v3) in the API server. Up to now, in the front-end I’ve manually built everything: models (not synchronized with the API), components, etc, and I’m starting to build out forms, which ultimately will be very complex and need dynamic validation. In my Strapi instance, I’m quickly approaching +20 collection types, each full of complex fields and relationships. I use REST API for everything, and yes I’m aware of GraphQL but for this project I’m not leveraging it.
Before I go nuts with a ton of manual form work, I want to see if there’s an efficiency I’m overlooking.
I understand the concept of schemas and how they can be shared across different domains (e.g. front-end and back-end) and I’m looking for suggestions here.
As a starting point, how does one get Strapi schema definitions into a front-end client?
1 - Export the Strapi schema into a private NPM module?
Automatically update a private NPM module any time Strapi models are updated, and import this module into any external project. The module is versioned.
2 - Have an API route that responds with the schema and pull it dynamically?
Is this silly? Either at build-time, or in real-time, have an Strapi API route that returns schema; versioned. The return output would be whatever the user is authenticated for, presumably?
3 - Simply copy-paste the schema when you make changes?
If you’re in control over the entire ecosystem (Strapi and multiple front-ends), just copy-paste the schema when the need arises?
4 - Do everything manually, forever?
Basically no automatic synchronization of the content model, and instead every API transaction is purely scrutinized on either side. On server side, if something isn’t right, just return an error.
What do large projects do, especially non-GraphQL ones =P ?
I’ve spent hours searching and I don’t find a lot of material on this.