Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
medusa-plugin-strapi-ts
Advanced tools
A plugin for medusa to use strapi in the backend as the cms in typescript
Strapi is an amazing headless cms, this plugin helps bridge the medusajs and strapi. This is based on the medusa-plugin-strapi developed by DeathWish, and additionally implements handshaking between strapi and medusa.
This plugin hands over control of strapi to Medusa. And medusa is purely used as a content engine.
You need to install the strapi-plugin-medusajs and enable it in strapi and follow the instructions in its readme file.
yarn add medusa-plugin-strapi-ts
You can register the plugin like so
{
resolve: "medusa-plugin-strapi-ts",
options: {
...strapiOptions
}
},
where the strapiOptions will be like
const strapiOptions =
{
encryption_algorithm: "aes-256-cbc",
strapi_protocol: process?.env?.STRAPI_PROTOCOL,
strapi_default_user: {
username: process?.env?.STRAPI_MEDUSA_USER,
password: process?.env?.STRAPI_MEDUSA_PASSWORD,
email: process?.env?.STRAPI_MEDUSA_EMAIL,
confirmed: true,
blocked: false,
provider: "local"
},
strapi_host: process?.env?.STRAPI_SERVER_HOSTNAME,
strapi_admin: {
username:
process?.env?.STRAPI_SUPER_USERNAME ||
"SuperUser",
password:
process?.env?.STRAPI_SUPER_PASSWORD ||
"MedusaStrapi1",
email:
process?.env?.STRAPI_SUPER_USER_EMAIL ||
"support@medusa-commerce.com"
},
strapi_port: process?.env?.STRAPI_PORT,
strapi_secret: process?.env?.STRAPI_SECRET,
strapi_public_key: process?.env?.STRAPI_PUBLIC_KEY,
strapi_ignore_threshold: 3
}
STRAPI_PROTOCOL: string; - strapi protocol should be http or https
STRAPI_SERVER_HOSTNAME: string; - strapi hostname
STRAPI_MEDUSA_USER: Service account username #necessary - THIS IS MANDATORY AND SHOULDN'T exist in strapi
STRAPI_MEDUSA_PASSWORD: Service account password
STRAPI_MEDUSA_EMAIL: Service account - THIS IS MANDATORY AND SHOULDN'T exist in strapi
the settings below are necessary to setup a user account
STRAPI_SUPER_USERNAME: The super user account details, in order to register new accounts;
STRAPI_SUPER_PASSWORD: The super user account password
STRAPI_SUPER_USER_EMAIL: The super user account email
STRAPI_PORT: number;
STRAPI_SECRET?: string; - a secret key to encrypt the jwt between medusa and strapi
STRAPI_PUBLIC_KEY?: string; - a public key if the secret is not used
strapi_ignore_threshold: number;
enable_marketplace?: boolean; ## experiment doesn't do anything at the moment
enable_auto_retry?: boolean; ## experiment doesn't do anything at the moment
encryption_algorithm: string; ## experiment doesn't do anything at the moment
strapi_healthcheck_timeout?: number;
auto_start?: boolean; - starts the interface automatically along with medusa, not recommended as the medusa server may not be ready to sync as soon as strapi is ready
max_page_size?: number;
Install and fire away
inside your service you need to call if not autostart enabled
inside your medusa project folder src/services
```
class YourService extends TransactiontBaseService
{
constructor({
...
UpdateStrapiService updateStrapiService
...
})
{
...
this.updateStrapiService = updateStrapiService
...
}
// To Start the interface in not autostart enabled
.....
async startStrapiService(): Promise<unknown> {
return await this.updateStrapiService.startInterface();
}
// To use Strapi Services internally without using the api
async stapiAction():Promise<....>
{
this.updateStrapiService.theStrapiApiYouWishToCall(...);
}
}
```
you can fetch content using the api /strapi/content/<content-type>/<medusa_id>
```
//e.g. to fetch a product with details like = {
// ...
// id:prod_12345
// ...
// }
await axios.get("/strapi/content/products/prod_12345")
```
the package uses axios retry with a default fixed retry interval of 400seconds for any 429 errors. I'm happy to accept a PR which defines a better way of dealing with 429 errors
I love developing software and building products that are useful. I sincerely hope you this project helps you. I'm happy to help if you need support setting this up. Give a ⭐️ if this project helped you! Catch me on discord @govdiw
As you might have guessed by now that considerable time and effort has gone into make this product useful to the community at large, and I'd love to keep maintaining and upgrading this. However, As much as we love FOSS software, nothing in this world is truly free. Please help by [sponsoring or supporting the project]. (https://github.com/sponsors/SGFGOV)
FAQs
A plugin for medusa to use strapi in the backend as the cms in typescript
The npm package medusa-plugin-strapi-ts receives a total of 152 weekly downloads. As such, medusa-plugin-strapi-ts popularity was classified as not popular.
We found that medusa-plugin-strapi-ts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.