パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v1.1.0

pocketbase_server_flutter

Flutter を使用して Android/iOS から Pocketbase サーバーを直接起動する

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
138
いいね数
35
Pub ポイント
130

パッケージをインストール

flutter pub add pocketbase_server_flutter

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

pocketbase_server_flutter パッケージは、Android、iOS、Web、macOS、Windows、Linux 上の Flutter アプリケーション内で PocketBase サーバーを直接起動できるようにします。データベースサーバーをアプリに埋め込むことで、バックエンドのセットアップを簡素化し、プロトタイピングやローカル開発、軽量なバックエンド要件に最適です。各プラットフォーム向けにネイティブバイナリを使用しており、互換性とパフォーマンスを確保しています。リアルタイムデータ、認証、ファイルストレージが必要だが外部サーバーインフラが不要なアプリに特に役立ちます。

用途

  • 埋め込みバックエンドを使用したFlutterアプリのローカル開発
  • 迅速なフルスタックアプリのプロトタイピング
  • 同期機能を備えたオフライン優先アプリケーション
  • フルスタックFlutterを示す教育プロジェクト
  • 組み込みデータベース付きのシンプルな CRUD アプリ

主な機能

  • Flutter アプリに PocketBase サーバーを埋め込みます
  • モバイルおよびデスクトップを含むすべての主要プラットフォームをサポートしています
  • サーバーの自動起動と管理
  • リアルタイムデータベースと認証
  • 軽量で統合が簡単

適している対象

  • Flutter開発者がフルスタックアプリを構築しています
  • 初心者がバックエンド統合を学ぶ
  • チームが迅速にMVPをプロトタイピングする
  • ローカルデータベースとリアルタイム機能を必要とするプロジェクト
  • 最小限のサーバー保守を必要とするアプリ

注意事項

  • 本番スケールの展開には適していません
  • バンドルされたサーバーのバイナリによるアプリサイズの増加
  • サーバーのライフサイクルを慎重に扱う必要があります
  • クラウドホスティングソリューションと比較してスケーラビリティが限られている
  • 公開された場合、セキュリティ上のリスクが生じる可能性があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Pocketbase Server Flutter

pocketbase_server version

Run Pocketbase Server directly from Android/IOS with flutter

Screenshot 2023-09-16 at 12 09 12 PM

Usage

Checkout Pocketbase Server example app

Start pocketbaseServer
PocketbaseServerFlutter.start(
  superUserEmail: "test@user.com",
  superUserPassword: "password",
  hostName: await PocketbaseServerFlutter.localIpAddress,
  port: "8080",
);
Advanced Usage
// Get path to load resources using `path_provider`
final Directory staticDir = await getTemporaryDirectory();

// Directory to load static files (Optional)
final String staticFolder = "${staticDir.path}/pb_static/";

// Directory to load js hook files (Optional)
final String hooksFolder = "${staticDir.path}/pb_hooks/";

// Directory to save sqlite files and default data
final String dataFolder = "${staticDir.path}/pb_data/";

// add `pb_static` and `pb_hooks` folder in assets of your project, and load all files from assets to given path
await PocketbaseServerFlutter.copyAssetsFolderToPath(
  path: staticFolder,
  assetFolder: "pb_static",
  overwriteExisting: true,
)

await PocketbaseServerFlutter.copyAssetsFolderToPath(
  path: hooksFolder,
  assetFolder: "pb_hooks",
  overwriteExisting: true,
);

PocketbaseServerFlutter.start(
  superUserEmail: "test@user.com",
  superUserPassword: "password",
  hostName: await PocketbaseServerFlutter.localIpAddress,
  port: "8080",
  enablePocketbaseApiLogs: true,
  dataPath: dataFolder,
  staticFilesPath: staticFolder,
  hookFilesPath: hooksFolder,
);

Stop pocketbaseServer

PocketbaseServerFlutter.stop();

Listen to pocketbaseServer events, setup eventCallback

PocketbaseServerFlutter.setEventCallback(
    callback: (event, data){
        // Handle event and data
    },
);

Some helper methods

// To check if pocketBase is running (not reliable)
PocketbaseServerFlutter.isRunning

// To check pocketbaseMobile version
PocketbaseServerFlutter.pocketbaseMobileVersion

// To get the ipAddress of mobile ( to run pocketbase with this hostname )
PocketbaseServerFlutter.localIpAddress

Mobile Setup

  • IOS

If getting error related to Undefined symbol, Make sure to run pod install on ios directory, open IOS project in XCode

Click on Pods, Then select pocketbase_server_flutter from Targets list, and select Build Phases

Screenshot 2023-09-16 at 11 19 30 AM

Then in Link Binary With Libraries section, click on + button and search for libresolv.tbd and choose from result and click on Add

image

  • Android

Should work out of the box

Desktop Setup

Desktop requires pocketbaseExecutable path in start()

To get pocketbaseExecutable in app, add the executable in Assets and on runtime copy it from assets to another path using path_provider Or download the executable on Runtime

  • MacOS

Edit your Runner/**.entitlements file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
	<dict>
		<key>com.apple.security.app-sandbox</key>
		<false />
		<key>com.apple.security.cs.allow-jit</key>
		<true />
		<key>com.apple.security.network.client</key>
		<true />
		<key>com.apple.security.network.server</key>
		<true />
	</dict>
</plist>
  • Windows, Linux

Should work out of the box

Resources

https://pocketbase.io/

Built with: pocketbase_mobile

Note

This is for running Pocketbase server from mobile, to connect with pocketbase server, use official pocketbase client plugin

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。