A userscript is a plugin pretty much. If you don't want to setup a plugin build environment, you can also simply drop a JS file in the /plugins folder.
This would be a minimal plugin:
/* joplin-manifest:
{
"id": "com.example.ExamplePlugin",
"manifest_version": 1,
"app_min_version": "2.1",
"name": "JS Bundle test",
"version": "1.0.0"
}
*/
joplin.plugins.register({
onStart: async function() {
// Create a folder
await joplin.data.post(['folders'], null, { title: "my plugin folder" });
}
});