Office Hours: ACL-aware filtering in your own database with SpiceDB and AuthZed Materialize

Launching 2 New Developer Tools: LSP and VS Code Extension

/assets/team/joey-schorr.jpg
June 26, 2024|4 min read

Announcing 2 new developer tools for SpiceDB: a Language Server Protocol implementation within SpiceDB and a new extension for Visual Studio Code that provides the capabilities of Playground!

Earlier this year, we open sourced the SpiceDB Playground, the tool AuthZed built for easy development and testing of SpiceDB Schema. The Playground provides not only syntax highlighting and formatting, but also validation and testing tooling, to streamline development of ReBAC-style authorization systems.

Since launching Playground a few years ago, we’ve had a number of users ask for capabilities similar to the Playground, but natively in their own IDEs (integrated development environments) or other development environments. Recognizing that developers often have their own preferred environment, today we are quite happy to announce two new capabilities for developing schema for SpiceDB.

Language Server Protocol

The first new capability we’re announcing is support for the Language Server Protocol in SpiceDB. The Language Server Protocol is a shared protocol for IDEs and other developer tooling that allows tools to request semantic information about a piece of code.

In the case of SpiceDB’s new LSP implementation, the standard language server protocol API can be used to request information about the SpiceDB schema provided.

The language server protocol in SpiceDB can be run locally via the lsp command:

$ spicedb lsp
INF configured logging async=false format=auto log_level=info provider=zerolog
INF starting LSP server addr=-
INF listening for LSP connections on stdin

Visual Studio Code (VSCode) Extension

Visual Studio Code is a full-featured open source IDE originally created by Microsoft. One of its most powerful and important features is the ability to extend the functionality of the core IDE by writing and publishing VS Code Extension to the extension marketplace.

The SpiceDB VSCode Extension provides most of the features found currently in the SpiceDB Playground, but within VS Code itself. The extension can be installed from the marketplace, the GitHub repository or from within VS Code itself by going to the extension manager ⇧⌘X and searching for “SpiceDB”.

Here are some of the features currently available in the VS Code extension:

Syntax and Semantic Highlighting for SpiceDB Schema

The SpiceDB VSCode extension provides both syntax and semantic highlighting of SpiceDB schemas.

The semantic highlighting includes marking the use of relations and permissions in different colors:

Real time validation and diagnostics

The VS Code extension provides real time feedback about both errors and warnings that are found in the schema, as it is being edited:

Automatic formatting for SpiceDB Schema

The VS Code extension provides automatic formatting-on-save:

Built-in check watch

One of the most important features of the SpiceDB Playground is the ability to watch permissions and see how their computation changes as schema and test relationships are modified.

To support this feature in the VS Code extension, the AuthZed team constructed a custom panel to host a copy of SpiceDB within VSCode and provide check watches via actual SpiceDB API calls:

In a future blog post, we’ll discuss in technical detail how we built the check watch panel.

To use the check watch panel, a file containing relationships yaml named {name}.zed.yaml is placed in the same directory as the {name}.zed schema file being checked. The relationships+schema are then evaluated by SpiceDB and used to display the results of the check permissions calls executed against the schema+relationships.

Future

With the LSP and extension joining the playground and our CLI tool zed, SpiceDB now has a full set of developer tooling for all major environments!

Have a question about SpiceDB, schemas or the new tooling? Don’t hesitate to join our Discord to talk to both AuthZed employees and community experts now!

Get started for free

Join 1000s of companies doing authorization the right way.