A production-ready template for creating VS Code extensions with freemium features using LemonSqueezy for license management.
- Clone this repository
- Update LemonSqueezy credentials in
src/licenseManager.ts:
private readonly STORE_ID = YOUR_STORE_ID; // From LemonSqueezy dashboard
private readonly PRODUCT_ID = YOUR_PRODUCT_ID; // From your product settings- Replace example features with your own:
// Free feature example
export function myFreeFeature() {
// Available to all users
vscode.window.showInformationMessage('This is a free feature!');
}
// Premium feature example
export function myPremiumFeature() {
if (licenseManager.isFeatureAvailable()) {
// Only available to paid users
vscode.window.showInformationMessage('This is a premium feature!');
} else {
vscode.window.showWarningMessage('Please upgrade to access this feature.');
}
}- Complete License Management: Fully integrated with LemonSqueezy's License API
- Secure Validation: Server-side license validation with caching
- Offline Support: Graceful handling of offline scenarios
- Error Handling: Comprehensive error handling and retry mechanisms
- UI Integration: Status bar indicator and user notifications
- Example Features: Working examples of free and premium features
- Provides a complete freemium extension structure
- Handles all LemonSqueezy license API integration
- Manages free vs premium feature gating
- Includes working example features
- Clone this repository
- Set your LemonSqueezy credentials:
private readonly STORE_ID = YOUR_STORE_ID; // From LemonSqueezy dashboard
private readonly PRODUCT_ID = YOUR_PRODUCT_ID; // From your product settings- Replace example features with your own:
// Free feature
export function myFreeFeature() {
// Everyone can use this
}
// Premium feature
if (licenseManager.isFeatureAvailable()) {
// Only paid users can use this
}Already implemented endpoints:
/v1/licenses/validate- License validation/v1/licenses/activate- License activation/v1/licenses/deactivate- License deactivation
No additional setup needed - just add your credentials.
- Built-in LemonSqueezy API integration
- Secure license validation system
- Status bar indicator for license state
- Persistent license storage
The blueprint includes example features to demonstrate the freemium model:
Free Features:
- Word count functionality
- Status bar integration
Premium Features:
- Base64 encoding/decoding
- Syntax highlighting
- Custom bracket highlighting
- Keyword highlighting
- Clone this repository
- Replace placeholder values:
private readonly STORE_ID = YOUR_STORE_ID;
private readonly PRODUCT_ID = YOUR_PRODUCT_ID;- Add your own free/premium features
/v1/licenses/validate- Validates license keys/v1/licenses/activate- Activates licenses for specific instances/v1/licenses/deactivate- Deactivates license instances
- Free: Basic functionality
- Premium: Full access after license activation
- Server-side validation
- Instance-based licensing
- Regular validation checks
-
Add Free Features
export function yourFreeFeature() { // Available to all users }
-
Add Premium Features
if (licenseManager.isFeatureAvailable()) { // Only available with valid license }
-
Handle License States
licenseManager.updateStatusBarItem();
See the example implementation in src/ for complete working code.
- Word Count: Quickly get the word count of any document
- Basic Status Bar: Shows the current license status (Free/Trial/Premium)
- Base64 Encoding/Decoding
- Convert text to base64
- Convert base64 back to text
- Works with selected text
- Smart Syntax Highlighting
- Bracket highlighting with custom colors
- Keyword highlighting for important programming terms
- Customizable highlighting colors
- Install the extension from the VS Code marketplace
- Access free features immediately
- Activate your premium license
- Activate License
- Purchase a license from our store
- Use command:
Activate Premium License - Enter your license key
| Command | Description | Availability |
|---|---|---|
Free Sample Feature |
Show document word count | Free |
Activate Premium License |
Activate your premium license | Free |
Deactivate Premium License |
Deactivate current license | Premium |
Premium Feature |
Highlight brackets | Premium |
Highlight Keywords |
Highlight programming keywords | Premium |
Encode to Base64 |
Convert text to base64 | Premium |
Decode from Base64 |
Convert base64 to text | Premium |
This extension contributes the following settings:
featureRich.highlightColors: Customize syntax highlighting colors{ "brackets": "#FF9800", "keywords": "#2196F3" }
- Highlight Brackets:
Ctrl+Shift+H(Cmd+Shift+Hon macOS) - Highlight Keywords:
Ctrl+Shift+K(Cmd+Shift+Kon macOS)
- Visual Studio Code version 1.80.0 or higher
- Active internet connection for license validation
- Unlimited access to all premium features
- Priority support
- Regular feature updates
- Support ongoing development
See our GitHub issues page for current issues and feature requests.
- Initial release
- Basic and premium features implementation
- LemonSqueezy integration
- Trial system implementation
We welcome contributions! Please check our contribution guidelines before submitting pull requests.
This extension is licensed under the MIT License.
Enjoy using Feature Rich Extension! π
A complete example of how to integrate LemonSqueezy payment and licensing system into a Visual Studio Code extension.
- Validates license keys against LemonSqueezy API
- Checks store ID and product ID matching
- Verifies subscription status
- Activates licenses with unique instance IDs
- Stores license data securely
- Handles activation errors gracefully
- Deactivates licenses on request
- Removes stored license data
- Handles API errors properly
- 14-day trial period
- Automatic trial expiration
- Trial status display in status bar
const ENDPOINTS = {
validate: 'https://api.lemonsqueezy.com/v1/licenses/validate',
activate: 'https://api.lemonsqueezy.com/v1/licenses/activate',
deactivate: 'https://api.lemonsqueezy.com/v1/licenses/deactivate'
}-
License Validation
- Validates license key authenticity
- Checks store and product matching
- Verifies subscription status
-
License Activation
- Creates unique instance ID
- Activates license with LemonSqueezy
- Stores activation data
-
License Deactivation
- Deactivates instance
- Removes local license data
- Updates UI state
-
Replace placeholder values:
private readonly STORE_ID = 157343; // Your store ID private readonly PRODUCT_ID = 463516; // Your product ID
-
Set up API endpoints in your extension:
axios.post('https://api.lemonsqueezy.com/v1/licenses/validate') axios.post('https://api.lemonsqueezy.com/v1/licenses/activate') axios.post('https://api.lemonsqueezy.com/v1/licenses/deactivate')
-
Implement license checks:
if (licenseManager.isFeatureAvailable()) { // Premium feature code }
The extension manages license states:
- Free
- Premium (activated)