Tempest
Tempest
PPrisma
Created by Tempest on 2/9/2025 in #help-and-questions
Prisma schemas and plugins
Hello everyone, So here's my issue - We're working on a project that has a plugin architecture. Basically there's a main program and different plugins that run on top of it (similar to Wordpress). Plugins are loaded dynamically using "away import". It should be noted that we use MongoDB as a backend. There is a collection with a list of plugins to be loaded. There's a main schema with general collections, and plugins can create their own plugin-specific collections as well. A plugin may also access collections in the general schema, but not the other way around. Installing a plugin is as simple as copying its js file into a plugins subdirectory (if it's written in TypeScript it has to be precompiled), and running a plugin specific install script. The main program is not rebuilt when a plugin is installed. It should be noted that plugins do not have their own copy of node_modules, since they're not considered as separate apps. So, I think you see where I'm going with this - How do I deal with various plugins, that are loaded dynamically, with each having its own schema without having them overwrite each other? And how do we allow a plugin to access the main schema? Any thoughts would be greatly appreciated.
6 replies