Skip to content

Commit 7d24655

Browse files
small updates to open-source approach. Also new getting-started article on TypeScript component inside Rete editor.
1 parent dc6719c commit 7d24655

2 files changed

Lines changed: 86 additions & 5 deletions

File tree

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
sidebar_position: 4
3+
title: Why There's TypeScript Editor Inside Rete?
4+
sidebar_label: TypeScript in Rete Editor
5+
description: Understanding the synergy between visual programming and text-based scripting (TypeScript, JavaScript, JSON) within Bitbybit's Rete editor.
6+
tags: [getting-started, rete, typescript]
7+
---
8+
9+
<img
10+
class="category-icon-small"
11+
src="https://s.bitbybit.dev/assets/icons/white/code-icon.svg"
12+
alt="Coding editors category icon"
13+
title="Coding editors category icon" />
14+
15+
import Admonition from '@theme/Admonition';
16+
17+
You might have noticed that Bitbybit's Rete visual programming editor includes integrated editors for TypeScript, JavaScript, and even JSON. At first glance, this might seem counterintuitive. If visual programming is so powerful, why "cheat" by including code editors?
18+
19+
The answer lies in our philosophy of providing both an intuitive entry point and a pathway to deeper control and understanding. Visual programming is fantastic for many things, but it's one tool in a larger creative and development toolkit.
20+
21+
## Visual Programming: The Intuitive Surface
22+
23+
Wiring algorithms together visually with nodes and connections in Rete is:
24+
25+
* **Intuitive:** It often maps more directly to how we think about data flow and processes.
26+
* **Expressive:** Complex relationships can be visualized and understood quickly.
27+
* **Engaging:** It's a fun and interactive way to build logic, especially for those new to programming or exploring new domains like 3D geometry.
28+
29+
Bitbybit offers a vast library of pre-built Rete components (currently over 1,300 and growing!). These components encapsulate a significant amount of underlying code, making complex operations accessible through simple visual blocks.
30+
31+
<Admonition type="info" title="The Iceberg Analogy">
32+
Think of the visual components as the visible tips of icebergs. They are powerful and useful on their own. However, beneath each one lies a much larger, more intricate body of code—the "deep ocean" of algorithms and logic that makes them work.
33+
</Admonition>
34+
35+
## Scripting Editors: Your Submarine for Deeper Exploration
36+
37+
While visual components cover a vast range of functionalities, there are times when you need to dive deeper. This is where the integrated scripting editors become invaluable. They are your "submarines," allowing you to:
38+
39+
1. **Access Unexposed Functionality:**
40+
* Not every single feature or parameter of underlying libraries (like BabylonJS can be exposed as a visual node. Sometimes, for fine-grained control or to access very specific, less commonly used features, writing a few lines of code is the most direct and efficient way.
41+
* **Example:** You might want to tweak an advanced particle system property in BabylonJS that doesn't have a dedicated Rete node yet.
42+
43+
2. **Implement Custom Logic:**
44+
* There will always be scenarios unique to your project that require custom logic not covered by existing components. Instead of waiting for a new component, you can implement it directly with TypeScript or JavaScript.
45+
* **Example:** "Ugh, if only I could just write these five lines of code to combine these data points in a very specific way..." With the script editor, you can!
46+
47+
3. **Prototype and Extend:**
48+
* If you find yourself repeatedly writing the same custom script, it might be a candidate for a new, reusable Rete component. The script editor is a great place to prototype this logic. If the idea proves to be generic and useful, we might even incorporate it as a new official component in a future release.
49+
50+
4. **Debug and Understand:**
51+
* Sometimes, seeing the underlying data or a snippet of code can help you understand why a visual graph isn't behaving as expected. The JSON editor can be useful for inspecting the raw structure of your Rete graph.
52+
53+
5. **Overcome Limitations and Avoid Getting Stuck:**
54+
* One of the most powerful aspects of this hybrid approach is that you're rarely truly "stuck." If a visual approach hits a wall, you have an alternative. This flexibility is crucial for more complex projects and continuous development.
55+
56+
## A Pathway for Growth: From Explorer to Developer
57+
58+
Bitbybit is designed to be a learning platform. We want to help users grow from curious explorers of visual programming to confident developers capable of tackling complex challenges.
59+
60+
* **Visual Programming as a Gateway:** Rete provides an accessible and engaging entry point. It lowers the barrier to creating sophisticated 3D scenes and algorithmic designs.
61+
* **Scripting as the Next Step:** As your projects become more ambitious, or your curiosity drives you to understand the "how," the scripting editors are there to support your journey. Learning to read and write code unlocks a new level of capability and understanding.
62+
63+
While "vibe coding" and AI-assisted development are exciting trends, the fundamental ability to understand and write code remains an invaluable skill. Think of visual programming as your map and compass, and scripting as your diving gear—both essential for exploring the vast ocean of possibilities.
64+
65+
<Admonition type="tip" title="Practical Example">
66+
Want to see this hybrid approach in action?
67+
<ul>
68+
<li>Check out tutorials (like those found at [Bitbybit School](https://bitbybit.dev/school/courses/typescript-component-for-magical-powers-in-rete)) that might show how scripting can complement visual graphs.</li>
69+
<li>Explore live demo projects (like the one at [Magical Paricles Project](https://bitbybit.dev/projects/public/HyCMepiRhTWfua1QRaba/project-magical-particles-by-author-bitbybit)) where this synergy is applied.</li>
70+
</ul>
71+
</Admonition>
72+
73+
## It's Not "Either/Or" — It's "Both/And"
74+
75+
The inclusion of TypeScript, JavaScript, and JSON editors within the Rete environment isn't about choosing one paradigm over the other. It's about providing a flexible, powerful, and adaptable platform where you can use the best tool for the task at hand, and grow your skills along the way.
76+
77+
Happy exploring, and happy coding!

docs/learn/open-source-approach.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ At Bitbybit, we believe in the power of open source and community collaboration.
1919
We are committed to open-sourcing the foundational elements that empower developers and designers. This primarily includes:
2020

2121
1. **Core Logic & Geometry Libraries (NPM Packages):**
22-
* The powerful algorithms and utility functions that form the backbone of Bitbybit's capabilities. These are available as NPM packages (like `@bitbybit-dev/base`, `@bitbybit-dev/occt`, etc.) for you to use in your own projects.
22+
* The powerful algorithms and utility functions that form the backbone of Bitbybit's capabilities. These are available as NPM packages (like `@bitbybit-dev/base`, `@bitbybit-dev/occt`, `@bitbybit-dev/babylonjs`, `@bitbybit-dev/threejs` etc.) for you to use in your own projects.
2323
* If you're familiar with the `bitbybit` JavaScript namespace used in our editors, the following modules (and their sub-modules) are **open source**:
2424
* `bitbybit.draw`
2525
* `bitbybit.babylon`
@@ -49,26 +49,30 @@ We are committed to open-sourcing the foundational elements that empower develop
4949
* We provide example projects and snippets demonstrating how to use our open-source NPM packages.
5050

5151
<Admonition type="success" title="Key Takeaway">
52-
The code for all the core building blocks—the mathematical and geometric engines, and fundamental utilities—is available for you to inspect, use, and even contribute to via our NPM packages and the main GitHub monorepo.
52+
The code for all the core building blocks—the mathematical and geometric engines, and fundamental utilities—is available for you to inspect, use, and even contribute to via our main GitHub monorepo.
5353
</Admonition>
5454

5555
## What is NOT Open Source (Proprietary Components)?
5656

5757
To support the development and hosting of the Bitbybit platform, certain components are proprietary and not open source. These include:
5858

5959
1. **The Bitbybit.dev Platform & UI:**
60-
* **Visual Programming Editors:** The user interfaces for our Rete.js and Blockly visual programming environments, including their integration with the Monaco editor.
60+
* **Visual Programming Editors & TypeScript Editor:** The user interfaces & all related logic for our Rete, Blockly & Monaco programming environments.
6161
* **Main Website & Cloud Infrastructure:** The [bitbybit.dev](https://bitbybit.dev) website, user account systems, cloud-based algorithms, and backend services.
6262

6363
2. **Code Execution "Runners":**
6464
* While you can freely embed and use our "Runners" (the components that execute Bitbybit scripts) in your own websites, their internal source code is not public.
6565
* We provide built versions of these Runners under an MIT license via the [bitbybit-assets repository](https://github.com/bitbybit-dev/bitbybit-assets).
66-
* These Runners enable the execution of some of our proprietary advanced algorithms (like certain 3D text/font features) free of charge within the context of the Runner, but the source code for those specific advanced algorithms remains closed.
66+
* These Runners enable the execution of some of our proprietary advanced algorithms (like certain 3D text/font features) free of charge within the context of the Runner, but the source code for those specific advanced algorithms will remain closed together with implementation details of Runners themselves.
6767

6868
3. **Visual Editor to JavaScript Conversion Logic:**
6969
* The internal mechanisms that convert Rete JSON or Blockly XML into executable JavaScript are proprietary.
7070
* You are, of course, free to use the JavaScript *generated* by our editors in your projects.
7171

72+
<Admonition type="warning" title="Important: Closed-Source Features">
73+
Scripts using features from our closed-source categories (like `bitbybit.things`, `bitbybit.advanced`, or `bitbybit.asset`) will **not** run if you export them to your own website or use them outside of the Bitbybit platform. These advanced features are exclusive to our platform.
74+
</Admonition>
75+
7276
4. **Specific Advanced Algorithm Namespaces:**
7377
* While our core libraries are open, certain higher-level and more complex algorithms are proprietary. In the `bitbybit` JavaScript namespace, these include:
7478
* Everything under `bitbybit.advanced`
@@ -83,7 +87,7 @@ To support the development and hosting of the Bitbybit platform, certain compone
8387
## Our Commitment to Transparency
8488

8589
We aim to be as transparent as possible about our open source model.
86-
* **The Rule of Thumb:** If you can't find the source code within the main [Bitbybit GitHub Monorepo](https://github.com/bitbybit-dev/bitbybit), it's likely proprietary and part of our intellectual property.
90+
* **The Rule of Thumb:** If you can't find the source code within the main [Bitbybit GitHub Monorepo](https://github.com/bitbybit-dev/bitbybit), it's likely proprietary and part of our intellectual property. Everything you can install via NPM - is open-source.
8791
* **Why This Model?** This hybrid approach allows us to offer powerful core tools to the community while funding the ongoing development, maintenance, and innovation of the broader Bitbybit platform and its advanced features.
8892

8993
We appreciate your understanding and your engagement with both our open source contributions and the Bitbybit platform as a whole! If you have questions about specific components, feel free to reach out.

0 commit comments

Comments
 (0)