docs/REPOSITORY.md

Repository guide

This guide is for contributors who need to find code or documentation, decide where a new file belongs or prepare the development toolchain. For the selected stack and version pins, see technology choices

Layout

PathContents
Repository rootThe license, the AGENTS.md navigation file and the Git attribute settings
docs/All repository documentation, including the public README. The README is a regular file, with no root copy or symlink
projects/The pnpm development workspace
projects/bot/The Fluxer bot package @neonflux/bot
projects/backend/The Convex backend package @neonflux/backend
projects/contracts/The shared contracts package @neonflux/contracts
projects/web/The dashboard and web verification package @neonflux/web
projects/site/The public site package @neonflux/site, with the homepage, feature pages and public docs
projects/evals/Labeled cases for the deceptive link judge, the lookalike name check, the typo hints, the feed post selection, anti-nuke and board visibility, and the baseline of cases they fail today, as the contributing guide describes
projects/scripts/The heavy-task gate that limits concurrent machine-heavy package scripts, with its test, the workspace doctor with its test, the Effect typecheck runner, the lint runner and the repository scans it runs, each with a test that plants a violation

The workspace manifest, workspace configuration and generated lockfile own shared dependency management. The Node version file owns the exact development runtime

Bot package

  • src/ holds the bot source. main.ts starts the process, config.ts reads the environment and bot.ts builds the SDK lifecycle, gateway routing, the hold on a starting server's events and the serial message pipeline
  • server-scope.ts routes commands to a server of the scope, and server-runtime.ts adopts the backend's scope and website origin at startup, binds one runtime and its backend adapters to each server and calls the backend's installation functions
  • backend-http.ts sends every backend request through the Convex client in convex-client.ts, and backend-routes.ts maps each request path to its backend function, whose name and kind the service contract owns. work-dispatcher.ts runs the one work dispatcher, and signalled-worker.ts is the wake-driven loop workers can share with contained.ts, which logs a failed background effect without stopping its worker. Its warnings name their cause only with the values cause-fields.ts lists
  • costs.ts counts the process's Fluxer requests, backend requests and events. usage.ts reports the backend calls to the bill guard and keeps its state, and optional-work.ts holds the admission that the bill guard pauses, the per-server buckets for autoresponder checks and logged webhook posts and the memory of members known to have no AFK status
  • channel-parents.ts is the one source of thread parents, including the forum a command in a forum post counts as in, from Fluxerly's channel cache and one read for a channel it does not hold. thread-memory.ts keeps the last seen state of threads for metadata logs, resource-memory.ts that of roles, channels, members and servers, message-revisions.ts recent messages and audit-changes.ts reads audit entries' before and after values for logs and security alerts. Ticket transcripts read a ticket channel and its public threads forward in ticket-transcripts.ts, which ticket-worker.ts runs whenever a save is due, and ticket-panels.ts keeps a server's ticket panels and opens a ticket from a panel reaction, and message cleanup picks the next active thread of a policy channel in cleanup-evidence.ts, each with its own Fluxer read
  • suggestion-forum.ts adds and applies the status tags of suggestion posts in a forum destination, and events.ts starts and closes event discussion threads
  • protections.ts sends messages and joins to automod and security, including webhook and other bots' messages for a server that checks them, and remembers whether each server does, so their messages cost nothing while it is off
  • reply-style.ts builds every status, detail and list reply once, from a title, labelled fields, an optional closing note that may hold commands, mentions and times and an optional plain footer, and renders it as an embed or as plain text in the style the server chose with its prefix in general-settings.ts
  • command-arguments.ts holds the argument forms commands share, paging.ts remembers where each list sent with next stopped, and runtime-reload.ts brings what running features keep in memory up to date after a dashboard change or a restored backup item
  • help.ts holds the one table of built-in commands that help pages and typo hints read, closest-name.ts decides which name a typo most likely meant, setup-check.ts owns !setup, !health with its safety audit, !recovery and the dashboard's permission check, and permission-fix.ts turns a missing permission or role position into the sentence that names its fix, and private-data.ts answers the website's access checks for private cases with the bot's own reads
  • tests/ holds the bot tests, which use the SDK's in-memory transport and the in-memory backend in backend-fake.ts. cost.test.ts records how many Fluxer and backend requests one ordinary event costs with every feature configured, on a server's first message and on a warm server
  • scripts/ holds the opt-in live smoke script. The test compiler checks it and Node runs it directly. smoke-live.example.json shows its configuration, and the private local copy stays ignored
  • tsconfig.json compiles src/ into dist/, and tsconfig.test.json checks source, tests and scripts without emitting

