Today we are incredibly excited to announce the alpha release of a major new open source project: Capacitor.
Capacitor aims to build a better Native runtime for the future of Ionic apps running everywhere: iOS, Android, Electron, and on the web as a Progressive Web App.
Capacitor offers a consistent API that handles operations on the underlying platform in a portable, cross-platform way. That means one app built with Capacitor will work no matter where it runs.
Features of Capacitor
Capacitor has some handy features we’re really excited about:
- First class Progressive Web App support: use the same APIs you do for native apps on the web for 100% code sharing, including Web UI’s for plugins like
- Simple Plugin model for building reusable plugins or quickly adding custom native code
- Embraces Swift on iOS for maximum compatibility with existing iOS developer ecosystem
- A rich standard library of Native features with simple APIs, such as Filesystem access, Haptic feedback, Background tasks, and more.
- Treats your native project as a source artifact, making it easy to add custom native code and install SDKs that require native modifications, as well as sharing native work with existing native developer teams (if desired).
- Drops into any existing modern frontend project
- Has no global CLI, so versions of Capacitor are easily managed per-app
- Plugins are managed through
- Support for many Cordova plugins (and improving all the time).
That’s a long way of saying there’s some cool features in Capacitor we think Ionic developers will appreciate.
Why We’re Building Capacitor
As Ionic has grown, we’re increasingly helping teams at fast growing startups and the Fortune 1000 with problems beyond just the core Ionic Framework UI components they are using. These teams expect that we can help them with other mobile challenges, and highest on their list is almost universally better native support and plugins.
It was no longer good enough for us to push off the responsibility of native plugins and functionality to the community. We knew we had to take responsibility for that part of the stack if we wanted to provide a level of service that our customers expected, and a developer experience that led in the mobile market.
Capacitor is our effort to do just that.
Since we released Ionic in 2014, we’ve been building a laundry list of things we’d love to see at the native layer to really take Ionic apps to the next level. We finally got sick of talking about it and decided to build it.
Improving on Cordova
The goal of Capacitor is provide an alternative to Cordova for Ionic apps (and non-Ionic apps, too!). We are huge fans of Cordova, and we’ve had a lot of ideas over the years about how to improve on it for the purposes of building Ionic apps (many of those being purely a matter of opinion).
We’re making a few significant changes to what Cordova offers, specifically tooling, the standard plugins available out of the box, the process for building custom native plugins and/or code, how native project code is managed, and support for Progressive Web Apps.
Capacitor is not a fork of Cordova but a ground-up new tool built at Ionic. As such, the code has taken some different paths. For example, Capacitor goes all-in on Swift for iOS plugins and code, one of the first of similar projects to embrace Swift and use the platform most iOS developers are using today (Obj-c still works, of course). Another difference is that Capacitor’s JS runtime is meant to be built into your app, providing a cross-platform API translation layer for Native and Web API calls.
We want to be clear: we are not abandoning Cordova nor the hybrid approach it championed. Capacitor is our attempt to bring this major piece of the Ionic developer experience in house to improve the support and experience for all Ionic developers, as well as target the specific use cases we are focused on as a company (such as Progressive Web Apps).
Finally, we know a big reason why developers choose Cordova is the rich 3rd party plugin ecosystem. We’ve designed Capacitor from the start to support the majority of existing Cordova plugins, and using them is as simple as
npm install‘ing the plugin and running a simple update command.
Capacitor was designed primarily to drop-in to any existing modern frontend project, and, once Capacitor reaches a stable release, Ionic CLI will have support for it baked right in.
This process involves running an
init command to configure up your project, adding the initial platforms you’d like to support, and building/running your app.
We’ve got a lot of things planned for Capacitor, both open source and commercial.
Some things you can look out for:
- Improving Cordova Support: Many plugins work, but some don’t. We want to get closer to 100% if possible.
- Electron support: Having first-class Electron support is a priority for 2018
- Ionic Pro Support: Integrate Capacitor into Ionic Pro for package and other services
- Native UI Shell: Mixing Native UI and Web w/ a cross platform UI. The “Hybrid Sweet Spot”
- Enterprise plugins and support: We’re working with a few teams on official Enterprise plugins for Capacitor and Cordova. Interested? Email me
We need your feedback!
Today’s alpha release represents three months of hard work over thousands of commits, and we’re just getting started.
Capacitor is not production ready yet, but we hope to be at that point soon. For Capacitor to move forward, we need your feedback and testing. You can help us by trying the project, and filing issues on the Capacitor GitHub Repo. We’d also love to have you join the Capacitor Slack for real time chatter and feedback.
We look forward to your feedback and experience trying the Capacitor Alpha! 🍻