SDK JS
in progress
Niklas Winkels
in progress
🌟
JavaScript SDK Beta is Here!
🌟We’re thrilled to announce the
beta release of the Strapi JavaScript SDK
! 🚀 This JavaScript SDK is designed to simplify how you interact with your Strapi projects, making it easier than ever to integrate and build web apps.
✨ Key Features:
- Initialization with a base URL and API tokens authentication.
- Support for CRUD operations (create, read, update, delete) for content types via collectionandsinglequeries.
- Simplified query capabilities, including filtering, sorting, and parameterization supported by basic types.
- Native fetchmethod for advanced custom requests.
👉
Check it out on GitHub
: Strapi JavaScript SDK📖 How to Get Started
- Install the SDK:
```
npm install @strapi/sdk-js
```
- Configure the SDK:
```
import { strapiSDK } from ‘@strapi/sdk-js’;
const sdk = strapiSDK({ baseURL: ‘http://localhost:1337/api’ });
```
- Explore the Docs: GitHub
🔮 What’s Next on the Roadmap?
The SDK is just getting started! Here’s what’s coming:
- Media Asset Management: Upload files and retrieve metadata effortlessly.
- API Schema Integration: Auto-generated schema for type-safe SDK functions.
- Enhanced CRUD Operations: Manage relations and nested content with ease.
We’ve made the development plan for the SDK public! Take a look at our progress and what’s coming next:
👉 Strapi JavaScript SDK Plan
🔍
Share Your Feedback:
As we’re in the beta stage, your feedback is crucial to help us refine and improve the SDK before the stable release. Dive in, test it out, and let us know what you think! Share your thoughts, ideas, on Discord or GitHub—your input is essential!
- Report issues: GitHub Repo
- Join the conversation: Discord Thread
Aurélien Georget
candidate
M
Marco Wuethrich Pr
We use the official Documentation Plugin and use
openapi-typescript-codegen
to generate the model. I have given up after a long time of trying to generate a good working client with OpenAPI. Some abstraction in the code and the models are enough for me so far.R
Richard Weaver
In particular, would be good if the client SDK would unwrap the { data: { id, attributes: {} } structure and provide strong Typescript types.
Derrick Mehaffy
planned
Thomas F. K. Jorna
I really like https://github.com/kmariappan/strapi-client-js especially with Strapi's ability to generate typescript types!
Martin Salzburg
Alternatively you could specify the Strapi API with Open API and profit from the Open API generator project (https://github.com/OpenAPITools/openapi-generator), which can generate API Clients/SDKs in various programming languages ...
Kevin Vugts
Martin Salzburg: Is this really possible?!!
Martin Salzburg
Yes - "the" API only has to be defined via the OPEN API specification (e.g. https://spec.openapis.org/oas/v3.1.0). Based on its open api spec the code generators can generate API clients in various programming languages.
This approach could be used for strapis general REST API as well as the custom endpoints of a concrete strapi instance. Each instance just needs to generate its open api spec dynamically.
Shay Zhang
Martin Salzburg: But there's going to be some corner case. In my case, my setup of collections and components maybe a bit too complex for the code generation. I tried swagger codegen and openapi codegen, both doesn't output the exact result I want. I think it would be fantastic if there's a SDK embedded the power of tRPC, etc.
Aurélien Georget
candidate