Files
2nd/10_Wiki/Topic_Programming/Coding/Mobile_Tauri_Capacitor.md
T
Antigravity Agent 9148c358d0 docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
2026-07-05 00:33:48 +09:00

6.4 KiB

id, title, category, status, source_trust_level, verification_status, created_at, updated_at, tags, tech_stack, applied_in, aliases
id title category status source_trust_level verification_status created_at updated_at tags tech_stack applied_in aliases
mobile-tauri-capacitor Tauri / Capacitor — Web 기술 → Native Coding draft B conceptual 2026-05-09 2026-05-09
mobile
tauri
capacitor
electron
vibe-coding
language applicable_to
TS / Rust / JS
iOS
Android
Desktop
Tauri
Capacitor
Electron
Ionic
web-to-native
system webview

Tauri / Capacitor / Electron

Web tech (React / Vue) → native app. Tauri = Rust + system webview (가벼움), Capacitor = Mobile 우선, Electron = Desktop only Chromium 포함 (큼).

📖 핵심 개념

  • WebView 기반: 시스템 browser engine.
  • Native bridge: JS ↔ native 통신.
  • Bundle size: Tauri ~3MB / Electron ~150MB.
  • Performance: native < Tauri ≤ Capacitor ≤ Electron.

💻 코드 패턴

Tauri (Rust + Web)

npm create tauri-app
# 또는 기존 web 프로젝트에
npm install -D @tauri-apps/cli
npx tauri init
// src-tauri/src/main.rs
use tauri::Manager;

#[tauri::command]
fn greet(name: &str) -> String {
    format!("Hello, {}!", name)
}

#[tauri::command]
async fn read_file(path: String) -> Result<String, String> {
    std::fs::read_to_string(path).map_err(|e| e.to_string())
}

fn main() {
    tauri::Builder::default()
        .invoke_handler(tauri::generate_handler![greet, read_file])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}
// React 안
import { invoke } from '@tauri-apps/api/core';

const greeting = await invoke<string>('greet', { name: 'Alice' });
const content = await invoke<string>('read_file', { path: '/tmp/x' });

Tauri Mobile (2.0+)

npx tauri ios init
npx tauri android init
npx tauri ios dev
npx tauri android dev

→ Tauri 가 iOS / Android 도 지원 (2024+).

Capacitor (Ionic)

npm install @capacitor/core @capacitor/cli
npx cap init
npm install @capacitor/ios @capacitor/android
npx cap add ios
npx cap add android
import { Camera, CameraResultType } from '@capacitor/camera';
import { Geolocation } from '@capacitor/geolocation';

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

const pos = await Geolocation.getCurrentPosition();
npx cap sync           # web build → native projects
npx cap open ios       # Xcode 열기
npx cap run ios        # build + run

Capacitor plugin

// plugins/MyPlugin.ts
import { registerPlugin } from '@capacitor/core';

interface MyPlugin {
  doStuff(options: { value: string }): Promise<{ result: string }>;
}

const MyPlugin = registerPlugin<MyPlugin>('MyPlugin');
export default MyPlugin;
// ios/App/MyPlugin.swift
import Capacitor

@objc(MyPlugin)
public class MyPlugin: CAPPlugin {
    @objc func doStuff(_ call: CAPPluginCall) {
        let value = call.getString("value") ?? ""
        call.resolve(["result": value.uppercased()])
    }
}

Electron (desktop only)

npm install electron
// main.js
const { app, BrowserWindow, ipcMain } = require('electron');

app.whenReady().then(() => {
  const win = new BrowserWindow({
    width: 1200, height: 800,
    webPreferences: { preload: 'preload.js', contextIsolation: true, nodeIntegration: false },
  });
  win.loadURL('http://localhost:5173');
});

ipcMain.handle('read-file', async (event, path) => {
  return require('fs').readFileSync(path, 'utf8');
});
// preload.js
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('api', {
  readFile: (path) => ipcRenderer.invoke('read-file', path),
});

Bundle size 비교

Hello world app:
- Tauri:     2-5 MB
- Capacitor: 8-15 MB (apk/ipa)
- Electron:  120-200 MB (Chromium 포함)

Updates

// Tauri updater
import { check } from '@tauri-apps/plugin-updater';

const update = await check();
if (update?.available) {
  await update.downloadAndInstall();
}
// Capacitor — Live Update (Ionic) / 자체 OTA
// Electron — electron-updater
import { autoUpdater } from 'electron-updater';
autoUpdater.checkForUpdatesAndNotify();

Native API access

// Tauri
import { fs, dialog, notification } from '@tauri-apps/api';
await dialog.message('Hello');
await notification.sendNotification({ title: 'Done' });

// Capacitor
import { Filesystem } from '@capacitor/filesystem';
import { Toast } from '@capacitor/toast';
import { Haptics } from '@capacitor/haptics';

Webview tradeoffs

iOS WKWebView:
+ Native rendering
- Apple WebKit engine 만 (Safari 같은 quirks)

Android WebView:
+ Updateable (Play Store)
- 옛 Android = 옛 webview engine

Tauri = system webview = 일관성 변동.
Electron = Chromium 포함 = 일관성 강 but 큼.

Security

// Tauri allowlist
// tauri.conf.json
{
  "tauri": {
    "allowlist": {
      "fs": { "readFile": true, "writeFile": false },
      "shell": { "open": true }
    }
  }
}

// Capacitor — 같은 native 권한
// Electron — contextIsolation: true + preload bridge

vs Native / RN / Flutter

Tauri / Capacitor:
+ Web tech reuse
+ Bundle 작은 (Tauri)
- 일부 native API 어려움
- Webview rendering = 일부 jank

Native:
+ Best UX / API access
- Two codebases

RN / Flutter:
+ Single codebase + native rendering
- 학습 / 더 큰 ecosystem

🤔 의사결정 기준

상황 추천
기존 web app → desktop Tauri (가벼움) / Electron (큰 ecosystem)
기존 web → mobile Capacitor / Tauri Mobile
새 cross-platform Flutter / RN
Native UX critical Native
Quick prototype + reuse code Capacitor
매우 작은 bundle Tauri

안티패턴

  • 모든 거 webview: native UX 잃음.
  • Bundle size 무시 (Electron 200MB): 사용자 다운로드 거부.
  • Auto-update 없음: 사용자 갱신 못 함.
  • Permission 모두 allow: 보안. allowlist.
  • Native API + browser API 혼용: 일관 X.
  • Old webview 가정 + ES2023: polyfill / target down.
  • Electron contextIsolation false: nodeIntegration = security 구멍.

🤖 LLM 활용 힌트

  • Tauri = 가볍고 modern, Mobile 도 OK.
  • Capacitor = Ionic 있는 사용자.
  • Electron = legacy / 큰 desktop.
  • Web reuse > native UX 인 경우 적합.

🔗 관련 문서