What is Capacitor?
Learn what Capacitor is, how it turns web apps into native mobile apps, and when to use it.
What you'll accomplish
Understand what Capacitor is and decide if it's right for your project.
Prerequisites
- Basic understanding of web development (HTML, CSS, JavaScript)
- Familiarity with React or Next.js helpful but not required
What is Capacitor?
Capacitor is a tool that wraps your web application in a native container, allowing it to run as a real iOS or Android app. Your web code (HTML, CSS, JavaScript) stays the same - Capacitor handles the native parts.
Imagine you have a present (your web app). Capacitor is like gift-wrapping paper:
- The present inside stays exactly the same
- But now it's in a package that can be delivered to the App Store
- And it gets special labels (native features) that make it work better
Your website becomes an app that people can download from app stores, with access to camera, GPS, push notifications, and more.
How It Works
Your Web App (HTML, CSS, JS)
│
▼
┌──────────────┐
│ Capacitor │
│ Runtime │
└──────────────┘
│
┌────┴────┐
▼ ▼
┌──────┐ ┌──────────┐
│ iOS │ │ Android │
│ App │ │ App │
└──────┘ └──────────┘
- You build your web app normally
- Capacitor wraps it in a native WebView
- Plugins provide access to native features
- You build real
.ipa(iOS) and.apk(Android) files
Capacitor vs. Other Approaches
Capacitor vs. React Native
| Aspect | Capacitor | React Native |
|---|---|---|
| Code | Standard HTML/CSS/JS | React components that compile to native |
| Learning curve | Lower (use existing skills) | Higher (new paradigms) |
| Performance | Good (WebView) | Better (native rendering) |
| UI | Web UI (same everywhere) | Native UI (platform-specific) |
| Existing code | Reuse your web app | Rewrite from scratch |
| Team skills | Web developers | React + native knowledge |
Choose Capacitor when:
- You have an existing web app to convert
- Your team knows web technologies
- Consistent UI across platforms is desired
- You need to ship quickly
Choose React Native when:
- Performance is critical (games, animations)
- You want fully native UI
- You're starting from scratch
- You have React Native experience
Capacitor vs. PWA
| Aspect | Capacitor | PWA |
|---|---|---|
| App Store | Yes | No (mostly) |
| Native features | Full access | Limited |
| Installation | Download from store | "Add to Home Screen" |
| Updates | Store approval needed | Instant |
| Discoverability | App Store search | Web search |
Choose Capacitor when:
- You need App Store presence
- Push notifications are important
- You need deep native integration
- Users expect a "real" app
Choose PWA when:
- Instant updates are critical
- You want to skip app store approval
- Basic native features are enough
- Lower friction installation matters
What Can You Build?
Capacitor works great for:
| App Type | Why It Works |
|---|---|
| Business apps | Forms, dashboards, data entry |
| E-commerce | Product catalogs, checkout flows |
| Social apps | Feeds, messaging, profiles |
| Productivity | Task lists, notes, calendars |
| Media apps | Photo galleries, video players |
| Utility apps | Calculators, converters, tools |
Capacitor is less ideal for:
| App Type | Why It's Challenging |
|---|---|
| Games | WebView not optimized for graphics |
| AR/VR | Limited access to AR frameworks |
| Heavy animation | May not hit 60fps consistently |
| Offline-first | Possible but complex |
Native Features via Plugins
Capacitor provides access to native features through plugins:
Official Plugins
| Plugin | What It Does |
|---|---|
| Camera | Take photos, record video |
| Geolocation | Get GPS coordinates |
| Push Notifications | Receive push messages |
| Storage | Local data persistence |
| Filesystem | Read/write files |
| Share | Native share sheet |
| Haptics | Vibration feedback |
| Network | Connection status |
| App | App state, deep links |
| Splash Screen | Loading screen control |
Community Plugins
Hundreds of community plugins for:
- Social logins (Google, Apple, Facebook)
- In-app purchases
- Analytics
- Bluetooth
- Barcode scanning
- And much more
Using a Plugin
typescriptimport { Camera, CameraResultType } from '@capacitor/camera'; async function takePicture() { const image = await Camera.getPhoto({ quality: 90, allowEditing: true, resultType: CameraResultType.Uri }); // image.webPath contains the photo return image.webPath; }
The same code works on iOS and Android!
Requirements
To use Capacitor, you'll need:
For Development
- Node.js 18+
- npm or yarn
- A web framework (Next.js, React, Vue, etc.)
For iOS Builds
- A Mac (required - Apple restriction)
- Xcode 15+ (free from App Store)
- Apple Developer account ($99/year for App Store)
For Android Builds
- Android Studio (free, any OS)
- JDK 17+
- Google Play Developer account ($25 one-time for Play Store)
Note
No Mac? You can still develop and test on Android. For iOS, you'll need access to a Mac eventually, or use a cloud service like MacStadium or GitHub Actions.
Is Capacitor Right for You?
Yes, if:
- You have a working web app you want on app stores
- Your team has web development skills
- You value code reuse and maintenance simplicity
- Your app is content/data focused (not graphics-heavy)
- You want to target iOS and Android with one codebase
Maybe not, if:
- Performance is critical (games, heavy animations)
- You need the absolute native look and feel
- You're building only for one platform
- You have experienced native developers
Apps built with Capacitor (or its predecessor Ionic):
- Sworkit - Fitness app with millions of users
- MarketWatch - Financial news app
- Papa Johns - Pizza ordering app
- NHS - UK National Health Service apps
These companies chose Capacitor because they could leverage their web teams and existing code while still delivering native app experiences.
Common Questions
Frequently Asked Questions
For most apps, no. Capacitor apps feel native because they ARE native - they run in a native container with access to native features. Performance-sensitive transitions might reveal WebView behavior, but this is rarely noticeable in typical apps.
Yes! Capacitor works with any web framework:
- Next.js (with static export)
- React
- Vue
- Angular
- Svelte
- Plain HTML/CSS/JS
For basic apps, no. Plugins handle native code. For advanced customization, you might write small amounts of native code, but it's optional.
Two options:
- App Store update: Full release process (days to approve)
- Live Update plugins: Update web content without store approval (instant)
Many teams use live updates for content changes and store updates for native code changes.
Capacitor adds some overhead (the WebView runtime). Typical apps are 10-30MB, which is acceptable for most users. Heavy assets (images, videos) affect size more than Capacitor itself.
Next Steps
Ready to try Capacitor? Here's the path:
- Set up your web app for Capacitor (next lesson)
- Configure iOS development
- Configure Android development
- Add native features with plugins
- Deploy to app stores
Verify Your Understanding
You've completed this lesson if you can:
Next: Set up a Next.js project with Capacitor.