Introducing a new way to review your PRs.

Read the announcement

ever-co / ever-gauzy

Ever® Gauzy™ - Open Business Management Platform (ERP/CRM/HRM/ATS/PM) - https://gauzy.co

View on GitHub

27 documents · Updated Nov 23, 2026

docs / api-application-lifecycle

API application lifecycle

The API application turns deployment settings and enabled plug-ins into a running HTTP and GraphQL service. Its lifecycle loads configuration, starts observability, assembles product capabilities, prepares the database, serves public files, and then exposes the service. The desktop server can host this API as a child process beside a separate UI file server. See the backend platform page for the wider server model.

Lifecycle stages

Startup sequence

The API starts from apps/…/main.ts. Its first import loads local environment files before core or plug-in modules read the environment. The bootstrap then validates settings, combines core and plug-in resources, creates the web application, prepares shared services, and starts listening.

The main startup path is:

flowchart TD
    A[Load process environment] --> B[Start early tracing]
    B --> C[Build application and plug-in configuration]
    C --> D[Register entities subscribers and composition bindings]
    D --> E[Create web application]
    E --> F[Configure security sessions routes and assets]
    F --> G[Run pending database migrations]
    G --> H[Seed an empty database]
    H --> I[Expose API and GraphQL endpoints]
    I --> J{Demo mode}
    J -->|Yes| K[Run demo seed after listen]
    J -->|No| L[Continue serving requests]
    K --> L

The service does not accept requests until the core bootstrap has prepared the application and the initial database check has completed. Demo data is different: the demo seed starts after the server announces that it is listening. This keeps normal startup separate from the larger demo-data load. See background jobs and scheduling for work that runs after startup as a service concern.

References: apps/…/main.ts• L1-33 apps/…/preload-env.ts• L1-31 packages/…/index.ts• L65-85 packages/…/index.ts• L222-269

Desktop-hosted application

The desktop server is the local host for an API process and a separate UI file server. It reads saved installation settings, persists per-install secrets before the API starts, and passes database, API address, and desktop flags to the child API. The same settings decide whether the API and UI listen only on the local machine or on every network interface for LAN access.

The desktop lifecycle has two readiness boundaries:

flowchart TD
    A[Load desktop settings] --> B[Resolve paths and per-install secrets]
    B --> C[Start API child with environment]
    B --> D[Start UI file server]
    C --> E[API bootstrap and database readiness]
    D --> F[UI files available on UI host and port]
    E --> G[Desktop window and remote clients use the service]
    F --> G

The desktop process can start, stop, and restart the API without rebuilding its configuration. The API receives the persisted secret and seed credentials so restarts keep sessions valid and newly seeded accounts do not use published passwords. The UI server uses a separate port and does not provide SPA fallback for missing files.

References: apps/…/index.ts• L74-90 apps/…/index.ts• L372-395 apps/…/index.ts• L403-438 apps/…/desktop-server-api.ts• L18-45 apps/…/desktop-server-api.ts• L59-88

Configuration assembly

Configuration assembly creates one application configuration from environment values, API defaults, database settings, asset paths, logging, and the active plug-in list. apps/…/plugin.config.ts supplies the API-level choices. The core bootstrap applies these choices before it creates the Nest application.

The configuration has four important roles:

AreaPurpose
API settingsSelect the host, port, base URL, and GraphQL path.
Database settingsSelect the database engine, ORM, connection behavior, and migration policy.
Asset settingsConnect packaged seed assets and the public asset directory.
Plug-in settingsLet enabled plug-ins add their resources and configuration.

The bootstrap registers core and plug-in entities and subscribers as one database model. The API also adds a composition module that binds capabilities between independently installed commerce plug-ins. These bindings do not add routes or tables. They make a deployment choice explicit while keeping the packages separate. This configuration boundary connects the API application to the domain services and contracts described in domain services and contracts.

The database settings select the database engine and ORM behavior from validated environment values. The service can create TypeORM, MikroORM, and Knex connection profiles for the supported database types. SQLite uses a compatible MikroORM driver so both ORM views share date storage and comparison rules. Database helpers also keep null filters fail-closed, validate numeric settings, and support a database CA certificate as either PEM text or base64 text when TLS is enabled.

