DEV Community

Arhan Khan
Arhan Khan

Posted on

Capacitor for Beginners: Turn Your Web App Into a Mobile App

Capacitor lets you take a web app — the HTML, CSS, and JavaScript you already know — and run it as a native app on iOS and Android. You do not rewrite your app. You wrap it in a native shell and add access to native features like the camera, storage, and push notifications through plugins.

Capacitor is made by the Ionic team, and it works with any web framework — React, Vue, Angular, Svelte, or plain JavaScript. Your web code runs in a native WebView, and Capacitor's bridge lets JavaScript call native code and get results back.

Here is how you add it to an existing web project:

npm install @capacitor/core @capacitor/cli
npx cap init MyApp com.example.myapp
npx cap add ios
npx cap add android
npm run build
npx cap sync
Enter fullscreen mode Exit fullscreen mode

After that, your built web files live inside a real iOS and Android project that you open in Xcode or Android Studio. Native features are one import away:

import { Camera, CameraResultType } from '@capacitor/camera';

const photo = await Camera.getPhoto({
  quality: 90,
  resultType: CameraResultType.Uri
});
Enter fullscreen mode Exit fullscreen mode

That single call opens the native camera on the phone — no platform-specific code from you.

To start, build any small web app first — a notes app, a calculator, a weather page — then add Capacitor to it. Run it on a real device or an emulator to see your web code behave like a real app.

Capacitor is a great fit if you already have a web app and want a mobile version without learning native development or maintaining two codebases. It is also a good choice for teams that ship on web and mobile from one codebase.

The limits are real. Heavy graphics and animations can feel slower in a WebView than in a fully native app. Some native features need custom plugins if no official one exists. And you still need a Mac to build for iOS, which is Apple's rule, not Capacitor's.

Take a web app you already built and wrap it with Capacitor this weekend. Seeing your own project open on your phone as a real app is the fastest way to understand what it offers.

Top comments (0)