{"id":26440,"library":"stricture","title":"Stricture MicroDDL Schema Compiler and Code Generator","description":"Stricture 4.0.2 is a multi-target data definition language (MicroDDL) compiler that transforms a Markdown-inspired, line-based schema definition into MySQL scripts, Meadow schema files, relationship diagrams (Graphviz), data dictionaries (Markdown, LaTeX, CSV), and test fixtures. Unlike general-purpose schema tools, Stricture is purpose-built for the Meadow application framework and provides first-class support for audit columns, authorization definitions, and PICT UI definitions. The project follows a service-oriented architecture on the Pict/Fable 3.x stack, with both a Commander-based CLI and a programmatic API. Releases are irregular but stable; v3 introduced a major CLI syntax change (migrating from yargs to Commander subcommands).","status":"active","version":"4.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/stevenvelozo/stricture","tags":["javascript","ddl","microddl","schema","code-generator","mysql","meadow"],"install":[{"cmd":"npm install stricture","lang":"bash","label":"npm"},{"cmd":"yarn add stricture","lang":"bash","label":"yarn"},{"cmd":"pnpm add stricture","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core service architecture (Pict/Fable 3.x)","package":"@pict/pict","optional":false},{"reason":"CLI command handling via Commander.js","package":"@pict/pict-service-commandlineutility","optional":true}],"imports":[{"note":"Package is ESM-only since v3. CommonJS not supported.","wrong":"const stricture = require('stricture');","symbol":"default","correct":"import stricture from 'stricture';"},{"note":"Named exports available for individual services.","wrong":"import { StrictureCompiler } from './node_modules/stricture/lib/compiler.js';","symbol":"StrictureCompiler","correct":"import { StrictureCompiler } from 'stricture';"},{"note":"Generators are exported as named classes. Use with new MySQLGenerator().","wrong":null,"symbol":"MySQLGenerator","correct":"import { MySQLGenerator } from 'stricture';"}],"quickstart":{"code":"import stricture from 'stricture';\nimport { MySQLGenerator } from 'stricture';\n\nconst sources = [\n  {\n    'Name': 'Users',\n    'Columns': [\n      { 'Name': 'UserId', 'Type': 'int', 'PrimaryKey': true, 'Identity': true },\n      { 'Name': 'Username', 'Type': 'varchar(255)', 'Nullable': false },\n      { 'Name': 'Email', 'Type': 'varchar(255)', 'Nullable': false },\n      { 'Name': 'CreateDate', 'Type': 'datetime', 'Default': 'now()' }\n    ]\n  },\n  {\n    'Name': 'Posts',\n    'Columns': [\n      { 'Name': 'PostId', 'Type': 'int', 'PrimaryKey': true, 'Identity': true },\n      { 'Name': 'UserId', 'Type': 'int', 'ForeignKey': 'Users.UserId' },\n      { 'Name': 'Title', 'Type': 'varchar(255)', 'Nullable': false },\n      { 'Name': 'Body', 'Type': 'text', 'Nullable': false }\n    ]\n  }\n];\n\nconst model = { 'Tables': sources };\n\nconst compiler = new stricture.StrictureCompiler();\nconst compiled = compiler.compile(model);\n\nconst mysqlGen = new MySQLGenerator();\nconst sql = mysqlGen.generate(compiled);\n\nconsole.log(sql);","lang":"typescript","description":"Programmatically compile a JSON model and generate MySQL DDL using Stricture's ESM API."},"warnings":[{"fix":"Use 'stricture full Model.mddl' instead of 'stricture -i Model.mddl -c Full'","message":"CLI syntax changed in v3: subcommands replaced yargs-style options","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use import statements or dynamic import(). Add 'type': 'module' to package.json if needed.","message":"Package is ESM-only since v3. require() will fail with ERR_REQUIRE_ESM","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Migrate to subcommand syntax described in v3 migration guide.","message":"Legacy 'yargs' CLI is removed. Old command-line flags no longer work.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Use the programmatic API with model objects if you already have JSON; otherwise ensure input is .mddl.","message":"Compiler expects source files as .mddl text, not JSON. Passing JSON directly via API bypasses MicroDDL parsing.","severity":"gotcha","affected_versions":"*"},{"fix":"Use exact names: CreateDate, UpdateDate, Deleted (case-sensitive).","message":"Audit column detection is case-sensitive. 'CreateDate' is recognized but 'created_at' is not.","severity":"gotcha","affected_versions":"*"},{"fix":"Review generated migration scripts before running on production databases.","message":"Generated MySQL scripts include IF NOT EXISTS by default. No IF EXISTS in DROP statements.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Switch to import statements or use dynamic import() as a fallback.","cause":"Package is ESM-only since v3, but code uses CommonJS require().","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/stricture/index.js not supported."},{"fix":"Use 'stricture full <input.mddl>' syntax instead.","cause":"Using deprecated yargs-style CLI options that were removed in v3.","error":"stricture: error: unknown option `-i'"},{"fix":"Import named export directly: import { StrictureCompiler } from 'stricture'.","cause":"Importing the default export and trying to access .StrictureCompiler, which may not exist or is not a constructor in the version used.","error":"TypeError: stricture.StrictureCompiler is not a constructor"},{"fix":"Use Node >= 14 and set 'type': 'module' in package.json, or use dynamic import().","cause":"Node.js version < 12, or 'type': 'module' not set in package.json when using import statements.","error":"SyntaxError: Unexpected token 'export'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}