Generated Assets Reference - Introduction
Introduction to Mindbricks generated assets and naming conventions. This guide explains how assets are named and organized, enabling architects to reference these assets in their business logic.
Mindbricks automatically generates a wide range of backend assets based on your pattern definitions. These assets include data objects, Business APIs, REST routes, Kafka topics, database utility functions, and more. Understanding these generated assets is crucial because:
- They follow naming conventions that you need to know to reference them in your business logic
- They create dependencies — for example, a Business API generates a REST route and Kafka topics that other APIs or edge controllers may need to consume
- They enable integration — knowing the exact names and structures allows you to connect different parts of your system
This reference guide is organized by service type. Each service has its own document detailing the specific assets generated for that service.
Naming Conventions
All generated assets follow consistent naming conventions. Understanding these conventions is essential for referencing assets in your business logic.
Data Objects
- Service-scoped reference:
{serviceName}:{dataObjectName}(e.g.,auth:user,order:product) - Model name: PascalCase (e.g.,
User,UserGroup,Product,Order)
Business APIs
- Name: camelCase (e.g.,
createUser,listUsers,updateUserRole,registerUser) - REST route prefix:
/{serviceName}-api/v{version}/(e.g.,/auth-api/v1/,/order-api/v1/)
Route Generation:
-
Standard RESTful routes (standard action + matching resource):
- Create/List:
/{serviceName}-api/v{version}/{pluralizedObjectName}(e.g.,/auth-api/v1/users) - Get/Update/Delete:
/{serviceName}-api/v{version}/{pluralizedObjectName}/:{objectName}Id(e.g.,/auth-api/v1/users/:userId)
- Create/List:
-
Non-standard routes (standard action + non-standard resource):
- Create/List:
/{serviceName}-api/v{version}/{resourceName}(e.g.,/auth-api/v1/userrole) - Get/Update/Delete:
/{serviceName}-api/v{version}/{resourceName}/:{dataName}Id(e.g.,/auth-api/v1/userrole/:userId)
- Create/List:
-
Non-standard routes (non-standard action):
- Create/List:
/{serviceName}-api/v{version}/{action}{resourceName}(e.g.,/auth-api/v1/registeruser) - Get/Update/Delete:
/{serviceName}-api/v{version}/{action}{resourceName}/:{dataName}Id(e.g.,/auth-api/v1/archiveprofile/:userId)
- Create/List:
Standard actions: get, list, create, update, delete
Non-standard actions: Any other verb (e.g., register, remove, archive, clear)
Kafka Topics
Mindbricks generates Kafka topics for two types of events:
-
Business API Events (when
raiseApiEventis true):- Pattern:
{projectCodeName}-{serviceName}-service-{resource}-{actionPassiveForm} - Example:
babilshop-order-service-basket-cleared
- Pattern:
-
Database Events (for all data objects):
- Pattern:
{projectCodeName}-{serviceName}-service-dbevent-{dataObjectName}-{crudPassive} - Event types:
created,updated,deletedonly - Example:
babilshop-order-service-dbevent-basketitem-deleted
- Pattern:
Variables:
{projectCodeName}— The project's code name (e.g.,babilshop){serviceName}— The service name (e.g.,order,auth){resource}— The resource name from the API name analysis (lowercase){actionPassiveForm}— The passive form of the action verb (e.g.,cleared,retrieved,created){dataObjectName}— The data object name (lowercase){crudPassive}— The passive form of the CRUD operation (created,updated,deleted)
Database Utility Functions
For each data object, Mindbricks generates 13 utility functions in the dbLayer module:
- Pattern:
{operation}{ModelName}(e.g.,getUserById,createUser,listUsersByQuery) - Available via:
require("dbLayer")
Generated Functions:
create${ModelName}— Create a single recordcreateBulk${ModelName}— Create multiple recordsget${ModelName}ById— Get record by IDget${ModelName}AggById— Get record by ID with aggregated dataget${ModelName}ListByQuery— Get list of records by queryget${ModelName}ByQuery— Get single record by queryget${ModelName}StatsByQuery— Get statistics by querygetIdListOf${ModelName}ByField— Get list of IDs by field valueupdate${ModelName}ById— Update record by IDupdate${ModelName}ByIdList— Update multiple records by ID listupdate${ModelName}ByQuery— Update records by querydelete${ModelName}ById— Delete record by IDdelete${ModelName}ByQuery— Delete records by query
Example:
const {
getUserById,
createUser,
getUserListByQuery,
updateUserById,
deleteUserById
} = require("dbLayer");
Session Routes
All services include session routes mounted at /{serviceName}-api (e.g., /auth-api, /order-api). These routes do not include the version part (/v1/) unlike Business API routes.
Common routes (available in all services):
/currentuser— Get current session/publickey— Get RSA public key/permissions— Get user permissions/rolepermissions— Get role permissions/permissions/:permissionName— Get specific permission filter/rawsearch/:index— Raw Elasticsearch search (admin only)
Auth service additional routes:
/login— User login/logout— User logout/relogin— Refresh session/realtimetoken— Get realtime event token/getusersessions— Get user sessions/getuserhistory— Get session history/deleteusersession/:sessionId— Delete specific session/deleteallsessions— Delete all user sessions
Service-Specific Assets
Each service type generates specific assets:
- General Service Assets — Common assets available in all services
- Auth Service Assets — User management, authentication, and authorization assets
- Payment Service Assets — Stripe payment integration assets
- BFF Service Assets — Backend-for-Frontend service assets
- Notification Service Assets — Notification workflow assets
- Bucket Service Assets — File storage service assets
Each service document follows the same structure: automatic data objects, Business APIs, REST routes, Kafka topics, database utility functions, and initial data.
Last updated Dec 29, 2025