Search packages, repositories and app categories

Package detailsv1.1.0

pocketbase_server_flutter

Start Pocketbase Server directly from Android/IOS with flutter

AndroidiOSWebmacOSWindowsLinux
30-day downloads
138
Likes
35
Pub points
130

Install package

flutter pub add pocketbase_server_flutter

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The pocketbase_server_flutter package enables developers to launch a PocketBase server directly within Flutter applications on Android, iOS, Web, macOS, Windows, and Linux. It simplifies backend setup by embedding the database server into the app, ideal for prototyping, local development, or lightweight backend needs. The package leverages native binaries for each platform, ensuring compatibility and performance. It's particularly useful for apps requiring real-time data, authentication, and file storage without external server infrastructure.

Use cases

  • Local development of Flutter apps with embedded backend
  • Prototyping full-stack apps quickly
  • Offline-first applications with sync capabilities
  • Educational projects demonstrating full-stack Flutter
  • Simple CRUD apps with built-in database

Key features

  • Embeds PocketBase server in Flutter apps
  • Supports all major platforms including mobile and desktop
  • Automated server startup and management
  • Real-time database and authentication
  • Lightweight and easy to integrate

Suitable for

  • Flutter developers building full-stack apps
  • Beginners learning backend integration
  • Teams prototyping MVPs rapidly
  • Projects needing local database with real-time features
  • Apps requiring minimal server maintenance

Considerations

  • Not suitable for production-scale deployments
  • Increased app size due to bundled server binaries
  • Requires careful handling of server lifecycle
  • Limited scalability compared to cloud-hosted solutions
  • Potential security risks if exposed publicly

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

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

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package

No data available yet.