Internal development guide¶
Gerege Nexus (gerege-systems/nexus-gerege-private, Go module github.com/gerege-systems/nexus-gerege-private/backend) is a private project.
This guide is for the authorized development team.
Монгол
·
English
Maintainers¶
- Gerege Systems Development Team (@gerege-systems)
- Gemini AI, Claude AI
Development workflow¶
1. Reporting bugs¶
Check the open issues first so you don't file a duplicate. A good report includes:
- Clear steps to reproduce.
- Your environment (Go version, Node.js version, OS, PostgreSQL version).
- Expected versus actual behaviour, with logs where possible.
2. Suggesting enhancements¶
Describe the use case, the problem you are solving and the solution you have in mind.
3. Submitting pull requests¶
- Create a branch —
git checkout -b feature/amazing-feature. - Follow the code conventions:
- Backend: Go 1.26+,
gofmtformatting, structured logging withslog, explicit error handling. - Frontend: Next.js 16 App Router, TypeScript strict mode, Tailwind CSS.
- Write tests — new backend logic ships with
*_test.gocoverage. - Run the verification suite:
# Backend: format, static analysis, tests
cd backend
gofmt -l .
go vet ./...
go test -race ./...
golangci-lint run
# Frontend: typecheck and build
cd ../frontend
npx tsc --noEmit
npm run build
- Commit messages follow Conventional Commits:
feat: add invoice management modulefix: resolve stock level calculation roundingdocs: update module authoring guide- Open the PR against
main. Lint, tests, the frontend build and the security scans must all be green.
Adding a new business module¶
Business modules do not live in this repository but in a distribution
repository — backend/internal/apps is the assembly point and is empty on
purpose.
- In the distribution repository, create a package (
modules/<module_name>/) that implements thenexus.Moduleinterface frombackend/pkg/nexus. - Call
nexus.Register(m)from its constructor; if it brings its own schema, alsonexus.Migrations(id, fs)(it runs under its ownpublic.goose_db_version_<slug>table). The distribution'smain.goconstructs its modules and callshost.Run. - Add
catalog/manifests/<slug>.json(it must matchManifestinpkg/catalogexactly — a malformed manifest stops the server from booting),catalog/chronicle/<slug>.json, and an entry in the distribution'scatalog/apps.json. An installation refuses a module the binary carries but the catalogue does not name. - Screens live in the core shell under
frontend/app/module/<slug>/; register the app's dictionary from that route'slayout.tsx(Translation).
Writing a module walks through this in detail, and Distribution describes the contract with the core.
Pull requests that touch backend/pkg/nexus¶
This package is the ecosystem's contract: every distribution repository compiles against it and pins it by tag. Therefore:
- CODEOWNERS review is required (
.github/CODEOWNERS). - If the exported surface changes, run
go test ./pkg/nexus -updateand include thetestdata/api.txtdiff in the PR. That diff tells the review exactly what the contract gained or lost. - A breaking change goes deprecation → one major cycle. The rules are in the "Хувилбарын амлалт" (versioning promise) section of Writing a module.
Theming a deployment¶
The whole UI is built on @gerege-systems/ui, and the single source of tokens
is the library's theme.css. The legacy --gerege-* names are aliases of those
tokens (frontend/app/globals.css). So every installation tunes its look on
ui.gecore.mn/#theme and supplies only what Get code hands out:
- The
<html>attributes it names → theBRAND_THEME_STYLE,BRAND_THEME_DEPTH,BRAND_THEME_RADIUSandBRAND_THEME_ACCENTenvironment variables. - The printed
:root/.darkblock → a./brand/theme.cssfile withBRAND_THEME_CSS_FILE=/brand/theme.css(or, for a line or two, inline inBRAND_THEME_CSS).
No core code changes; the block lands at the end of <body> and overrides both
the library's and the core's tokens. The core's own look is written as exactly
such a block (globals.css, the "Theme editor" section; style nexus, depth
soft, Gerege blue). Only when a user picks an accent under Settings →
Appearance is data-accent set, overriding the installation's colour in that
browser; the "This deployment's" option returns to it.
BRAND_THEME_COLOR is separate from all of these: it is the hex colour of the
PWA manifest and <meta name="theme-color"> (the browser toolbar, the installed
app's window). It does not affect UI tokens, so give it a colour close to the
accent. The full list for a distribution is in Distribution.
Documentation and translations¶
- Mongolian is the primary language. Translations live under
docs/with the_AR,_EN,_ES,_FR,_RUand_ZHsuffixes (the README in all six;DEVELOPMENTandSECURITYin_ENonly). When the Mongolian source changes, translations must keep the same structure. - Do not use emoji in documentation. Where an icon is needed, use the
Flaticon assets in
assets/icons/and add the source toATTRIBUTION.md. - See
README.mdfor how to add a new translation.