npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

capacitor-ota

v1.0.11

Published

Capacitor uygulamaları için Over-The-Air (OTA) güncelleme servisi.

Downloads

1,301

Readme

OTA Service

Capacitor uygulamaları için Over-The-Air (OTA) güncelleme servisi.

Mimari

┌──────────────────────────────────────────────────────────────┐
│                     ADMIN (Nadir)                            │
├──────────────────────────────────────────────────────────────┤
│  CLI/Panel → POST /api/versions/upload                       │
│       ↓                                                      │
│  1. Bundle → R2: /bundles/app/production/1.0.0.zip          │
│  2. Metadata → PostgreSQL                                    │
└──────────────────────────────────────────────────────────────┘

┌──────────────────────────────────────────────────────────────┐
│                     CİHAZ (Sık)                              │
├──────────────────────────────────────────────────────────────┤
│  App açılış → GET /updates/com.example.app.json             │
│       ↓                                                      │
│  Güncelleme var mı?                                          │
│       ↓ evet                                                 │
│  GET /bundles/app/production/1.0.0.zip                      │
│       ↓                                                      │
│  CapacitorUpdater.download() → set()                        │
└──────────────────────────────────────────────────────────────┘

CLI Kullanımı

Kurulum

cd capacitor-ota
pnpm install

Komutlar

Login

pnpm cli login <username> <password>

Token ~/.ota-cli.json dosyasına kaydedilir.

Uygulamaları Listele

pnpm cli apps

Çıktı:

📱 Apps:

ID            Name          Created
──────────────────────────────────────────────────
9fa3a103d8d0   MyApp         1/22/2026

Versiyonları Listele

pnpm cli versions <app_id>

Çıktı:

📦 Versions:

ID    Version    Channel      Active  Downloads  Created
─────────────────────────────────────────────────────────────────
1     1.0.0      production   ✅      150        1/20/2026
2     1.0.1      production           45         1/22/2026

Yeni Versiyon Yükle

pnpm cli upload <app_id> <path> [options]

<path> bir dizin veya .zip dosyası olabilir. Dizin verilirse CLI otomatik zipleyecektir.

Seçenekler: | Flag | Kısa | Açıklama | Varsayılan | |------|------|----------|------------| | --version | -v | Versiyon numarası | 1.0.0 | | --channel | -c | Kanal | production | | --min-native | | Minimum native versiyon | - | | --notes | | Release notes | - |

Örnekler:

# Dizin ile (otomatik ziplenir)
pnpm cli upload 9fa3a103d8d0 ./dist -v 1.0.5

# Zip dosyası ile
pnpm cli upload 9fa3a103d8d0 ./bundle.zip -v 1.0.5

Çıktı:

📦 Zipping directory: dist...
📤 Uploading...

✅ Upload successful!
   Version:  1.0.5
   Checksum: a1b2c3d4...

Versiyon Sil

pnpm cli delete <version_id>

Rollback

pnpm cli rollback <version_id>

Belirtilen versiyonu aktif yapar.

Konfigürasyon

# Mevcut ayarları göster
pnpm cli config

# API URL değiştir
pnpm cli set-url https://ota-api.silgi.dev

API Endpoints

Public (Auth Gerektirmez)

| Method | Endpoint | Açıklama | |--------|----------|----------| | GET | /updates/:appId.json | Static update check | | GET | /bundles/:path | Bundle download |

Protected (Auth Gerektirir)

| Method | Endpoint | Açıklama | |--------|----------|----------| | POST | /api/auth/login | Login | | POST | /api/auth/logout | Logout | | GET | /api/apps | App listesi | | POST | /api/apps | App oluştur | | PUT | /api/apps/:id | App güncelle | | DELETE | /api/apps/:id | App sil | | GET | /api/versions | Versiyon listesi | | POST | /api/versions/upload | Versiyon yükle | | DELETE | /api/versions/:id | Versiyon sil | | POST | /api/versions/:id/rollback | Rollback | | GET | /api/stats | İstatistikler |


Capacitor Entegrasyonu

1. Plugin Kur

npm install capacitor-ota
npx cap sync

2. App.vue

import { initOtaUpdate } from 'capacitor-ota'

// App başlangıcında
await initOtaUpdate({
  staticUrl: 'https://ota-api.silgi.dev',
  appId: 'com.example.app',
  appVersion: '1.0.0',
  autoApply: true,
  showUI: true,
})

Static JSON Format

Güncelleme bilgisi:

GET https://ota-api.silgi.dev/updates/com.example.app.json
{
  "version": "1.0.5",
  "url": "https://ota-api.silgi.dev/bundles/9fa3a103d8d0/production/1.0.5.zip",
  "checksum": "a1b2c3d4e5f6...",
  "min_native_version": "1.0.0",
  "release_notes": "Bug fixes",
  "updated_at": "2026-01-22T10:30:00.000Z"
}

Deployment

Development

pnpm dev

Production Build

pnpm build
node .output/server/index.mjs

Environment Variables

# PostgreSQL
DATABASE_URL=postgresql://user:pass@localhost:5432/capacitor_ota

# Cloudflare R2 (S3-compatible)
R2_ACCOUNT_ID=xxx
R2_ACCESS_KEY_ID=xxx
R2_SECRET_ACCESS_KEY=xxx
R2_BUCKET_NAME=ota-bundles

# Admin (generated on first setup)
ADMIN_PASSWORD_HASH=100000:salt:hash

Database Schema

PostgreSQL 18 + Drizzle ORM + UUID v7

  • admins - Admin kullanıcıları
  • sessions - Auth sessions
  • apps - Uygulamalar
  • versions - Versiyon kayıtları
# Migration oluştur
pnpm db:generate

# Migration uygula
pnpm db:migrate