References: apps/…/plugin.config.ts• L63-131 apps/…/plugin-composition.ts• L74-105 packages/…/index.ts• L4-18 packages/…/database.ts• L27-61 packages/…/database.ts• L191-226 packages/…/database.ts• L296-352 packages/…/database-helpers.ts• L26-27 packages/…/database-helpers.ts• L51-179 packages/…/database-helpers.ts• L187-238 packages/…/database-tls-options.spec.ts• L1-73 packages/…/index.ts• L418-457 packages/…/index.ts• L467-485 packages/…/index.ts• L498-575 packages/…/database.module.ts• L13-98

Environment settings

Environment sources

The API reads settings from the process environment and from dotenv files in the current API directory. apps/…/preload-env.ts loads those files as the first side effect of the API entry point. apps/…/load-env.ts loads .env as a default source, then loads .env.local with override enabled. Values from the starting process environment remain above .env.local only when their names appear in the starting ENV_LOCAL_NO_OVERRIDE list. This lets a deployment keep computed values such as forwarded URLs while local files still provide normal development defaults. The preload also sets a larger default Node thread pool when no value is present, which gives connection, password, and file work more room to run in parallel.

The environment model groups settings by system concern instead of passing raw variables through the application. It covers service addresses, database and storage access, authentication secrets, mail, external integrations, feature switches, observability, desktop mode, and demo mode. It also carries controls for rate limits, failed-login lockout, trusted client-address forwarding, self-service registration, and Activepieces integration. Development and production models share the same shape but use different defaults and checks.

Production refuses to load when required authentication and session secrets are missing or use known weak defaults. Feature switches use an opt-out rule in the shared environment model: a feature is enabled unless its variable is an explicit disabling value. Some optional plug-ins use a stricter opt-in rule and load only when their switch is exactly true; invalid values are rejected or warned about by the plug-in's enable check.

Secret resolution avoids a published fallback for token and session signing. An explicit value is used as provided. A missing or blank value gets one random value for the process and a warning. Production treats that generated value as not configured and refuses to start, while API replicas and seed commands must receive the same explicit value when they share tokens or sessions.

Production request throttling is enabled unless its setting is an explicit disabling value. The production model can also trust a Cloudflare client-address header only when the deployment enables that path, or trust a signed address from the Ever Teams service when the shared secret is present. This keeps the production safety default different from development without changing the shared environment shape.

Integration configuration follows the same typed environment boundary. Activepieces settings include platform credentials, tenant project behavior, an external project ID prefix, and the selected MCP API mode. These values let the integration use platform-managed tenant projects or tenant-owned keys without exposing raw environment lookups to the rest of the API.

References: apps/…/preload-env.ts• L1-31 apps/…/load-env.ts• L5-76 apps/…/load-env.spec.ts• L46-86 apps/…/plugins.matrix.spec.ts• L486-527 packages/…/activepieces.ts• L7-22 packages/…/environment.ts• L20-35 packages/…/environment.ts• L81-109 packages/…/environment.prod.ts• L20-53 packages/…/environment.prod.ts• L59-87 packages/…/environment.prod.ts• L112-139 packages/…/environment.prod.ts• L252-262 packages/…/ienvironment.ts• L59-70 packages/…/ienvironment.ts• L103-127 packages/…/ienvironment.ts• L160-167 packages/…/secret-resolver.ts• L40-105 packages/…/auth-switches.helper.ts• L1-109 packages/…/auth-switches.helper.spec.ts• L1-95

Runtime safety settings

Some environment settings change the safety boundary of the running service. The bootstrap validates application secrets, limits request bodies, applies CORS rules, uses security headers, and selects Redis or in-memory sessions. These settings protect the service while also defining whether browser clients and server-to-server callers can reach it.

The API uses /api as its global route prefix. GraphQL uses its configured path outside that prefix and receives its own request context setup. When ALLOWED_ORIGINS is absent, it permits all origins and logs a warning in production. When trusted origins are present, it enables credentialed requests only for those origins. The cross-origin resource policy also has a validated environment setting so an invalid value falls back instead of stopping security middleware setup. Health probe routes bypass session handling, so their response does not depend on Redis or create probe sessions.

References: packages/…/index.ts• L68-111 packages/…/index.ts• L113-173 packages/…/index.ts• L181-217 packages/…/index.ts• L296-324 packages/…/redis-store.ts• L33-50 packages/…/redis-store.ts• L125-157

Observability and plug-ins

Observability initialization