Backend package

  • convex/ holds the Convex functions. schema.ts owns every table, botService.ts owns the bot's key-checked public entry points, serviceKey.ts checks the key, crons.ts starts scheduled jobs and retention.ts runs every feature's bounded retention cleanup as one chain
  • valueDiff.ts lists the values that differ between two reads of a setting, which backup restore checks and audit log details share
  • protection.ts evaluates messages and joins for automod and security and checks text that NeonFlux posts for members against the content rules, and moderationLinks.ts judges deceptive links from the message text alone
  • convex/_generated/ is created by the Convex CLI and kept in version control
  • dashboard-contracts.d.ts and verification-contracts.d.ts are types-only exports of the website's own contracts. They re-export the shared types the website also uses and the generated types of the public functions it calls, and contain no runtime code or credentials
  • tests/ holds convex-test tests and *-contract.test.ts files that run the bot's backend adapters against an isolated backend fixture
  • scripts/ holds the motion challenge screenshot evaluation, described in the challenge evaluation guide

Contracts package

  • src/ holds one module per feature with an Effect Schema, and a type of the same name, for every request and answer between the bot and the backend. The bot imports them as @neonflux/contracts/<module>
  • common.ts holds IDs, limits and other building blocks, shared.ts the member and actor reads that many features send, and publishing-base.ts message content and the publishing grants, attempts and posts every posting feature shares
  • motion-captcha.ts holds the motion challenge's public frame format, palette, particle geometry and spark path bounds, which the backend and the website share. Seeds and route geometry stay in the backend
  • permission-names.ts holds Fluxer's titles for each permission bit, which the backend and the website show because they cannot load the SDK. A bot test compares every entry with the SDK
  • A module imports only these base modules and the modules of the features it builds on, never in a cycle
  • The backend decodes requests with decode from validation.ts, and each bot -store.ts decodes the answers

Web package

Site package

Find a feature

Each feature uses the same file prefix in both packages. In the bot, <prefix>-command.ts owns command grammar, -management.ts owns management replies, -permissions.ts owns native permission checks, which actions read fresh, -store.ts decodes backend answers with the feature's shared schemas and -worker.ts runs scoped background work. In the backend, <prefix>.ts owns queries and mutations, Domain.ts owns domain rules, Store.ts owns state helpers and Validators.ts owns persisted shapes. The requests and answers between them live in the feature's module of the contracts package

