Cordova vs Capacitor
For developers and teams evaluating new approaches to app development, this guide provides an overview of Capacitor and how it stacks up against Cordova as the preferred foundation for hybrid mobile apps.
Modern web-based mobile app and hybrid app development has evolved considerably in the last few years. For those who only know hybrid as Cordova or PhoneGap, it’s time to take another look at the capabilities of modern hybrid app development with Capacitor, a new open source hybrid app runtime created by the team behind the popular Ionic Framework. Note: For a quick primer on hybrid app development, check out our ebook.
What is Capacitor?
Capacitor is an open source project that runs modern Web Apps natively on iOS, Android, Electron, and Web (using Progressive Web App technology) while providing a powerful and easy-to-use interface for accessing Native SDKs and Native APIs on each platform. As an alternative to Cordova, Capacitor delivers the same cross-platform benefits, but with a more modern approach to app development, taking advantage of the latest Web APIs and native platform capabilities.
It might be helpful to think of Capacitor as a powerful new browser for modern Web Apps that unlocks the full native functionality of each platform through consistent cross-platform APIs. Using Capacitor, developers can build one app and target one set of APIs regardless of the platform the app is running on, as opposed to managing multiple APIs for each target platform.
This means that, for example, accessing the Camera uses the same code on iOS/Android as it does on Electron and on the web. This makes it easy to build one web app that runs natively on mobile, desktop, and the web as a Progressive Web App!
At the end of the day, Capacitor apps are native apps. They can incorporate native UI controls and access any native SDK or API available on the platform. But unlike more traditional native apps, Capacitor apps will likely have the bulk of the app running in an embedded WebView control that unlocks desired cross-platform benefits and efficiencies.
What is Cordova/PhoneGap?
Like Capacitor, Cordova is an open source project that runs web apps across multiple platforms, though not Electron nor web as a Progressive Web App.
Cordova is the open source core of the commercial Adobe PhoneGap project, and for the purposes of this discussion they can be considered equivalent.
While Cordova and Capacitor have some similarities, the projects make very different decisions at several key points, such that the experience of the two projects is very different. Capacitor, released in 2018, also uses many new modern APIs that were not available when Cordova was created back in 2009.
Why are more developers using Capacitor?
First-class Progressive Web App (PWA) Support
Capacitor is the only native runtime to deliver first-class support for web apps and Progressive Web Apps.
In fact, we’ve taken it a step further by building out a collection of UI experiences for APIs like Camera that bring the native app UI experience users expect to Progressive Web Apps. We call this the Progressive Web App OS.
On top of that, building plugins that offer web functionality as a fallback is just as easy as adding a few files to your plugin! Capacitor will only use your web implementation if the native one is not available, so users can use the exact same API when running on iOS, Android, Electron, and the Web.
Capacitor takes a “web first” approach, and believes that the core of every great cross-platform hybrid app is a quality, modern Progressive Web App. This keeps your app aligned with the rapidly evolving web platform while enabling powerful native device functionality on platforms that support it.
Simple yet powerful CLI tooling that is version managed per-app
Capacitor provides a small CLI tool that is installed locally to each app. That means there are no global dependencies to manage and it’s easy to use different versions of Capacitor across every app you build.
This is a boon to teams that are building multiple apps with potentially differing dependency versions or version management processes.
Native and web development teams can work side-by-side
Since Capacitor apps are actual native apps and a key design consideration of Capacitor is embracing native tooling, Capacitor enables teams that have a mixture of traditional native mobile and web developers to collaborate on mobile app projects.
Cordova, in contrast, works through an abstraction layer that manages the underlying native platform project and source files for you. This makes it harder to drop down to native code or work with a traditional native mobile development process, and can result in custom changes being lost.
Additionally, developers can quickly add custom native code for specific platforms and optionally expose that code to the Web layer, ensuring an app team never gets stuck implementing the functionality it needs.
Add hybrid and web to an existing native app
Capacitor adds superpowers to the traditional Web View control available on each platform, and it was designed to be used anywhere a Web View would be used. That means it can easily be dropped into an existing native app codebase, making it possible to build certain screens of the app using Web Technology without the need to make any sweeping changes to the rest of the app codebase.
This is also a great way to let other teams that may have more of a traditional web development skillset participate in the development of the app without getting in the way of a traditional native development process.
Strong and growing adoption
Capacitor today is installed over 1.5 million times a year, and is currently powering major production enterprise apps with hundreds of millions of users.
Top global fast-food chains are deploying in-store experiences for mobile and desktop on Capacitor. Companies like Southwest are building out all new hire onboarding experiences on Capacitor and Ionic, and popular consumer apps like Sworkit have built their latest-and-greatest versions on top of Capacitor (and Ionic 4+ in this case!).
That's just a small sample of teams building on Capacitor. Suffice to say that Capacitor is taking the hybrid app development ecosystem by storm and is a growing part of Ionic’s enterprise mobile business.
Capacitor has even convinced native developers or users of alternative platforms that see the benefits of web development on mobile and are happy that Capacitor is finally providing the development experience they desire.
Capacitor is Enterprise ready
Support and enterprise-specific functionality available
Capacitor is truly unique as an open source project in that it has a real company behind it that is in the business of enterprise app development. That means it's our business to provide teams building mission-critical apps the support and enterprise-specific functionality they need to be successful and reduce risk.
Ionic is the creator of Ionic Framework and works with hundreds of enterprise customers building everything from major consumer transportation apps, fast-food retail apps, internal B2E apps, and a whole lot more.
Ionic is here to help with dedicated support across Capacitor and its native APIs, as well as providing advanced enterprise native features like secure token management, encrypted offline storage, and OpenID authentication. Additionally, teams can build best-of-breed user experiences on top of Capacitor using the highly popular Ionic Framework.
Capacitor is well maintained
Capacitor is a key aspect of Ionic’s mobile infrastructure and the infrastructure of its customers. That means security and functionality issues are discovered, fixed, and released quickly. Cordova, in contrast, works on a more classic group consensus system and, as it is not driven by business or support goals, does not prioritize the needs of any specific users. Cordova is also a volunteer driven effort.
Capacitor has a full time team of engineers, product management, marketing, and customer success experts dedicated to customer and project success.
Migrating to Capacitor is easy
And Capacitor is backwards compatible with Cordova
If your team is currently using Cordova and curious about moving to Capacitor, then it will be welcome to know that Capacitor has backwards compatible support for a large swath of existing Cordova plugins.
Additionally, migrating to Capacitor from Cordova is well documented and straightforward.
Getting Started with Capacitor
Capacitor was designed to drop into any existing modern web app project and instantly add native and cross-platform capabilities.
Get in touch
Capacitor can accelerate your organization’s mobile and web development efforts, and the Ionic team is here to help along the way.
Interested in learning more about Capacitor, enterprise support and advanced integrations, or the Ionic platform in general? Get in touch, we’d love to see how we can help your organization build market-leading apps in a fraction of time compared to traditional app development.