Observability means the signals used to understand service health and behavior. The API starts OpenTelemetry tracing before it loads the rest of the bootstrap modules when OTEL_ENABLED is true. This early position lets tracing cover application startup as well as request work. Tracing can cover HTTP, framework, cache, and database activity and sends spans through the selected trace exporter.

Sentry is enabled when a DSN is present. It reports errors and sampled traces under the API version and environment. The API does not print the DSN. Sentry debug output and event levels are controlled separately, while trace and profile sampling use configured rates. PostHog is enabled only when both its feature switch and API key are present. Trace logs redact credential-bearing URLs and expose only safe indicators for secret headers and API keys. The API can use these services as application loggers, while the normal process handlers remain in place when no Sentry logger is configured.

References: packages/…/index.ts• L9-28 packages/…/tracer.ts• L41-184 apps/…/sentry.ts• L5-41 apps/…/posthog.ts• L4-31 apps/…/plugin.config.ts• L96-120 apps/…/plugins.ts• L76-86

Plug-in registration

A plug-in is an optional product or integration module that can add API behavior and data resources to the application. apps/…/plugins.ts is the API's registration point. It includes observability, analytics, and optional identity providers only when their settings allow them. It then registers AI, document, media capture, changelog, integration, job, knowledge-base, commerce, product review, and registry capabilities.

The API resolves declared plug-in dependencies before mounting the list. This means a prerequisite must be present and load first, while unrelated plug-ins keep their configured order. The AI group combines a chat engine with cloud, local, compatible, and speech providers. The document hub follows the AI plug-ins so its provider registry is ready first. Commerce plug-ins declare their own dependencies, and the load-order resolver checks those declarations before mounting them.

The composition module binds ports between separate commerce packages at the installation boundary. For example, cart pricing, tax, promotion, stock, shipping, and payment behavior come from the packages that own those rules. If a required binding is absent, the consuming capability can remain unavailable instead of silently accepting caller-supplied values. During bootstrap, plug-ins contribute modules, entities, subscribers, migrations, and configuration functions. The seeder loads the same plug-in graph, but it disables scheduled execution while it performs data work. See plug-in architecture for the plug-in model and background jobs and scheduling for long-running work.

Optional plug-ins are absent from the running application when their enabling conditions are not met. This means a disabled identity, telemetry, integration, inbox, or email provider plug-in does not add its routes, timers, tables, or outbound requests. The API's matrix checks cover the independent switches and the required order for dependent inbox email providers.

References: apps/…/plugins.ts• L75-127 apps/…/plugins.ts• L149-182 apps/…/plugins.ts• L223-267 apps/…/plugin-composition.ts• L74-105 apps/…/plugin-composition.ts• L107-280 apps/…/plugin.config.ts• L122-130 apps/…/plugins.matrix.spec.ts• L118-181 apps/…/plugins.matrix.spec.ts• L252-365 apps/…/plugins.matrix.spec.ts• L366-484 packages/…/index.ts• L565-627 packages/…/seeder.module.ts• L24-73

Process work ownership

The application module assigns background work to the API or to the worker process. When the deployment enables the shared queue, the API creates only the queue connection needed to publish work and leaves scheduled job execution disabled. This keeps scheduled jobs in the worker and prevents duplicate runs.

Without a queue, the API can dispatch event-outbox work in its own process unless that fallback is disabled. Timer reminders are off unless GAUZY_TIMER_REMINDERS_ENABLED is exactly true; with reminders enabled, the application selects the queue-backed or in-process path that matches the deployment. The seed application follows the same queue decision but never starts scheduled jobs. See background jobs and scheduling for the worker responsibilities and runtime effects.

References: packages/…/app.module.ts• L646-718 packages/…/is-queue-root-enabled.ts• L15-55 packages/…/event-outbox-inline-dispatch.ts• L8-35 packages/…/timer-reminder-enabled.ts• L1-23 packages/…/seeder.module.ts• L48-73

Asset serving

Public asset boundary

The API serves files below /public/ from a configured public directory. The directory is selected for the runtime form: development uses the source tree, production uses the built or deployment layout, Docker uses its fixed application paths, and Electron uses the user's application path.

The public directory is the shared boundary for user uploads and generated or seeded files. The server serves these files without API authentication because clients need direct access to images and other public resources. It adds nosniff and a sandbox content security policy to reduce the risk that an uploaded file runs as active content.

References: apps/…/plugin.config.ts• L27-58 apps/…/plugin.config.ts• L92-95 packages/…/helper.ts• L19-50