FeatureBot src/ prefixBackend convex/ prefixContracts src/ module
Bot foundation, AFK and responsesbot, main, config, reply-style, backend-http, backend-routes, convex-client, costs, message-revisions, protections, member-evidence, channel-parents, thread-memory, resource-memory, audit-changes, afk, response, responsesschema, botService, serviceKey, crons, retention, validation, protection, afk, response, responsescommon, shared, afk, responses
Moderation, automod, security and appealsmoderation, safety-permissions, action-executormoderation, appealsmoderation, appeal
Private cases on the websiteprivate-dataprivateDataprivate-data
Publishing and scheduled publishingpublishing, schedule, civil-calendarpublishing, schedules, civilDomainpublishing-base, publishing, schedules, civil
Role panels, rules and autorolerole, rolesrole, rolesroles
Role picker and member accessrolepickerrolePicker, memberAccessrole-picker
Temporary rolestemproletemporaryRolestemporary-roles
Newcomer checklistonboardingonboardingonboarding
Setup presetspresetpresetspresets
Welcome and goodbyewelcomegreeting, greetingsgreetings
Ticketsticket, ticketsticket, ticketstickets
Forum help desk, saved answers and thread budget guardhelpdeskhelpDeskhelpdesk
Showcases and profilesshowcase, profileshowcases, profiles, memberContentshowcases, profiles, member-content
Message levelinglevel, levelinglevelingleveling
Events, birthdays and suggestionsevent, events, milestone, suggestionevents, milestones, suggestionsevents, milestones, suggestions
Message cleanup and metadata logscleanup, metadata-logcleanup, metadataLogscleanup, metadata-logs
Security alerts and invitesalertsalertsalerts
Server-wide lockdownlockdownlockdownlockdown
Anti-nukeantinukeantiNukeanti-nuke
Jailjailjailjail
Bot-only staff rightsrightsrightsrights
Selective backupbackupbackupbackup, permission-names
Readable server exportserver-exportserverExportserver-export
Server structure editor on the websitestructurestructurestructure
Server analyticsanalyticsanalyticsanalytics
Temporary voice rooms, their controls card and website pagevoicevoicevoice
Rules for built-in commandscommand-rulescommandRulescommand-rules
Looking for grouplfglfglfg
Help, setup, health, recovery inbox and permission fixeshelp, setup-check, permission-fixsetupCheck, recoverysetup
Twitch live alerts and the EventSub callbacktwitchtwitch, httptwitch
Bluesky and X feedsfeedfeedfeeds
YouTube upload alerts and the WebSub callbackyoutubeyoutube, httpyoutube
Sticky messages, dashboard link and member list ordersticky, sidebar, memberliststicky, sidebar, memberListsticky, sidebar, member-list
Counter channelscountercounterscounters
Starboards and other boardsboardboardsboards
Personal remindersremindremindersreminders
Giveaways by reactiongiveawaygiveawaysgiveaways
Multi-server scope and installationsserver-scope, server-runtime, install-noteserverScope, serviceGuard, installationsservice
Background work dispatchwork-dispatcherworkDispatch, workSignalservice
Optional work limits and the bill guardoptional-work, usageusageservice
Dashboarddashboard, general-settingsdashboard, configuration, generalSettingsdashboard, general
Web verificationverificationverification, motionCaptcha, captchaDomain, turnstileverification
Audit log and member data rightsmember-dataauditLog, configurationChange, memberDatamember-data

Keep one-consumer code in its owning package, and introduce a shared package only for a demonstrated shared responsibility. Update this guide when ownership or navigation changes

Prepare the toolchain

Install the Node version in projects/.node-version and a pnpm 12 bootstrap, then run the following from projects/

sh
1pnpm install --frozen-lockfile
2pnpm run check

pnpm selects the exact version pinned in the workspace manifest. The aggregate check checks formatting with Prettier, then runs the lint, then the tests of the workspace scripts, then the contracts typecheck, then the backend checks, then the bot typecheck, build and tests, then the web build, which regenerates the route tree, and the web typecheck and tests, then the site build and tests. Tests need no live credentials. The opt-in live smoke runs separately through pnpm run smoke:live and is not part of the aggregate check

Use pnpm run build to compile the bot, website and public site and pnpm run start to run the bot's last build. During development, pnpm run dev:bot runs the bot from its source and restarts it on changes, pnpm run dev:web runs the website, pnpm run dev:site runs the public site and pnpm run deploy:dev publishes the backend once to the development deployment. The bot and website read a private .env described by their .env.example, and the backend's .env.example is a template for the Convex CLI's .env.local with only the deploy key. See the bot guide, the backend guide and the dashboard guide for environment setup. There are no production deployment or container commands yet

Generated and local files

  • Regenerate the lockfile through pnpm when dependency inputs change, review it and verify a frozen install
  • Regenerate convex/_generated/ against a configured deployment after changing the backend schema or function interfaces, as described in the backend guide
  • Dependency installs, compiler output, build caches and private .env files stay ignored through the workspace ignore rules and each package's own .gitignore
  • Keep ignore rules at workspace or package scope, not in a root .gitignore. Use Git's local .git/info/exclude for repository-root machine files
  • The workspace configuration allows build scripts only for the reviewed esbuild versions that Convex and the web build tools need, and exempts the pinned SDK release from the minimum release age. Review a changed script or version before updating these entries