Skip to main content

Build Your First Desktop App in 5 Minutes

This guide will walk you through creating your first Native Desktop application from scratch. By the end, you’ll have a working desktop app built and running on your machine.

Prerequisites Checklist

Before you begin, make sure you have:
  • Node.js 18+ installed (Download)
  • Native Desktop license purchased via Polar.sh
  • GitHub account with repository access
  • GitHub Personal Access Token with read:packages scope

Step 1: Configure npm Authentication

First, configure npm to access Native Desktop packages from GitHub:
Replace YOUR_GITHUB_TOKEN with your actual GitHub personal access token!

Step 2: Install the CLI

Install the Native Desktop CLI globally:
Verify the installation:
You should see the version number (e.g., 0.0.6).

Step 3: Create Your Project

Create a new directory and initialize your project:
The CLI will prompt you for project details. Here’s an example setup:
Choose “Manual Project” for a complete setup with all development tools configured.
The CLI will automatically:
  • Create the project structure
  • Generate configuration files
  • Install all dependencies

Step 4: Run Your App

Start your application in development mode:
🎉 Your app window should open! You now have a running Native Desktop application.
The app runs with hot-reload enabled - any changes you make to your code will automatically refresh the app.

Making Changes

Try editing your source code:
  1. Open src/index.ts in your code editor
  2. Make some changes
  3. Save the file
  4. Watch your app automatically reload!
Press Ctrl+C in the terminal to stop the app when you’re done testing.

Step 5: Build Your App

When you’re ready to create a distributable version, build your app:
Your built application will be in the bin/ directory:
For production distribution, sign your application:
You need an Apple Developer ID certificate.
Code signing is optional for development but required for distribution to prevent security warnings.

Complete Workflow Example

Here’s the complete workflow from start to finish:

What’s Next?

Congratulations! You’ve created your first Native Desktop application.

Development Workflow

For day-to-day development, follow this workflow:

1. Start Development

2. Write Code

Edit your files in src/ - the app will automatically reload with your changes.

3. Check Code Quality

4. Build & Test

Common Issues

Problem: npm ERR! 401 UnauthorizedSolution: Your GitHub token is missing or invalid.
  1. Check your .npmrc file has the correct token
  2. Verify the token has read:packages scope
  3. Ensure you have repository access
See Installation Guide for details.
Problem: NativeDesktop can only create new projects in an empty folderSolution: The create command requires an empty directory.
Problem: Invalid target for platformSolution: Use a target supported by your operating system:
  • macOS: dmg, app, pkg
  • Windows: exe, msi, msi-wrapped
  • Linux: deb, rpm, app-image, flatpak, snap
Problem: Application window doesn’t openSolution: Check the terminal for error messages and:
  1. Ensure all dependencies are installed: npm install
  2. Check for TypeScript errors: native-desktop types
  3. Try removing node_modules: rm -rf node_modules && npm install

Quick Reference

Essential Commands

Project Structure

Tips for Success

Use Manual Project

Choose “Manual Project” when creating for a full-featured setup with all development tools

Run Quality Checks

Always run lint, fmt, and types before building for production

Test Built Apps

Always test your built application before distributing to users

Sign for Distribution

Code sign your apps to avoid security warnings and build user trust

Getting Help

Need assistance? We’re here to help:
Ready to build something amazing? You now have everything you need to create professional desktop applications with Native Desktop. Happy coding! 🚀