Desktop UI asset boundary

The desktop server exposes the built UI from its selected data/ui directory on a separate HTTP listener. The listener uses the saved host choice: 127.0.0.1 keeps the UI local, while 0.0.0.0 permits LAN clients when sharing is enabled.

The file boundary serves index.html for a directory and redirects directory URLs to a trailing slash. It returns controlled 400, 403, and 404 responses for malformed or unsafe paths, keeps requests inside the UI directory, and applies one-hour caching to successful files. This protects a network-visible desktop UI without changing the normal file response shape.

References: apps/…/ui-server.ts• L3-15 apps/…/server-manager.ts• L3-15 apps/…/static-file-server.ts• L10-28 apps/…/static-file-server.ts• L30-45 apps/…/static-file-server.ts• L65-80 apps/…/static-file-server.spec.ts• L67-111

Packaged API resources

The API build carries the non-UI packages needed by the server into its runtime package area. The copy process scans built package directories, skips build output and known UI-only packages, and stops at package boundaries. It also keeps copied packages in their compiled form so class names remain available to dependency checks and runtime framework contexts.

Production and development builds select the matching compiled environment for the copied @gauzy/config package. The selection is made while each API output is copied, so concurrent builds do not depend on whichever shared package build ran last. Copied source maps are rebased so debugger links and stack traces still resolve to the original package sources after the move. The copy transform is safe for watch builds and leaves unreadable maps unchanged rather than failing the build.

The API has several Node build targets for normal, desktop, and hosted server forms. They share the asset and package-copy boundary while writing to different output locations. The custom Webpack configuration watches core source in development and keeps server classes compatible with copied packages.

References: apps/…/custom-webpack.config.js• L19-85 apps/…/source-map-rebase.js• L3-13 apps/…/source-map-rebase.js• L37-97 apps/…/source-map-rebase.test.mjs• L65-143 apps/…/source-map-rebase.test.mjs• L146-205 apps/…/webpack-package-copy-patterns.js• L19-56 apps/…/webpack-package-copy-patterns.js• L103-203 apps/…/webpack-package-copy-patterns.js• L209-279 apps/…/project.json• L15-53 apps/…/project.json• L83-209

Seed asset flow

Seed workflows copy packaged source assets into the public directory before records refer to them. The packaged asset set includes default and named profile images plus integration branding such as Asana, Linear, Trello, and the Ever Works icon. Seed records use the same public asset paths.

The source may be the configured asset path or the Electron seed path. The destination follows the configured public path and a named asset group such as avatars, screenshots, reports, features, or integrations. This split lets the same seed data work from source, a build, Docker, or a desktop package. If a source file is missing, the copy is skipped and the workflow reports the missing path. Cleanup removes old generated seed files while preserving repository marker files.

References: apps/…/aiden.png• L1 apps/…/carter.png• L1 apps/…/jasmine.png• L1 apps/…/john.png• L1 apps/…/rafael.png• L1 apps/…/ronan.png• L1 apps/…/asana.svg• L1-6 apps/…/linear.svg• L1-10 apps/…/trello.svg• L1-5 apps/…/ever-works.svg• L1-12 packages/…/default-employees.ts• L18-39 packages/…/default-candidates.ts• L3-22 packages/…/utils.ts• L39-115 packages/…/utils.ts• L118-151 packages/…/screenshot.seed.ts• L45-53

Database and seed workflows

Migration lifecycle

A migration is a versioned database change that moves the schema from one known state to the next. The API prepares migration paths and includes core and plug-in database resources in the connection configuration. In normal startup, migrations run automatically unless DB_SYNCHRONIZE is set to true.

The application supports better-sqlite3, SQLite-compatible operation, PostgreSQL, and MySQL. PostgreSQL startup and command-line migration runs use a database-level advisory lock so two API processes do not apply the same pending migrations at the same time. SQLite transactions and standalone statements use a single connection queue so concurrent work cannot share one transaction by accident. Migration commands use a separate connection, run each migration in its own transaction, and close that connection when the command ends.

The migration set includes a tenant-local invoice number rule. Invoices and estimates can reuse a number in different tenants while keeping one sequence inside each tenant. This matches tenant-scoped number lookup and prevents one tenant from learning or changing another tenant's number range. A revert is refused after cross-tenant duplicates exist because the old installation-wide rule cannot represent that state. This change is applied through the normal migration lifecycle for each supported database type and relates to the invoice data used by subscription billing.

