/

Developer Guide

Naming Conventions

Consistent naming lets a reader infer an artefact’s role from its name alone. CrowdVision spans several languages and layers, so the conventions are defined per layer below. They are enforced partly by ESLint and partly by review; treat them as mandatory.


Files and directories

Every Node service follows the same internal layout, so the file you want is always in the same place.

PathHolds
src/router.tsRoute declarations.
src/controller/HTTP adapters (one file per concern).
src/services/Business logic.
src/models/Schemas and shared types.
src/middlewares/Cross-cutting middleware.
src/config/Environment accessors and client setup.
__tests__/The service’s test suite.

Backend — Node.js / TypeScript

ArtefactConventionRecommendedAvoid
Controller / service filescamelCase, layer as suffix where it adds claritybuildings.ts, notificationService.tstwin_ctrl.ts, Notification.ts
Model filescamelCase file nameaccount.ts, buildingThreshold.tsAccount.ts, building_threshold.ts
Exported model and interfacePascalCase; interfaces prefixed Iexport interface IAccount, export const Account = model(...)export const account, export interface Account
Functions and variablescamelCasegenerateStandardToken, allowedColumnsGenerateToken, allowed_columns
ConstantsUPPER_SNAKE_CASEROLE_WEIGHTS, COOKIE_NAMEroleWeights
Database collectionsplural, lowercaseaccounts, buildingsAccount, building

Frontend — Vue 3 / TresJS

ArtefactConventionRecommendedAvoid
ComponentsPascalCase, multi-word (to avoid clashing with HTML elements), file and tagBuildingCard.vue, NotificationDropdown.vue, LeftMenu.vuecard.vue, header.vue
Views / pages (top-level routes)PascalCase with a View suffixDashboardView.vue, AdministrationView.vueDashboard.vue
ComposablescamelCase, prefixed useuseBuildingModel.ts, useAuth.ts, useSceneControls.tsbuildingModel.ts, getAuth.ts
Utilities / helperscamelCasemetrics.ts, formatTimestamp.tsMetrics.ts

Rust — contracts-service & twin-service

Both Rust services follow idiomatic Rust style.

ArtefactConventionExample
Modules and filessnake_casetunnel.rs, discovery.rs
Functionssnake_casestart_telemetry_tunnel, metric_is_allowed
Types (structs, enums)PascalCaseAppState, PreferenceDocument
ConstantsSCREAMING_SNAKE_CASERAW_CHANNEL, DEFAULT_COLUMNS

Go — Identity & Tenancy Control Plane

claims-gateway, tenancy-service, registry-service, and provisioner follow idiomatic Go style (gofmt, checked by go vet in just lint).

ArtefactConventionExample
Packages and filessnake_case or single lowercase word, matching the package nameinternal/api/handler.go, internal/store/
Exported functions and typesPascalCasefunc Mount(...), type Config struct
Unexported functions, types, and variablescamelCase (Go’s own export rule: capitalisation is visibility, not a separate style choice)func writeDomain(...), type handler struct, func isValidAccountID(...)
ConstantsPascalCase or camelCase per Go convention (no SCREAMING_SNAKE_CASE — that’s not idiomatic Go)as appropriate to exported/unexported

Package layout follows the standard Go project layout: internal/api (HTTP handlers), internal/service (business logic), internal/store (persistence, often with a storefake sibling for tests), internal/events (Redis Stream consumers/producers), internal/config.


Python — agent-service

The agent-service follows PEP 8: snake_case for modules, functions, and variables; PascalCase for classes; SCREAMING_SNAKE_CASE for constants. (The agent is maintained separately; these conventions are listed for completeness.)


Branches

Branch names mirror the commit types, so the branch announces its intent.

<type>/<short-kebab-description>
TypeExample
featfeat/private-domains
fixfix/jwt-expiry-off-by-one
chorechore/bump-dependencies
docsdocs/sensor-api-reference
refactorrefactor/extract-token-service

Commit scopes

Conventional-commit scopes use the service or area name, so history can be filtered by component.

feat(twin): add per-room colour overrides
fix(gateway): reject expired refresh tokens
docs(sensor): document the ingestion fast path
chore(ci): pin the kubeconform version

Common scopes: gateway (claims-gateway), tenancy, registry, provisioner, twin, sensor, notification, socket, contracts, client, agent, ci, docs, k8s. The full commit format is covered in Commits & Release Please.


Other identifiers

ArtefactConventionExample
Environment variablesUPPER_SNAKE_CASEGATEWAY_ISSUER, SENSOR_SERVICE_URL
Docker imagescrowdvision-<service> under the org namespaceghcr.io/nickghignatti/crowdvision-twin
Workflow files<category>-<name>&#46;yml (ci-, cd-, maint-)ci-twin.yml, cd-release.yml, maint-cleanup.yml
Documentation pageskebab-case &#46;qdbuilding-data.qd, naming-conventions.qd