Writing custom modules #386
-
|
Sorry if this has been documented already but I wasn’t able to find an answer. Are custom modules meant to be integrated within the Yuvomi infrastructure (database, routing, API, etc) or fully external? In other words, if I write a custom module, can it access to the Yuvomi database or is the module expected to have its own database? Likewise, can the module define routes within Yuvomi or is the module expected to call endpoints in a different server? If the module is meant to be fully integrated, are there examples or recommended practices on how to implement the above? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
|
Good question — this is documented, but it's easy to miss: see The short answer: third-party modules are client-side (frontend) only. They are not server-side plugins. What a module is: a folder in On your specific questions:
A minimal working example (manifest + |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the clarification, that's very helpful. I was aware of the MODULES.md document, but it wasn't clear to me what the exact implementation model for modules is. Specifically whether modules could contain server-side components in addition to client-side code, or if they were strictly frontend-only. I don't think I fully appreciated that modules are intentionally limited to browser-side functionality. That raises a follow-up question regarding external backends. Suppose I have a new backend service running on a different host and/or port. Since modules execute in the browser, CSP and browser security policies would typically restrict direct communication with that service unless it's explicitly allowed. How is this expected to be handled in Yuvomi? Should developers be placing a reverse proxy in front of the new backend service so everything appears under the Yuvomi origin? Or is there some intended mechanism for extending the CSP rules to allow specific external hosts? One other (unrelated) thing I noticed: custom modules don't appear in the dashboard module listing. Is that omission intentional and part of the current design, or is it simply functionality that hasn't been implemented yet? |
Beta Was this translation helpful? Give feedback.
-
|
Great follow-ups — both touch real boundaries of the current design. External backends & CSP. You read it correctly. Yuvomi ships a strict CSP with The intended approach is exactly what you suspected: put your service behind a reverse proxy so it appears under the Yuvomi origin. Expose it on a path (e.g. Modules on the dashboard. Not an oversight you can configure away — it's a current limitation. The dashboard widget catalog is a fixed, core-only set ( |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the clarifications. To be honest, I'm currently mostly playing with non-core modules, trying to understand what they can be used for and how they would be architected. Putting the services behind a reverse proxy is a reasonable and easy to handle approach. For my testing purposes I have modified the helmet/CSP rules ( As for the dashboard, like I said, I'm only playing for now and the modules I have created don't make much sense on the dashboard, but it's good to know that if I were to come up with a module that did make sense, I could submit a feature request. Thanks for your support! |
Beta Was this translation helpful? Give feedback.
Good question — this is documented, but it's easy to miss: see
MODULES.mdat the repo root.The short answer: third-party modules are client-side (frontend) only. They are not server-side plugins.
What a module is: a folder in
modules/<id>/with amodule.jsonmanifest and an entry.jsfile that exportsrender(container, context). Yuvomi's server discovers it, validates the manifest, and serves its static assets at/api/v1/modules/assets/<id>/.... The client registers a single page route at/m/<id>and (optionally) a left-menu entry. Copy the folder in, enable it under Settings → Modules → Navigation — no rebuild, no core edits.On your specific questions: