A JS library for opening workspaces in Firebase Studio.
npm install @firebase-studio/open-sdk
For all the examples below, after installing the SDK, import the package:
import * as FirebaseStudio from '@firebase-studio/open-sdk';
Get a URL to a CDN-hosted "Open in Firebase Studio" button image:
img.src = FirebaseStudio.getButtonImageUrl({
// optional config
});
Example:
You can get a deep link into Firebase Studio for a variety of destinations, e.g.:
link.href = FirebaseStudio.getOpenUrl({
type: 'named-template', // or 'git', etc
templateId: 'gemini'
});
In a browser environment, you can create an ad-hoc workspace from an arbitrary set of project files like so:
button.onclick = () => {
FirebaseStudio.newAdhocWorkspace({
files: {
'index.html': '<h1>hello world</h1>',
'.idx/dev.nix': '...',
}
});
};