Skip to content

tfcp68/yantrix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

678 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Yantrix: Opinionated FSM Framework

Yantrix is a (mostly) TypeScript framework and a DSL, that make up a full instrumental chain to implement robust and self-documented functional applications by code generation in multiple programming languages.

That allows devs to focus on describing contracts and workflows, rather than writing and debugging the actual code. The toolset is best used to create no-code/less-code solutions and works best within *-as-code paradigms.

license ci npm version npm downloads coverage stars opinionated

WARNING: The project is still in its earliest phase and is definetely not production ready. Please note, that not every feature mentioned in documentation is readily implemented too. Sometimes the fastest way to get the needed functionality is to implement it yourself. Contributions are welcome.

⚑ Quick Links

πŸ’‘ The Idea

Consider the following:

  • Writing less code produces fewer errors.
  • Writing it in a declarative way makes the code more adaptive and supportable.
  • Writing it with pure functions adds reliability and provides for an easy testability
  • Boilerplate code is undesirable, while it's best to write code in high-level abstractions that are close enough to business logic
  • It's better to define behavior with data rather than with code
  • Documenting the code makes it sustainable, and the best documentation is visual

If you agree to most of these takes, you'd probably like Yantrix. If not, still give it a shot, it might widen your view on programming as a genre.

To achieve those goals, Yantrix offers a visual language to describe data operations and bind them to discriminate well-defined processes, organized into the aforementioned State Machines. That approach is not the most traditional but is extremely reliable and manageable when you get the hang of it. To crown it all, being visual means the code can be immediately visualized to produce a representation of applied logic that is easy to conceive and is very efficient at storing knowledge about the produced software in documentation hubs.

To break it down: the business logic is represented by declarative, event-driven finite state machines, while the application state is stored as an Anemic Domain Model. To learn more about automata-based programming, please refer to 🧠Core Concepts

πŸ“₯ Installation

To install Yantrix end-to-end command line tool, you can use one of the following methods:

# Via NPM
$ npm install @yantrix/cli

# Via Yarn
$ yarn add @yantrix/cli

# Via PNPM
$ pnpm install @yantrix/cli

# ✨ Auto-detection
$ npx nypm install @yantrix/cli

Note

If your main language is TypeScript, you may prefer to install all available APIs or list only those you require

# Via NPM
$ npm install @yantrix/automata @yantrix/utils @yantrix/yantrix-parser

# Via Yarn
$ yarn add @yantrix/automata @yantrix/utils @yantrix/yantrix-parser

# Via PNPM
$ pnpm install @yantrix/automata @yantrix/utils @yantrix/yantrix-parser

# ✨ Auto-detection
$ npx nypm install @yantrix/automata @yantrix/utils @yantrix/yantrix-parser

πŸ“– Usage

Basically, you turn diagrams into a code module in required language

# From the *.mermaid file containing the diagram
$ yantrix codegen ./diagram.mermaid --outfile ../yantrix-generated.ts --language TypeScript --className SampleFSM

# Or using --eval
$ yantrix codegen --eval "A-->B" --outfile ../yantrix-generated.ts --language TypeScript --className SampleFSM

For detailed information, see the documentation

🌱 Contributing

See Contributing

πŸ“œ License

Made with πŸ’œ. Published under MIT License.