Technical guide
Technical guide

Modules and jobs

Modules extend the engine. Packaged modules live under environment_modules/standard/ and environment_modules/custom/, each with package metadata and, where applicable, component files or server behavior. core_engines/moduleEngine.js manages module loading. services/platformApiService.js selects the declared platform API version for module execution.

Versioned module API

platformAPI/v1.0/index.js prepares a weSystem object for a request or execution context. Its methods include data queries and mutations, user and profile context, organization configuration, object-field lookup, permission checks, email, approval submission, and job scheduling. The version boundary lets module code target a known contract. A caller should use the API version declared for its module rather than reaching into private engine internals.

The weSystem methods act with request context where available. Some operations expose privileged bypass options; those require explicit review because they can change which records are visible.

getQCInstance currently accepts bypassRLS, bypassOLS, and bypassFLS. First-party CRM handlers use a narrow bypass when a system relationship field is hidden from a user; extension code should use the ordinary access path unless it has a reviewed privilege requirement.

Module routes

/server/:ns/:moduleName/:moduleMethod invokes an RPC handler, while /server/qualified/:ns/:moduleName/:moduleMethod is used for explicitly qualified calls. Namespace resolution comes from environment_modules/<package>/module-config.json; it is no longer limited to c. The resolved /we-rest and /we-public route groups look up a configured mapping by namespace, HTTP method, and normalized path. Missing or inactive mappings return 404. The authenticated group checks for a logged-in session. Public routes require particular care because the route name alone does not make a handler safe for anonymous use.

Scheduled work

core_engines/scheduleEngine.js and the platform API support scheduled jobs. The API can look up, schedule, or abort named jobs. A cron expression is required when scheduling; the code rejects expressions whose first segment is * to avoid an overly frequent schedule. Admin Setup exposes Job Status with scheduled and execution views. Verify the target environment and job name before aborting or changing a schedule.

Relevant source paths: core_engines/moduleEngine.js, core_engines/scheduleEngine.js, platformAPI/v1.0/index.js, routes/rpc.js, routes/customResolvedRoutes.js, and routes/setup.js.