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:packagesscope
Step 1: Configure npm Authentication
First, configure npm to access Native Desktop packages from GitHub:Step 2: Install the CLI
Install the Native Desktop CLI globally:0.0.6).
Step 3: Create Your Project
Create a new directory and initialize your project:- Create the project structure
- Generate configuration files
- Install all dependencies
Step 4: Run Your App
Start your application in development mode: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:- Open
src/index.tsin your code editor - Make some changes
- Save the file
- Watch your app automatically reload!
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:- macOS
- Windows
bin/ directory:
Step 6: Sign Your App (Optional but Recommended)
For production distribution, sign your application:- macOS
- Windows
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 insrc/ - the app will automatically reload with your changes.
3. Check Code Quality
4. Build & Test
Common Issues
Cannot Install CLI - 401 Error
Cannot Install CLI - 401 Error
Problem:
npm ERR! 401 UnauthorizedSolution: Your GitHub token is missing or invalid.- Check your
.npmrcfile has the correct token - Verify the token has
read:packagesscope - Ensure you have repository access
Directory Not Empty Error
Directory Not Empty Error
Problem:
NativeDesktop can only create new projects in an empty folderSolution: The create command requires an empty directory.Build Failed - Invalid Target
Build Failed - Invalid Target
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
App Won't Start
App Won't Start
Problem: Application window doesn’t openSolution: Check the terminal for error messages and:
- Ensure all dependencies are installed:
npm install - Check for TypeScript errors:
native-desktop types - 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 productionTest 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:- 📚 Documentation: Native Desktop Docs
- 📧 Support: support@nativedesktop.com
- 🐛 Bug Reports: GitHub Issues
Ready to build something amazing? You now have everything you need to create professional desktop applications with Native Desktop. Happy coding! 🚀