The API package exposes runtime and build commands for database maintenance and seed work:

WorkflowResult
migration:runApplies all pending migrations.
migration:revertReverts the last applied migration.
migration:generateCreates a migration from detected schema changes.
migration:createCreates an empty migration for a manual schema change.
seed, seed:all, seed:moduleRun the matching development seed workflow.
seed:prodRun the default seed workflow with production environment rules.

Generated migrations include database-specific paths for supported SQLite, PostgreSQL, and MySQL targets. The migration list combines platform migrations with plug-in migrations before the connection opens, so a plug-in's schema travels with its plug-in.

References: apps/…/package.json• L20-41 apps/…/source-map-rebase.js• L81-97 apps/…/plugin.config.ts• L77-90 packages/…/database.ts• L51-61 packages/…/database-helpers.ts• L51-179 packages/…/index.ts• L645-689 packages/…/database.module.ts• L57-94 packages/…/migration-executor.ts• L22-43 packages/…/migration-executor.ts• L212-248 packages/…/migration-run-lock.ts• L79-107 packages/…/embedded-transaction-queue.ts• L40-77 packages/…/migration.ts• L7-66 packages/…/1790000015400-AlterInvoiceNumberUniquePerTenant.ts• L6-19 packages/…/1790000015400-AlterInvoiceNumberUniquePerTenant.ts• L44-95 packages/…/1790000015400-AlterInvoiceNumberUniquePerTenant.ts• L128-197

Empty database initialization

After the application creates its database services, bootstrap checks whether the database needs initial data. The check uses the selected ORM context so repository access remains scoped correctly. This path supplies the minimum data needed for a usable API without requiring an operator to run a separate seed command for every new database.

Demo mode adds a second step after the server starts. It creates the larger demo data set only when the database is empty. This separates safe service startup from optional sample data and allows the service to announce readiness before the demo load completes.

References: packages/…/index.ts• L361-363 packages/…/index.ts• L498-546 packages/…/seed-data.service.ts• L304-335 packages/…/seed-data.service.ts• L389-414

Standalone seed workflows

Standalone seed entry points create a short-lived application context with the same plug-in configuration used by the API. They are intended for controlled data setup rather than request handling. The available scopes are default data, all data, job data, Ever data, and a named module seed.

The all, default, and Ever workflows reset data before they insert their selected data set. The job workflow adds job-related sample data. The module workflow maps a command name to a matching seed action and reports an error when that action is not available. The all-data workflow is destructive and must not be used against a production database.

References: apps/…/package.json• L35-41 apps/…/seed.ts• L1-7 apps/…/seed-all.ts• L1-7 apps/…/seed-jobs.ts• L1-7 apps/…/seed-ever.ts• L1-7 apps/…/seed-module.ts• L1-7 packages/…/seed-all.ts• L11-37 packages/…/seed-module.ts• L33-73 packages/…/seed-data.service.ts• L270-365

Service readiness

HTTP and GraphQL exposure

The service publishes API routes below /api and exposes GraphQL at the configured GraphQL path. It sets the host and port from application configuration, prepares API documentation, and then calls the HTTP server listen step. The readiness message is also sent to a parent process when the API runs under a desktop host.

Authentication and session setup apply before request handling. A global guard protects routes by default, while CORS and security headers define which clients can use the service. These boundaries connect this lifecycle to identity and access control.

