Skip to content
  • A place to talk about whatever you want

    4k 25k
    4k Topics
    25k Posts
    שניאור שמחש
    @AMAARETS I'm joining too, it would be very helpful..
  • Stay tuned here to hear more about new releases and features of NodeBB!

    3k 20k
    3k Topics
    20k Posts
    <baris>B
    @amaarets https://github.com/NodeBB/NodeBB/commit/2ec098753c8c9ebbac1a7103413b714886c86fcd I've removed the check
  • You have a cool idea about NodeBB? Post it here.

    887 5k
    887 Topics
    5k Posts
    zangxiaohuiZ
    @baris 呜呜呜我
  • Discussion regarding NodeBB Plugin development.

    2k 16k
    2k Topics
    16k Posts
    ccD2sC
    Introduction This tutorial will teach you how to write a modern NodeBB plugin using TypeScript, ES Modules, and Rolldown. Starting with NodeBB 4.12.0, you can use ES Modules to write plugins. Rolldown is a Fast Rust bundler that you can use to compile NodeBB plugins written in TypeScript. Installation Create a new plugins folder, then run: pnpm init pnpm add -D rolldown typescript @types/node # or use your favorite package manager Configuration Create a tsconfig.json file (assuming you're writing this in the lib folder): { "compilerOptions": { "target": "ES2020", "module": "node16", "moduleResolution": "node16", "types": ["node"], "declaration": true, "allowImportingTsExtensions": true, "noEmit": true, "forceConsistentCasingInFileNames": true, "noImplicitAny": false, "incremental": true, "composite": true, "skipLibCheck": true }, "include": ["lib", "rolldown.config.ts"], "exclude": ["node_modules", "build"] } If you need to write client-side code (assuming you're writing it in the public folder), create a public/tsconfig.json file: { "compilerOptions": { "target": "ES2020", "module": "umd", "moduleResolution": "node10", "declaration": true, "allowImportingTsExtensions": true, "noEmit": true, "forceConsistentCasingInFileNames": true, "noImplicitAny": false, "incremental": true, "composite": true, "skipLibCheck": true }, "include": ["lib"] } Create a plugin.json file: { "id": "...", "name": "...", "description": "...", "url": "...", "hooks": [ ... ], "scripts": ["build/public/client.js"] // if you need client-side scripts } Create a rolldown.config.ts file: import { defineConfig } from "rolldown"; export default defineConfig([ { input: ["lib/index.ts"], platform: "node", output: { dir: "build", format: "es", cleanDir: true, strict: true, topLevelVar: true, minify: { compress: true, mangle: false }, sourcemap: true } }, // if you need client-side scripts { input: ["public/lib/client.ts"], platform: "browser", output: { dir: "build/public", format: "umd", cleanDir: true, strict: true, entryFileNames: "lib/[name].js", chunkFileNames: "lib/[name].js", topLevelVar: true, minify: { compress: true, mangle: false }, sourcemap: true } } ]); Add the following to package.json: { ... "type": "module", "main": "./build/index.js", "scripts": { "dev": "rolldown -c ./rolldown.config.ts --watch", "build": "rolldown -c ./rolldown.config.ts && tsc --noEmit", "typecheck": "tsc --noEmit" }, "devDependencies": { "@types/node": "^25.9.3", "rolldown": "^1.1.1", "typescript": "^6.0.3" }, "nbbpm": { "compatibility": "^4.12.0" } ... } Development You can now use pnpm build to build plugins and pnpm dev to develop plugins. You can create a symbolic link from the plugin directory to /path/to/nodebb/node_modules to enable the plugin locally. Bundle SCSS Add the following to rolldown.config.ts: import { defineConfig, RolldownPluginOption } from "rolldown"; import fs from "node:fs"; import path from "node:path"; // Add the SCSS plugin const rolldownCopyScssPlugin: RolldownPluginOption = { name: "rolldown-plugin-copy-scss", buildStart() { const srcDir = path.resolve("public/scss"); if (!fs.existsSync(srcDir)) return; const files = fs.readdirSync(srcDir); for (const file of files) { if (file.endsWith(".scss")) { const filePath = path.join(srcDir, file); const source = fs.readFileSync(filePath, "utf-8"); this.emitFile({ type: "asset", fileName: `css/${file}`, source: source }); } } } }; export default defineConfig([ // In the client build options { input: ["public/client.ts"], platform: "browser", output: { dir: "build/public", format: "umd", cleanDir: true, strict: true, entryFileNames: "lib/[name].js", chunkFileNames: "lib/[name].js", topLevelVar: true, minify: { compress: true, mangle: false }, sourcemap: true }, plugins: [rolldownCopyScssPlugin] // Load the SCSS plugin } ]); Using jQuery To use jQuery, first install its type definitions: pnpm add -D @types/jquery Add the following to public/tsconfig.json: { "compilerOptions": { ... "types": ["jquery"], ... }, ... } If you still get an error, add /// <reference types="jquery"/> to the top of your TypeScript file.
  • A public listing of community themes created by the NodeBB community.

    50 1k
    50 Topics
    1k Posts
    DownPWD
    Thanks @baris , this is really helpful and the core buildAvatar change you're describing sounds ideal for my use case. Yes, I'd very much welcome that: if core buildAvatar looked for a property on the user object (say userObj.usernameEffectClass or similar) and appended it to the avatar/username classes when present, my plugin would reduce to just setting that property in filter:user.getFields , fully server-side rendered, no client DOM scanning, near-zero runtime cost. That's exactly the performance profile I'm after, and it'd cover every place the helper is used (profiles, chat, replies, lists, cards) in one shot. In the meantime I'll wire up filter:user.getFields properly to set the class on the user object, so I'm ready to go as soon as the helper supports it. I will test this Thanks again for the guidance.
  • Need help with installing or configuring NodeBB? Look here.

    5k 28k
    5k Topics
    28k Posts
    &lt;baris&gt;B
    Can you do a db.stats() before and after the upgrade to see which stats change the most? You can also post the output from /admin/advanced/database, that includes all the collections.
  • Test NodeBB here! Topics and posts will be cleared on a regular basis.

    1k 4k
    1k Topics
    4k Posts
    InformapirataI
    «Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. nemo enim ipsam voluptatem, quia voluptas sit, aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos, qui ratione voluptatem sequi nesciunt, neque porro quisquam est, qui dolorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt, ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat quo voluptas nulla pariatur?
NodeBB 4.12.0 Released!

  • Hello everyone,

    Today we are releasing NodeBB 4.12.0 and 3.12.9...

Popular Tags

Online Users