Writing Code Overview
Superblocks supports writing code to query and transform your data on the backend, as well as conditionally format data and components displayed on the frontend.
Backend
For backend Application APIs, Workflows, and Scheduled Jobs, you can incorporate custom business logic with programming languages like Python and JavaScript (Node.js).
Frontend
For frontend Application UIs, write browser based JavaScript functions to change the state of components based on any condition.
Code formatting
As you write code in Superblocks, you may notice your code is is automatically formatted. Formatting is enabled by default to help you write clean and consistent code across your Superblocks apps.
You can format code as you wish in any supported editor using the keyboard shortcut ⌘S (CTRL + S on Windows).
Available configuration
You can control the timing of when code is formatted using Developer Preferences. With these preferences, you can choose to format code:
- Automatically when you click outside the editor (default)
- Automatically when you run an API (all steps will be formatted)
- Never automatically, relying only on the keyboard shortcut ⌘S to format code
Superblocks does not currently support modifying specific formatting options (i.e. spaces vs tabs for indents) or opting in/out of formatting for a specific language.
Supported languages and dialects
Superblocks currently supports formatting in the following languages and locations:
- JavaScript (backend JS steps, frontend Run JS actions, JS bindings within SQL queries)
- Python (using PEP 8 formatting standard)
- SQL (PostgreSQL, MySQL, Micosoft SQL Server, MariaDB, Amazon Redshift, Google BigQuery, OracleDB)
Superblocks does not currently support formatting:
- JavaScript inputs (i.e. properties panel, Control Flow inputs)
- JSON
- A small subset of platform-specific SQL dialects, including Snowflake, DynamoDB, Rockset
AI Code Completion
AI code completion is currently in beta.
As you write code in Superblocks, you will see AI generated code completion suggestions in the code editor. You can control which programming languages will have AI code completion suggestions by adjusting the settings in Developer Preferences.
By default, AI code completion is enabled for Python, JavaScript, and SQL. The context that is being provided to the model is limited to just the skeleton of your application - no app data is being used to generate these suggestions.
Your code or data is never used as training data for these AI code suggestions. To disable this feature for your entire organization, please contact support at support@superblocks.com.