Get Started
Welcome to Blinko plugin development! This guide will help you set up your development environment and create your first plugin.
Prerequisites
Before you begin, make sure you have the following installed:
Setting Up Your Development Environment
1. Create a New Plugin Project
You have three options to start your plugin project:
Option A: Use CodeSandbox (Recommended for Quick Start)
- Visit our Blinko Plugin Template on CodeSandbox
- Click “Fork” to create your own copy
- The development server will start automatically
- You’ll see the connection instructions at
http://localhost:3000
showing:- External Access:
ws://<sandbox-id>.csb.app:8080
- External Access:
This is the fastest way to get started as it:
- Requires no local setup
- Provides instant development environment
- Offers built-in documentation server
- Enables easy sharing and collaboration
Option B: Use the Template Repository
- Visit the Blinko Plugin Template
- Click the “Use this template” button
- Follow the GitHub prompts to create your repository
Option C: Clone the Template Repository
2. Install Dependencies
Once you have your project set up, install the dependencies:
3. Start Development Server
Start the development server to begin working on your plugin:
This will start a local development server, typically at ws://localhost:8080
.
Project Structure
The template provides a basic structure for your plugin:
Key Files Explained
plugin.json
This file contains your plugin’s metadata:
Key fields explained:
name
: Unique identifier for your plugin (required)author
: Plugin author’s name or organization (required)url
: Repository or homepage URL (required)version
: Plugin version following semver (required)minAppVersion
: Minimum Blinko app version requireddisplayName
: Localized plugin namesdefault
: Default display name (English)zh
: Chinese display name (optional)
description
: Localized plugin descriptionsdefault
: Default description (English)zh
: Chinese description (optional)
readme
: Localized documentation filesdefault
: Default README file pathzh
: Chinese README file path (optional)
When you run bun dev
, the development server:
- Starts a WebSocket server for communication
- Watches the
dist
directory for changes - Automatically rebuilds when source files change
- Sends the updated code to connected Blinko clients
You can access your development server at:
- Local:
ws://localhost:8080
- Network:
ws://<your-local-ip>:8080
External Access with Ngrok
If Blinko is not deployed in your local network, you’ll need to use ngrok to make your plugin accessible from the internet:
- Start your development server first:
- In a new terminal, run the ngrok command:
This will create a secure tunnel to your local development server and output something like:
Now you can use the ngrok URL (e.g., wss://xxxx-xx-xx-xxx-xx.ngrok.io
) in Blinko to connect to your plugin.
The development server provides real-time feedback:
Next Steps
Connect Your Plugin to Blinko
Once your development server is running, follow these steps to add your plugin to Blinko:
- Open Blinko and go to Settings
- Click on “Plugin Setting”
- Switch to the “Local Development” tab
- Click the “Add Local Plugin” button
- Enter your WebSocket URL:
- Local:
ws://localhost:8080
- Network:
ws://<your-local-ip>:8080
- Ngrok:
wss://xxxx-xx-xx-xxx-xx.ngrok.io
(if using ngrok)
- Local:
- Click “Connect” to start using your plugin
If the connection is successful, you’ll see your plugin listed as “Local Plugin” with a green status indicator.
Troubleshooting Connection Issues
If you can’t connect to your plugin:
- Make sure your development server is running (
bun dev
) - Check that the WebSocket URL is correct
- If using a local network URL, ensure you’re on the same network
- For ngrok connections, make sure to use the
wss://
URL provided by ngrok
Additional Resources
- Publish plugin to Blinko Plugin Marketplace Publish plugin
- Check out the API Reference to learn about available APIs
- Join our community to get help and share your plugins