References: packages/…/index.ts• L127-165 packages/…/index.ts• L238-265 packages/…/index.ts• L369-412

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the environment preload as the first API entry-point import. Otherwise feature switches can be read before .env.local overrides are applied.
  • Keep .env, .env.local, and ENV_LOCAL_NO_OVERRIDE precedence aligned with deployment tooling when changing environment loading.
  • When adding an environment value, update the shared interface and both development and production environment models if the value has different defaults or safety rules.
  • When adding a plug-in entity, subscriber, or migration, check its name or timestamp against core resources and other plug-ins. Ensure the seeder loads the same plug-in graph.
  • When adding or changing a plug-in dependency, keep the declared prerequisite in the API list and preserve the intended order for dependent provider registries.
  • When adding a conditional plug-in, keep its enable rule aligned with its routes, timers, tables, outbound calls, and seed behavior.
  • When changing ORM or database settings, keep TypeORM, MikroORM, and Knex profiles aligned. Preserve SQLite date compatibility, null-filter safety, integer validation, and TLS certificate handling.
  • When changing migration registration, preserve timestamp ordering, PostgreSQL run locking, SQLite transaction serialization, and database-specific generated SQL.
  • When changing asset layout, update both the API public path and the seed source path so records do not point to missing files.
  • When changing API build packaging, keep server packages included, UI-only packages excluded, copied source maps rebased, and the compiled environment selected per output.
  • When changing seed actions, keep the API empty-database path and standalone seed entry points aligned with the same data assumptions.
  • When changing observability initialization, preserve early tracing, safe credential logging, and the conditions that decide whether Sentry or PostHog receives logs.
  • When changing signing or session secrets, give every process that shares tokens the same explicit value and keep production rejection of generated values.
  • When changing health routes or session setup, keep probe requests independent of the session store.
  • When changing queue or maintenance gates, keep the API, worker, plug-in graph, and seeder on the same queue-root decision. Ensure the API has either a queue consumer or its intended inline outbox fallback.
  • When changing desktop startup, keep the saved API settings, child-process environment, UI host, and API host aligned. A local-only setting must not leave one listener exposed on the LAN.
  • When changing desktop secrets or seed credentials, persist them before starting the API and keep restart behavior consistent with existing sessions and seeded accounts.
  • When changing the desktop UI file server, preserve the root boundary, controlled error responses, directory redirects, and cache contract for LAN clients.
  • When changing auth or client-IP switches, keep exact opt-in rules, on-by-default registration rules, proxy trust, and signed forwarding requirements explicit.

Important failure modes

TriggerConsequenceGuard
The environment preload is moved below another main.ts importCore or plug-in configuration can ignore .env.local switches.Keep preload-env as the first import.
A starting deployment value is not listed in ENV_LOCAL_NO_OVERRIDE.env.local can replace a computed address or other deployment value.Set the list in the starting process environment and test the final value.
Production starts with missing or weak JWT or session secretsStartup stops before the API accepts requests.Set unique production secrets. Production validation rejects known defaults.
A token or session secret is missing in a non-production processA random process-local key is used, so tokens and sessions stop working after restart or across processes.Set one strong explicit value for every process that must share the key.
DB_TYPE is misspelled or uses an unsupported engineStartup fails with a clear configuration error instead of building an incomplete connection profile.Use a supported database type.
Database TLS is enabled without a usable CA certificateThe database connection cannot verify its server.Set DB_CA_CERT as valid PEM text or base64 text.
Two PostgreSQL processes start migrations without the run lockThe same migration can run or be recorded twice.Keep the advisory lock around the whole migration run.
SQLite work bypasses the embedded transaction queueRequests can share a transaction or receive misleading commit and rollback results.Use the serialized data source for SQLite transactions and statements.
A plug-in migration has no unique timestampBootstrap refuses to assemble the migration list.Give every plug-in migration a unique timestamp.
A plug-in resource conflicts with a core entity or subscriber nameBootstrap fails while assembling the application model.Check resource names before registration.
A plug-in declares a dependency that is not in the configured listThe API refuses to boot instead of exposing a partial capability set.Install and register every declared prerequisite.
An enabled plug-in lacks a required package in the built API outputThe API can fail during module loading or omit a capability at runtime.Keep package copy rules aligned with the server plug-in set.
Copied source maps keep paths for their old directoryDebugger links and stack traces point to paths that do not exist in the built API.Apply the source-map rebase transform during package copying.
A configured asset source or public path is wrongSeed records can refer to files that are not available at /public/.Verify source and destination paths for the current runtime form.
ALLOWED_ORIGINS is missing in productionBrowsers from any origin can receive CORS access, and the API logs a warning.Set a comma-separated list of trusted origins.
Redis is unavailable while a health probe runsThe probe must not wait for session storage or create a session.Keep health routes outside session middleware and check other readiness signals separately.
A migration revert would restore installation-wide invoice number uniqueness after tenants reused a numberThe revert stops before restoring the old constraint.Reconcile cross-tenant duplicates before a revert.
The all-data or default seed runs against a live databaseExisting data can be deleted or replaced.Use destructive seed workflows only against an isolated database.
The API or seeder registers queue consumers without the shared queue rootBootstrap can fail because a consumer has no queue connection.Use the shared queue-root predicate and keep queue settings consistent across processes.
No queue exists and inline event dispatch is disabledEvent-outbox rows can grow while subscriptions, search updates, and webhooks remain undelivered.Keep a queue consumer or leave the inline fallback enabled.
Timer reminders use a value other than exact trueTimer reminders stay off, even when an operator expects a truthy value.Set GAUZY_TIMER_REMINDERS_ENABLED=true.
Desktop API and UI hosts use different LAN settingsOne part of a shared desktop service can be unreachable or exposed more widely than intended.Derive both listeners from the same saved access policy.
The desktop API starts without its persisted signing or session secretExisting sessions fail after restart, or separate desktop processes reject each other's tokens.Resolve and persist per-install secrets before the child API starts.
A LAN UI request contains a NUL byte or path outside the UI rootThe file server could crash or disclose a sibling directory.Keep the safe static handler and its 400/403 path checks.
Production trusts a forwarded client-IP header without a trusted proxy or signed sourceA caller can change its apparent address and avoid shared rate limits.Enable proxy trust only for the matching deployment and use the shared Ever Teams secret for signed forwarding.

