capacitor README

The project's README from github.com/ionic-team/capacitor. As one markdown file: README.md.


⚡️ Cross-platform apps with JavaScript and the Web ⚡️


Capacitor lets you run web apps natively on iOS, Android, Web, and more with a single codebase and cross-platform APIs.

Capacitor provides a cross-platform API and code execution layer that makes it easy to call Native SDKs from web code and to write custom native plugins that your app may need. Additionally, Capacitor provides first-class Progressive Web App support so you can write one app and deploy it to the app stores and the mobile web.

Capacitor comes with a Plugin API for building native plugins. Plugins can be written inside Capacitor apps or packaged into an npm dependency for community use. Plugin authors are encouraged to use Swift to develop plugins in iOS and Kotlin (or Java) in Android.

Getting Started

Capacitor was designed to drop-in to any existing modern web app. Run the following commands to initialize Capacitor in your app:

npm install @capacitor/core @capacitor/cli
npx cap init

Next, install any of the desired native platforms:

npm install @capacitor/android
npx cap add android
npm install @capacitor/ios
npx cap add ios

New App?

For new apps, we recommend trying the Ionic Framework with Capacitor.

To begin, install the Ionic CLI (npm install -g @ionic/cli) and start a new app:

ionic start --capacitor

FAQ

What are the differences between Capacitor and Cordova?

In spirit, Capacitor and Cordova are very similar. Capacitor offers backward compatibility with a vast majority of Cordova plugins.

Capacitor and Cordova differ in that Capacitor:

See the docs for more details.

Do I need to use Ionic Framework with Capacitor?

No, you do not need to use Ionic Framework with Capacitor. Without the Ionic Framework, you may need to implement Native UI yourself. Without the Ionic CLI, you may need to configure tooling yourself to enable features such as livereload. See the docs for more details.

Contributing

See CONTRIBUTING.md.

Contributors

Made possible by the Capacitor community. 💖

capacitor (ionic-team/capacitor)

Searching Database…

16.9K ·GitHub
What is this?Capacitor is a cross-platform runtime that lets you run web apps natively on iOS, Android, and the Web from a single codebase, with APIs for calling native SDKs from your JavaScript.
Is this a framework or a library I add to my project?It's a cross-platform API and code execution layer you drop into a web app: it bridges your JavaScript to native SDKs and lets you write custom native plugins.
How do I add it to an existing web app?It's designed to drop in to any existing modern web app: run the init commands in your project, then install the native platforms you want. For brand-new apps the README recommends starting with Ionic via npm install -g @ionic/cli.
Do I need the Ionic Framework to use it?No. Without Ionic you may need to implement Native UI yourself and configure tooling like livereload manually, but Capacitor works fine on its own.
I've used Cordova before — will my app and plugins port over?In spirit it's very similar, and Capacitor is backward compatible with a vast majority of Cordova plugins. It just takes a more modern approach to tooling and treats native projects as source artifacts rather than build artifacts.
Does the same codebase also reach the regular web?Yes — Capacitor has first-class Progressive Web App support, so one app can ship both to the app stores and to the mobile web.
Which languages would I use to write my own native plugin?Plugin authors are encouraged to use Swift for iOS plugins and Kotlin (or Java) for Android.
Can I share my plugins with other developers?Yes — a plugin can live inside your Capacitor app or be packaged as an npm dependency for community use.
Is Capacitor free and open source?Yes — it's MIT-licensed and maintained by the Ionic Team, the same group behind the Ionic Framework.
Creator
ionic-team
Size
74.6 MB
Stars
16.9K
Age
8y
Commits · 90 Days