- Nim 69%
- Python 19.6%
- JavaScript 6.4%
- PHP 2.7%
- CSS 2.3%
| deploy | ||
| docs | ||
| schema | ||
| src | ||
| static | ||
| templates | ||
| tests | ||
| themes | ||
| tools | ||
| .gitignore | ||
| config.nims | ||
| LICENSE | ||
| README.md | ||
| your_bb.nimble | ||
YourBB
A replacement for MyBB for the Debian Users Forum, written in Nim.
Development
YourBB uses Mummy for HTTP, Nimja for server-rendered templates, Ormin for
database queries, and SQLite. Read-only browsing now includes a forum hierarchy,
paginated threads/posts, breadcrumbs, basic MyCode, and minimal public profiles.
Visitors can browse as guests or sign in with inherited primary/additional-group
permissions. Account registration, email activation, password resets, and logout
are implemented for local development. Members can create threads, reply/quote,
preview, edit/delete their own content, and explicitly mark content read.
Members can also manage private messages, see unread
PMs on the home page, and reply privately to another member's posts.
The user control panel provides a PM overview,
mailbox links and receiving preferences, profile editing, password changes,
verified email changes, avatars/signatures,
unified thread/reply/PM drafts,
buddies, blocklists and group memberships,
personal threads and subscriptions, and
optional in-app alerts, plus
explicit notification preferences and delivery.
Email/PM delivery is default-off and requires an operator-run worker.
Avatar uploads optionally use an installed
ImageMagick 7 magick; signature editing does not require it.
Scoped moderation includes member reports, staff edits, move/merge/split tools,
bulk lifecycle controls and audit review. Audited administration provides ordinary-user/group
management, forum metadata and allowlisted board settings. Full Admin CP parity
and production migration remain deferred.
The approved compatibility baseline is vanilla MyBB 1.8.41, using SQLite and
the default mybb_ table prefix. Older source installations should be upgraded
to that release before migration. Plugin requirements may be revised as discovered.
Run locally
Requirements: Nim 2.2.10 or newer, Nimble, a C compiler, the SQLite 3 shared
library, libsodium (Argon2id), and Python 3 for tooling/tests. SMTP/CAPTCHA use
curl with verified TLS and the OS CA bundle; the TLS tests also require OpenSSL.
macOS and Linux
are supported. Install libsodium with brew install libsodium on macOS or
sudo apt-get install libsodium-dev on Debian/Ubuntu before running the application.
The build enables threads and ORC in config.nims.
SQLite is the default compile-time database backend; -d:yourbbDb=sqlite selects
it explicitly. The database abstraction reserves a future
PostgreSQL backend, but -d:yourbbDb=postgres currently fails clearly at compile
time. No PostgreSQL server or client library is needed for SQLite builds.
nimble install -d -y
nimble dev
Visit http://127.0.0.1:8080. nimble dev builds bin/your_bb, initializes a
missing development database with synthetic content, and starts the server.
Stop it with Ctrl-C: active request handlers finish, the listener/workers are
closed, and the server exits without a stack trace, logging a final stopped
event. Queued requests are not dispatched during shutdown. Sign in locally with
username john, password doe.
This is an activated ordinary member, not an administrator; its password is stored
with Argon2id. Re-running preserves content and never resets an existing john.
The index links to General discussion and its welcome thread. Existing development
fixtures are not otherwise upgraded; use a new YOURBB_DB_PATH with nimble dev
if you want the current fixture (including activation/banned groups, posting
permissions, counted posts/threads, and MyCode).
dev and db:init-dev add the sample account by default only on a loopback
development origin/listener. Set YOURBB_DEV_SAMPLE_USER=disabled for account-free
fixtures. To add it explicitly to an existing synthetic development database, run
bin/your_bb dev:seed-user; this refuses non-local/non-development boards and never
overwrites a case-insensitive john match. Never deploy a development database
containing these known credentials publicly. Normal registration/reset password
requirements are unchanged; the short demo password is an offline seed exception.
To try accounts, click Register, then open the activation link in the JSON
email under data/outbox/. The directory and files are private to your OS user;
they are never served by YourBB. This is a development outbox, not real email
delivery. Password reset and resend-activation flows use the same outbox.
After activation and login, use New thread, Reply, Quote, Edit, and
Delete. Earlier development seeds did not grant posting permissions; use an
unused path such as YOURBB_DB_PATH=data/posting-dev.sqlite3 nimble dev for the new seed.
For explicit control:
nimble build
bin/your_bb db:init-dev
bin/your_bb db:check
bin/your_bb serve
Use db:init instead of db:init-dev for an empty schema. Both initialization
commands refuse any existing database path, including an empty file. An
initialization failure can leave a reserved file for inspection; choose a new
development path rather than expecting the command to overwrite it. These are
not production provisioning or full MyBB installation commands.
serve (also the default command) requires an existing compatible database and
never initializes or upgrades one. Startup validates required tables and column
metadata against the pinned schema. Additional tables/columns are retained;
unrelated plugin behavior is not supported or security-audited. Use disposable databases
for development, not the live forum database.
Configuration
| Environment variable | Default | Constraint |
|---|---|---|
YOURBB_HOST |
127.0.0.1 |
Non-empty IPv4 address or hostname |
YOURBB_THEME_CSS |
Unset | Optional local CSS override; loaded once at web startup, up to 256 KiB UTF-8 |
YOURBB_PORT |
8080 |
1–65535 |
YOURBB_DB_PATH |
data/yourbb.sqlite3 |
File path relative to the working directory, or absolute |
YOURBB_DEV_SAMPLE_USER |
Loopback enabled, otherwise disabled |
dev/db:init-dev add john / doe; enabling on a non-local origin/listener is rejected |
YOURBB_WORKERS |
4 |
1–64 |
YOURBB_DB_POOL_SIZE |
Worker count | Worker count–256; phase-1 startup reserve only, not yet used by requests |
YOURBB_DB_BUSY_TIMEOUT_MS |
5000 |
1–60000 |
YOURBB_BASE_URL |
http://127.0.0.1:8080 (uses configured port) |
Canonical HTTP(S) origin; no subpath; public origins require HTTPS |
YOURBB_MAIL_MODE |
spool for loopback origins, otherwise disabled |
spool, disabled or explicit smtp; spooling is loopback-only |
YOURBB_MAIL_DIR |
outbox beside the database (mail-outbox in SMTP mode) |
Private mail directory, never web-served |
YOURBB_STATE_DIR |
runtime beside the database |
Owner-only transport state directory |
YOURBB_TRUSTED_PROXIES |
Empty | Explicit proxy IPs/CIDRs; required for HTTPS serving |
YOURBB_PUBLIC_ACCOUNTS |
Loopback enabled, otherwise disabled |
Public enablement requires SMTP and Turnstile |
YOURBB_CAPTCHA_MODE |
disabled |
Explicit turnstile requires a site key/private secret file |
Visit the configured base origin exactly: localhost and 127.0.0.1 are different
origins for account forms. Mummy still serves HTTP; public HTTPS requires a TLS
reverse proxy. Never expose the repository or data/ as a static web directory.
Public enrollment/recovery remains disabled until explicitly configured; existing-
account login does not require mail. See production services
for the SMTP/CAPTCHA variables, proxy policy and deployment examples in deploy/.
Production services and abuse controls
SMTP mode queues account mail privately; web requests never contact the relay.
Run bin/your_bb mail:deliver from a supervised worker/timer to send current jobs
using verified STARTTLS or implicit TLS. Certificate failures never fall back to
cleartext. Delivery validates committed token state and discards stale jobs.
Ambiguous failures require operator review and explicit mail:retry, which may
duplicate accepted mail; mail:prune removes expired/revoked uncertain jobs without
sending. Monitor queue age, failures and relay delivery rather than assuming success.
Public registration/reset requests require Turnstile hostname/action/session binding and one-use verification. Trusted proxy headers are accepted only from configured socket peers and resolved right-to-left; all rate budgets/IP bans use that normalized identity. Host/protocol mismatches are denied. Live MyBB IP, username and email ban filters are supported within documented bounds; unsupported relevant rules fail closed. Existing local development behavior remains available.
No real relay credentials or CAPTCHA keys are included or provisioned. Configure the services, privacy/edge controls, TLS and secret-file permissions explicitly. These additions do not replace security/load review or migration/rollback rehearsal.
New database files have owner-only permissions and use WAL mode. Connections have a bounded busy timeout and are owned by each request, never shared between Mummy workers. Existing databases keep their journal mode. Content reads use read-only snapshots; eligible browsing GETs separately update ephemeral presence. Account and posting forms perform explicit transactional writes. Do not enable concurrent MyBB writes.
Templates, CSS, and schema are embedded at compile time, so changes require a
rebuild and no source directories need to be served as static files. Only the
explicit /static/site.css route is exposed. Request bodies are limited to 64 KiB
and headers to 8 KiB. The server returns security headers and logs JSON event/status
records without request URLs, cookies, bodies, or raw internal HTTP error text.
/healthz: process liveness, independent of database availability./readyz: an Ormin read query using a fresh SQLite connection; generic 503 on failure. Full schema validation happens at startup or withdb:check, not on every readiness request./and/index.php: the public forum hierarchy./forumdisplay.php?fid=2&page=1: subforums and paginated public threads./showthread.php?tid=1&page=1: paginated approved posts./showthread.php?pid=1#pid1: resolves the post's actual visible page and redirects to its preservedpid1anchor, after checking access./member.php?action=profile&uid=1: minimal public profile when the visitor's groups permit profile viewing. No accounts exist in the development seed./member.php?action=login,register,logout,requestreset,resendactivation,activate, andresetpassword: account forms. GET displays a form; account mutations require POST with CSRF and same-origin verification.
Accounts and password compatibility
Approved policy: use Argon2id for new/reset passwords and upgrade stock MyBB
salted-MD5 hashes on successful login. Encodings fit mybb_users.password without
schema changes. Vanilla MyBB cannot verify these upgraded credentials. Account
rollback needs an explicit credential strategy; do not silently restore obsolete
passwords after a reset. See the account security notes.
Sessions use opaque random cookies, hashed database identifiers, fixed expiration,
CSRF tokens, HttpOnly/SameSite cookies, and Secure/__Host- cookies for HTTPS.
MyBB cookies/sessions are not accepted. Password reset revokes YourBB sessions;
group changes and active bans are checked afresh on subsequent requests.
New accounts require email verification, start in MyBB group 5, and activate into
group 2. Registration uses conservative ASCII usernames and 12-character-minimum
passwords, also respecting stricter board length settings. Unsupported approval,
COPPA, required-custom-field, and additional password-complexity policies fail
closed. New registration is disabled by MyBB's disableregs setting or board closure.
Account POSTs are limited per socket-peer IP and endpoint; wrong passwords also trigger a persisted 15-minute account lockout after five failures. Limits are single-process and bounded in memory. Forwarded IP headers are not trusted: a reverse proxy shares its socket-peer budget until trusted-proxy support is added.
Posting, deletion and read tracking
/newthread.php?fid=2: create a thread and first post atomically./newreply.php?tid=1(optional"e=1): reply or quote an accessible post./editpost.php?pid=1: edit your own post, subject to permissions and edit window./editpost.php?pid=1&action=delete: confirm soft deletion. Deleting a first post hides its whole thread, including other authors' replies; records are retained./markread.php?tid=1or?fid=2: POST-only, per-user read markers. Buttons on thread/forum pages submit the visible page watermark or direct-forum timestamp.
All content mutations require a signed-in member, same-origin CSRF verification, and fresh authorization under SQLite's writer lock. Guests cannot post even if a MyBB guest group grants that permission. Locked forums/threads, suspensions, bans, inherited write/own-reply restrictions, edit windows, flood and daily quotas are enforced server-side. Administrator/display groups do not imply moderation bypasses.
Subjects are 1–120 characters and messages at most 16 KiB of valid UTF-8, also
respecting board length settings. Preview is read-only and uses the same safe
MyCode renderer. Stale edit/deletion forms return 409; repeated identical submissions
within 60 seconds are rejected. Pending approval rules save as visible=0; pending
threads/replies/edits are not exposed through ordinary browsing, even to their author.
Authorized staff can review and approve content through /modcp.php.
Post/thread/forum/user counters and last-post metadata are updated in the same transaction as the content. MyBB stores direct-forum counters, not persisted parent aggregates. The new development seed corrects its earlier category aggregate. To explicitly repair existing derived counters, back up and stop the server first:
bin/your_bb db:rebuild
This command never runs automatically and does not change messages or IDs. PHP serialized caches and historical daily statistics are not rebuilt. Read markers are explicit POSTs; GET browsing does not mark content read. Marking a forum affects its direct threads, not descendants. See posting notes for scope, counter semantics, read-marker granularity, and unsupported policies.
Who's online
Home, forum/subforum and thread pages list visible registered members active in
the last 15 minutes. Forum lists cover that exact forum and its accessible threads,
not descendants. Lists refresh on page loads; invisible members are never shown,
even to staff. MyBB's canviewonline viewer permission and profile-link permissions
are respected. See presence notes for privacy, limits and setup.
Fresh databases include the separate YourBB presence table. For an existing board, back up the intended database, stop the server, and run:
YOURBB_DB_PATH=data/local-test.sqlite3 bin/your_bb presence:upgrade
Restart afterward. This does not change existing account/group preferences or
extend login expiry. Existing boards must already grant canviewonline to the
intended viewer groups; older development fixtures may need an explicit grant.
Search
The top-right header search supports whole-board, current-forum (including accessible subforums), and current-thread scopes. Results show matching published posts with excerpts and direct post links, respecting browsing and MyBB search permissions. Search uses SQLite FTS5 and does not require JavaScript.
For an existing database, stop the server, back up, then run:
YOURBB_DB_PATH=data/local-test.sqlite3 bin/your_bb search:upgrade
YOURBB_DB_PATH=data/local-test.sqlite3 bin/your_bb search:check
Restart afterward. The upgrade preserves existing grants; review cansearch if
access is denied. See search notes for matching rules, maintenance,
privacy, limits and rollback precautions.
Board statistics
The home page ends with published post/thread totals for content you can access, registered-member count, newest member and Most members online at once. The online record excludes invisible members and guests and starts when tracking is enabled; it is not capped by the Who's online display list.
For the online record on an existing database, stop the server, back up, and run:
YOURBB_DB_PATH=data/local-test.sqlite3 bin/your_bb statistics:upgrade
Restart afterward. This requires the presence extension and preserves accounts, sessions, permissions and existing records. Other statistics work without this upgrade. See statistics notes for counting/privacy rules and operational limits.
Post ratings and reputation
On enabled boards, members can mark other members' posts Helpful (+1) and withdraw their own eligible ratings. Post-author and profile reputation totals link to paginated history, including imported signed/profile awards. Inaccessible post details are redacted. Pages and forms work without JavaScript, and reads never repair totals or change awards. Fresh development fixtures explicitly enable the feature; existing board settings and permissions remain unchanged. See reputation notes for permissions, limits, privacy and remaining scope.
Supermoderators can use Remove rating in reputation history to open an audited
confirmation form. Administrator/forum-moderator labels alone do not grant this
global permission. Offline reputation:check and reputation:rebuild commands
verify/repair cached totals without altering the award ledger; back up and stop
the server before rebuilding.
Moderation and administration
Signed-in staff can visit /modcp.php to approve/unapprove, soft-delete/restore,
and lock/stick threads using per-forum user/group assignments or supermoderator
grants. Restore returns content to pending approval. Hidden-content viewing and
mutation grants are checked separately; all changes include transactional counters
and audit records. cancp alone permits only the /admin.php landing page, not
mutation or moderation privileges. No default staff credentials are created.
See moderation notes for conservative scope boundaries.
Members can report eligible posts using Report. Staff with the relevant scoped and global feature grants can resolve/reopen reports and browse audit records. The moderation post view also offers safe staff editing and preview-confirmed move/merge/split operations. Structural tools require management and hidden-view grants in both forums, preserve post IDs/attachments/visibility, and recalculate counters atomically. Merge removes the emptied source thread metadata, not its posts; PID links survive, while its old TID URL does not. Bulk lifecycle actions are bounded to 25 selections and commit all-or-nothing. Permanent content deletion and automated warning/ban policy remain unsupported.
Administration sections require explicit MyBB mybb_adminoptions ACL grants:
user.users, user.groups, forum.management or config.settings. Every write
requires the current administrator password, CSRF verification and fresh transactional
authorization. Staff/system accounts, staff privileges and the actor's own account/
groups are protected from web edits. Imported administrator MFA fails closed.
To provision a known existing active UID, back up and stop the server first, then
run bin/your_bb admin:provision UID against the intended YOURBB_DB_PATH.
This explicit offline command grants bounded per-user admin permissions, preserves
credentials and revokes old sessions; it refuses existing user ACLs/MFA instead of
overwriting them. Sign in again and visit /admin.php.
See administration notes for the exact fields, provisioning
safeguards, ACL precedence and unsupported features.
Browsing and rendering limits
Each browsing request uses a query-only SQLite transaction so permissions and content come from the same snapshot. Browsing does not update sessions, read markers, counters, or views. MyBB cookies do not grant authenticated access.
Guest group 1 or the signed-in member's primary/additional groups are checked, using nearest inherited per-group forum overrides and boolean permission merging. Display groups never grant authority. Ancestor visibility, board closure, profile-view permission, banned groups, and active user bans are enforced. Password-protected/inactive ancestry, malformed ancestry, and ambiguous permissions fail closed. Own-thread-only access filters lists/counts and direct links by the authenticated author's ID; guests cannot own threads. Restricted and absent content return the same generic 404; a globally unavailable board returns 403. Redirect forums and moved-thread markers are currently omitted rather than followed.
Only visible=1 threads/posts are published. A thread must also have an approved,
consistent first post. Pagination counts are computed from visible content, not
stored counters that may include private or deleted material. Threads are sorted
sticky-first, then by latest approved post time and ID; posts use timestamp/ID
order. threadsperpage and postsperpage settings default to 20 and are bounded
to 1–100. Dates are shown in UTC. User-specific preferences, other sort modes,
friendly/SEO URLs, and action=lastpost/newpost links are deferred.
The MyCode subset supports [b], [i], [u], [s], [quote], [quote=name],
[code], [url], and [url=destination], including case-insensitive tags.
It honors the forum's allowmycode switch and always escapes HTML, regardless
of allowhtml. Links allow HTTP(S) and single-slash root-relative paths only.
Unsupported tags remain text; images, embeds, custom regex replacements, PHP,
and imported templates are never executed. Rendering is bounded to 16 nesting
levels and 256 KiB per message, with a visible truncation notice when necessary.
Rendering never modifies the stored message.
Public profiles expose only username, user title, and join date. Emails, IPs, signatures, custom fields, private-content totals, and credentials are not selected. Attachments, search, announcements, polls, signatures, and member lists are not implemented. See the stage 2 notes for validation scope.
Tests and optimized build
The default style follows browser light/dark preference automatically. Themes use semantic HTML and CSS-only overrides; see theme authoring for tokens, stable hooks, the paper example and offline specimen/browser checks.
Persistence uses Ormin by default; see Ormin usage and SQL exceptions for the remaining SQLite-specific queries and corruption-validation requirements.
nimble test
nimble release
Tests verify schema provenance/metadata, configuration, escaping, initialization
safety, guest/member permissions, pagination, MyCode, private-content isolation,
legacy links, Argon2id/legacy login, CSRF, activation/reset, session revocation,
registration races, posting permissions/limits, counter/audit rollback, concurrent replies,
safe previews, soft deletion, read tracking, scoped moderation/approval/restoration,
staff edits/reports/move/merge/split/bulk/audit review, staff concurrency,
administrative ACLs/reauthentication/provisioning, protected
user/group/forum/settings writes, trusted proxy and ban policies, CAPTCHA replay,
private outbox rollback, verified SMTP TLS/auth/activation/reset delivery, and
concurrent HTTP browsing/readiness.
They use isolated temporary databases and start/stop their own HTTP server.
GitHub Actions runs the same suite on Linux. Ormin currently emits upstream
compile-time warnings about unreachable code; Nim also warns about the legacy-only
std/md5 import. The build and tests still succeed.
Compatibility documentation
- MyBB compatibility contract
- Existing-forum inventory — information needed to confirm the schema baseline and migration scope
See schema provenance and licensing for the pinned upstream commit and regeneration procedure. Further work includes broader administration and production migration/security/load readiness. Moderator overrides, broader quota/plugin parity, operational service configuration and real-data validation still need work before production compatibility can be claimed. Validate against a sanitized representative MyBB installation before claiming production compatibility; current tests use synthetic data.
License
MPL-2.0
Vendored MyBB resources and the derived schema retain their upstream LGPL-3.0
license; accompanying LGPL and GPL terms are in schema/upstream/.