How dasmeta/nodebb-plugin-upload works
Project type and purpose
• This is a NodeBB plugin (“NodeBB Upload plugin”) whose purpose is to add file‑upload capability to a NodeBB forum, storing assets on S3, Google Cloud Storage, or Minio.
• It hooks into NodeBB’s plugin system and admin UI, reads configuration from environment variables or the NodeBB database, and streams uploaded files to an external object‑storage service.
File structure
• Top‑level files
• package.json, index.js – entry point and plugin entry definitions
• plugin.json – metadata about the plugin (hooks, scripts)
• README.md – user documentation
• .eslintrc.js, .gitignore – linting and VCS
• templates/admin/plugins/upload.tpl – UI template injected into NodeBB’s Admin panel
• No dedicated “src” or “lib” folder: logic lives in index.js.
README for additional insights
• Shows three supported providers (S3, GCS, Minio)
• Configuration via environment variables or NodeBB Admin (persisted in the DB)
• Notes on credential precedence: DB‑stored settings override ENV vars.
a. NodeBB Forum Platform
– Core NodeBB server process (Express/Socket.io)
– NodeBB Database (MongoDB or Redis)
b. Upload Plugin
– Initialization / hook registration
– Config Loader (reads ENV vars and/or DB settings)
– Admin UI component (template)
– Upload Handler (receives multipart uploads, generates file key/URL)
c. External Object Storage Services
– AWS S3
– Google Cloud Storage
– Minio
d. DevOps / Configuration
– Environment Variables
– NodeBB Admin panel storing settings in the DB
Relationships and interactions
1. Administrator configures upload settings via NodeBB Admin UI
→ Plugin writes config to NodeBB Database
2. At plugin initialization, Config Loader reads ENV vars and/or DB
→ Populates runtime settings object
3. End user submits file via NodeBB forum UI
→ Upload Handler (plugin code in NodeBB)
→ Streams file data to chosen provider SDK/API
→ Receives a public URL or key
→ Returns URL to NodeBB, which stores reference in posts
4. Client browser loads images/CSS/JS from the object‑storage asset host
Architectural patterns and design principles
• Plugin-based extensibility: adheres to NodeBB’s hook system
• Configuration fallback: environment variables first, then DB
• Streaming large payloads directly from NodeBB to provider (no local file persist)
• Single Responsibility: separate template/UI, config, upload logic