Key files

FileWhy to read it
apps/…/main.tsShows the API entry point, startup timing, and handoff to core bootstrap.
apps/…/preload-env.tsEnsures environment files and the thread-pool default load before core and plug-in configuration.
apps/…/load-env.tsDefines environment file order, override behavior, and deployment value preservation.
apps/…/plugin.config.tsShows the assembled server, database, asset, logger, and dependency-ordered plug-in settings.
apps/…/plugins.tsShows conditional integrations, AI providers, product plug-ins, and the registration boundary.
apps/…/plugin-composition.tsShows how this installation binds capabilities between independent commerce packages.
apps/…/plugins.matrix.spec.tsShows the contract for exact feature switches, dependent plug-ins, and boot-time environment ordering.
apps/…/source-map-rebase.jsShows how copied package source maps keep debugger and stack-trace paths valid.
apps/…/webpack-package-copy-patterns.jsShows how the API build selects server packages, selects the compiled environment per output, and excludes UI-only packages.
apps/…/project.jsonShows API, desktop, and hosted server build targets and their runtime asset layout.
apps/…/package.jsonShows the API start, build, migration, and seed entry points.
apps/…/index.tsShows the desktop host lifecycle, persisted settings, child API start, UI paths, and stop/restart handoff.
apps/…/desktop-server-api.tsShows how saved desktop settings become the API child process environment.
apps/…/ui-server.tsShows the desktop UI listener and its local-versus-LAN host choice.
apps/…/static-file-server.tsShows the safe desktop UI file boundary and response behavior.
apps/…/static-file-server.spec.tsShows the desktop UI serving contract for files, redirects, errors, and traversal protection.
packages/…/index.tsShows the public configuration surface used by the API.
packages/…/environment.tsShows development defaults and typed environment settings.
packages/…/environment.prod.tsShows production defaults and startup secret checks.
packages/…/auth-switches.helper.tsDefines self-service registration and administrator password-reset controls.
packages/…/secret-resolver.tsDefines explicit, generated, and rejected secret values across process boundaries.
packages/…/database.tsDefines database type selection and the TypeORM, MikroORM, and Knex connection profiles.
packages/…/database-helpers.tsDefines database setting validation, TLS input, and cross-database query safety rules.
packages/…/mikro-orm-sqlite.driver.tsKeeps SQLite date values consistent between the two ORM paths.
packages/…/app.module.tsDefines the application module graph, asset serving, and API-versus-worker background work ownership.
packages/…/index.tsDefines the shared lifecycle from configuration assembly through readiness.
packages/…/database.module.tsConnects the application to all database access layers and startup migration behavior.
packages/…/migration-run-lock.tsDefines cross-process PostgreSQL migration coordination.
packages/…/embedded-transaction-queue.tsDefines serialized SQLite transaction and statement access.
packages/…/migration-executor.tsShows how migration commands connect, run, generate, revert, and close.
packages/…/seed-data.service.tsShows the scope and order of the main seed workflows.
packages/…/seeder.module.tsShows how standalone seed contexts load plug-ins without starting scheduled jobs.
packages/…/is-queue-root-enabled.tsDefines the shared decision for queue registration across the API, worker, and seeder.
packages/…/event-outbox-inline-dispatch.tsDefines the no-queue fallback for event delivery.
packages/…/timer-reminder-enabled.tsDefines the explicit opt-in rule for timer reminders.
packages/…/helper.tsDefines the public asset serving boundary.