<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by adevinwild on Medium]]></title>
        <description><![CDATA[Stories by adevinwild on Medium]]></description>
        <link>https://medium.com/@adevinwild?source=rss-2fdeced75485------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*oEI0vc-36WNWjChUEm4K7Q.jpeg</url>
            <title>Stories by adevinwild on Medium</title>
            <link>https://medium.com/@adevinwild?source=rss-2fdeced75485------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 09:45:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@adevinwild/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Customize the Admin UI Plugin with Medusa.js 1.8.X and Up: A Step-by-Step Guide (DEPRECATED)]]></title>
            <link>https://medium.com/@adevinwild/customize-the-admin-ui-plugin-with-medusa-js-1-8-x-and-up-a-step-by-step-guide-df12205b2ef7?source=rss-2fdeced75485------2</link>
            <guid isPermaLink="false">https://medium.com/p/df12205b2ef7</guid>
            <category><![CDATA[medusa]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[medusajs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[adevinwild]]></dc:creator>
            <pubDate>Wed, 17 May 2023 11:29:38 GMT</pubDate>
            <atom:updated>2023-09-08T06:46:04.129Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*t9ESDavl3G6c1FJ9" /></figure><pre># This Guide Is Now Deprecated<br><br>Medusa now has a better way to customize administration, <br>but if you still want to make major changes to the UI<br>you&#39;ll need to fork the repo and start integrating your changes.</pre><p><a href="https://docs.medusajs.com/admin/quickstart"><strong>New Admin Documentation</strong></a></p><p>Do you want to personalize the admin user interface to create a one-of-a-kind commerce experience for your platform? In this guide, I will show you <strong>how to customize the admin UI plugin with Medusa.js</strong> &gt;=1.8.x<strong>.</strong></p><h3>The Challenge: Customizing the Admin UI Plugin</h3><p>With Medusa &gt;=1.8.x, the admin repository has been packaged as a plugin that can be directly installed/used in your backend. However, customizing the admin UI can be a challenge since it remains a Medusa.js plugin.<br>But don&#39;t worry! I have a solution that allows you to customize the admin UI to meet your needs.</p><h3>Solution: Customizing the Admin UI Plugin</h3><p>Make sure you have installed @medusajs/medusa in your back-end first</p><ol><li><strong>Eject the admin UI</strong>: By ejecting the admin ui, we will get all the sources. To do this, use the medusa-admin eject -o &lt;outputDirectory&gt; command in your terminal. Replace &lt;outputDirectory&gt; with the desired directory where you want the ejected admin UI to be placed. This command will create a standalone React application using Vite.js, which you can now customize to your heart&#39;s content.</li><li><strong>Install dependencies and run the project</strong>: With the ejected admin UI ready for customization, navigate to the directory where it was ejected (specified by &lt;outputDirectory&gt;) and install the required dependencies.</li><li><strong>Once the dependencies are installed:</strong> You can start the development server by running the following command: yarn dev</li><li>This command will launch the admin UI on <strong>port 7001 by default</strong>.</li><li><strong>Access the app:</strong> You can access the admin UI by opening your web browser and navigating to <a href="http://localhost:7001/">http://localhost:7001</a>.</li><li><strong>It’s done:</strong> Now, you have a fully customizable admin UI at your fingertips. 🎉 You now have a common React application with Vite.js that serves as the foundation for the admin UI customization. You can leverage your frontend development skills to modify the UI, add new features, and create a tailored admin interface for your commerce store!</li></ol><h3>Conclusion</h3><p>Customizing the admin UI plugin with Medusa.js &gt;=1.8.x and newer versions is now within your reach.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*Q72REpnguUJZQI5Q" /></figure><p>By following this step-by-step instructions provided in this guide, you can take full control over the appearance and functionality of the admin interface.</p><p>However, there is a problem with this solution: the update of your UI. The Medusa.js team has considered this issue and a solution with a better way to customize your admin interface without compromising updates is in the works.</p><p>You can follow up the discussion about “<em>Admin Extensibility</em>” here 👇<a href="https://github.com/medusajs/medusa/discussions/4116">https://github.com/medusajs/medusa/discussions/4116</a></p><p><em>Remember to explore the Medusa.js documentation and community resources for further guidance and inspiration as you embark on your customization journey!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df12205b2ef7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Extend validators with Medusa.js 1.8.x and up]]></title>
            <link>https://medium.com/@adevinwild/extend-validators-with-medusa-js-1-8-x-and-up-3e730040fd53?source=rss-2fdeced75485------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e730040fd53</guid>
            <category><![CDATA[medusa]]></category>
            <category><![CDATA[medusajs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[expressjs]]></category>
            <dc:creator><![CDATA[adevinwild]]></dc:creator>
            <pubDate>Wed, 17 May 2023 11:27:45 GMT</pubDate>
            <atom:updated>2023-05-17T11:27:45.672Z</atom:updated>
            <content:encoded><![CDATA[<p>With <strong>Medusa.js</strong> version &gt;=1.8.x, it&#39;s now possible to extend and add new properties to validators that are triggered on some endpoints.</p><p>In this guide, I’ll walk you through the steps required to extend core validators with Medusa.js. Let’s get started!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/349/0*cVcT8fkUW_Bpaljz" /></figure><h3>Extending Core Validators</h3><p>In that new version of Medusa.js, you can add file loaders that will be executed when the server is launched. These loaders allow you to fully customize Medusa.js to your needs.</p><p><strong>Create an utility function</strong></p><p>The first step to extending core validators is to create a function that allows you to override the validator in question. Here’s an example of what this function might look like:</p><pre>// src/utils/register-extended-validator.ts<br>import { ValidatorOptions } from &#39;class-validator&#39;<br>import { ClassConstructor } from &#39;@medusajs/medusa&#39;<br><br>const extendedValidators: any = []<br>let isInitialized = false<br><br>export async function registerExtendedValidator&lt;<br>    T extends ClassConstructor&lt;any&gt;,<br>&gt;(classValidator: T): Promise&lt;void&gt; {<br>    extendedValidators.push(classValidator)<br><br>    if (isInitialized) {<br>        return<br>    }<br><br>    isInitialized = true<br><br>    const module = await import(&#39;@medusajs/medusa/dist/utils/validator&#39;)<br>    const originalValidator = module.validator<br>    module.validator = &lt;T extends ClassConstructor&lt;any&gt; = any, V = any&gt;(<br>        typedClass: T,<br>        plain: V,<br>        config?: ValidatorOptions,<br>    ): Promise&lt;any&gt; =&gt; {<br>        for (const extendedValidator of extendedValidators) {<br>            if (extendedValidator.name === typedClass.name) {<br>                typedClass = extendedValidator<br>                break<br>            }<br>        }<br>        return originalValidator(typedClass, plain, config)<br>    }<br>}</pre><p>This code accepts a validator as a parameter.<br>This validator will be used to find a match in existing internal validators. Once the validator has been found it will be overridden ✅</p><h4>Create an extended validator</h4><p>In my case I decided to extend the product creation validator to add a new property store_id.</p><pre>// We alias the core validator so we can have the EXACT same name as the core validator.<br>import { AdminPostProductsReq as MedusaAdminPostProductsReq } from &#39;@medusajs/medusa&#39;<br>import { IsEnum, IsString } from &#39;class-validator&#39;<br><br>export class AdminPostProductsReq extends MedusaAdminPostProductsReq {<br>    @IsString()<br>    store_id: string<br>}</pre><h3>Call the Function in a Loader</h3><p>Now you need to call this function inside a loader with a custom validator.</p><p>A loader is a file that exports a function that Medusa.js will execute when the server is launched.</p><p>Here’s an example of what the loader might look like:</p><pre>// src/loaders/index.ts<br>export default async function () {<br>    registerExtendedValidator(AdminPostProductsReq)<br>}</pre><p>This loader calls the registerExtendedValidator function and passes in the new AdminPostProductsReq class to register an extended validator for the create product endpoint.</p><p>This means that my endpoint will now wait for store_id to be part of the new DTO.</p><h3>Conclusion</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*ib9t0d88zmciES2I" /></figure><p><strong>That’s it!</strong> You’ve now learned how to extend core validators with Medusa.js 1.8.x.<br>By using this function inside a loader and registering an extended version of a specific validator, you can add custom validation logic to your Medusa.js commerce store.</p><p>I hope you found this guide helpful.<br>If you have any questions or comments, feel free to leave them below.</p><p>A special thanks to <a href="https://github.com/adrien2p"><strong>Adrien De Peretti</strong></a> for his help with this.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e730040fd53" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>