How to understand a Ionic and Capacitor codebase
Capacitor wraps a web app in native iOS and Android shells and gives it plugins for device features. Ionic adds mobile UI components on top of Angular, React or Vue. The bulk of the code is a normal web app; the native layer is the plugins and shells.
How to tell it's Ionic and Capacitor
capacitor.config.tsand@capacitor/coreinpackage.json@ionic/angular,@ionic/reactor@ionic/vueandroid/andios/folders
Where things usually live
- capacitor.config.ts
- App ID, web build folder (
webDir), plugin settings. - src/
- The web app, structured by its framework.
- src/app/ or src/pages/
- Ionic pages with
ion-*components. - android/ and ios/
- Native shells; synced with
npx cap sync.
Conventions, not rules. Real projects rename and move things, so confirm against the repository.
Where to start reading
- The web framework's entry and router
- Calls to
@capacitor/*plugins, which are the native touchpoints capacitor.config.ts
How a request moves through the code
- The native shell starts and loads the built web app from
webDir. - The web app runs as usual, with Ionic components styled for each platform.
- Device features are called through Capacitor plugins, which call native code.
- Results return to JavaScript as promises.
Questions to ask about the repository
- Which Capacitor plugins are used, and where?
- What platform-specific code exists in the native folders?
- How does the app behave when run in a browser instead of on a device?
What trips people up
- Changes to the web app need a build and
cap syncbefore they appear in native builds. - Some plugins don't work in the browser, so check for platform guards.