Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

TypeScript SDK Equivalence

Mapping between the official Mendix Model SDK (TypeScript) and MDL/modelsdk-go equivalents.

Overview

The Mendix Model SDK is Mendix’s official TypeScript library for programmatic model manipulation. It works through the Mendix Platform API and requires cloud connectivity. MDL and modelsdk-go provide similar capabilities but operate directly on local .mpr files.

Feature Comparison

FeatureMendix Model SDK (TypeScript)MDL / modelsdk-go
LanguageTypeScript / JavaScriptGo (library), MDL (DSL)
RuntimeNode.jsNative binary
Cloud requiredYes (Platform API)No (local files)
AuthenticationAPI key + PATNone
Real-time collaborationYesNo
Read operationsYesYes
Write operationsYesYes
Type safetyTypeScript typesGo types
CLI toolNoYes (mxcli)
SQL-like DSLNoYes (MDL)
AI assistant integrationLimitedBuilt-in (multi-tool)
Full-text searchNoYes (FTS5)
Cross-reference analysisNoYes (callers, impact)
LintingNoYes (Go + Starlark rules)

Operation Mapping

Reading

TypeScript SDKMDL EquivalentGo Library
model.allDomainModels()SHOW ENTITIESreader.ListDomainModels()
domainModel.entitiesSHOW ENTITIES IN Modulereader.GetDomainModel(id)
entity.attributesDESCRIBE ENTITY Module.Namedm.Entities[i].Attributes
model.allMicroflows()SHOW MICROFLOWSreader.ListMicroflows()
model.allPages()SHOW PAGESreader.ListPages()
model.allEnumerations()SHOW ENUMERATIONSreader.ListEnumerations()

Writing

TypeScript SDKMDL EquivalentGo Library
domainmodels.Entity.createIn(dm)CREATE PERSISTENT ENTITY Module.Name (...)writer.CreateEntity(dmID, entity)
entity.name = "Foo"Part of CREATE ENTITYentity.Name = "Foo"
domainmodels.Attribute.createIn(entity)Column in entity definitionwriter.AddAttribute(dmID, entityID, attr)
domainmodels.Association.createIn(dm)CREATE ASSOCIATIONwriter.CreateAssociation(dmID, assoc)
microflows.Microflow.createIn(folder)CREATE MICROFLOWwriter.CreateMicroflow(mf)
pages.Page.createIn(folder)CREATE PAGEwriter.CreatePage(page)
enumerations.Enumeration.createIn(module)CREATE ENUMERATIONwriter.CreateEnumeration(enum)

Security

TypeScript SDKMDL Equivalent
security.ModuleRole.createIn(module)CREATE MODULE ROLE Module.RoleName
Manual access rule constructionGRANT role ON Entity (permissions)
Manual user role creationCREATE USER ROLE Name (ModuleRoles)

Workflow Comparison

TypeScript SDK Workflow

const client = new MendixPlatformClient();
const app = await client.getApp("app-id");
const workingCopy = await app.createTemporaryWorkingCopy("main");
const model = await workingCopy.openModel();

const dm = model.allDomainModels().filter(d => d.containerAsModule.name === "Sales")[0];
await dm.load();

const entity = domainmodels.Entity.createIn(dm);
entity.name = "Customer";

const attr = domainmodels.Attribute.createIn(entity);
attr.name = "Name";
attr.type = domainmodels.StringAttributeType.create(model);

await model.flushChanges();
await workingCopy.commitToRepository("main");

MDL Equivalent

CREATE PERSISTENT ENTITY Sales.Customer (
    Name: String(200)
);

Go Library Equivalent

reader, _ := modelsdk.Open("app.mpr")
modules, _ := reader.ListModules()
dm, _ := reader.GetDomainModel(modules[0].ID)

writer, _ := modelsdk.OpenForWriting("app.mpr")
entity := modelsdk.NewEntity("Customer")
entity.Attributes = append(entity.Attributes,
    modelsdk.NewStringAttribute("Name", 200))
writer.CreateEntity(dm.ID, entity)

Key Differences

  1. No cloud dependency – modelsdk-go works entirely offline with local .mpr files
  2. No working copy management – changes are written directly to the file (back up first)
  3. MDL is declarative – one statement replaces multiple imperative SDK calls
  4. Token efficiency – MDL uses 5-10x fewer tokens than equivalent JSON model representations, making it better suited for AI assistant context windows
  5. Built-in search and analysis – full-text search, cross-reference tracking, and impact analysis are not available in the TypeScript SDK