搜尋套件、儲存庫與 APP 分類

套件詳情v0.0.2+4

supabase_functions

撰寫並部署 Dart 函數至 Supabase Functions。

近 30 天下載
2550
喜歡數
9
Pub 分數
130

安裝套件

flutter pub add supabase_functions

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

supabase_functions 套件讓開發者能夠直接在 Supabase Functions 上撰寫、部署和呼叫基於 Dart 的無伺服器函數。由 invertase.io 所建構,它能順暢地將 Dart 程式碼整合至後端工作流程,並利用 Supabase 的基礎設施來實現可擴展且安全的函數執行。此套件非常適合透過自訂業務邏輯擴充 Supabase、處理 Webhook 或即時處理資料。它支援透過 CLI 部署,並與 Flutter 應用程式完美整合。該套件是更廣泛的 Dart Edge 生態系統的一部分,強調效能與開發者體驗。

適用情境

  • 無伺服器後端邏輯
  • Webhook 處理程序
  • 即時資料處理
  • 自訂 API 端點
  • 認證擴展
  • 檔案處理工作流程

主要特色

  • Dart 首選的無伺服器函數
  • 無縫整合 Supabase
  • CLI 部署支援
  • 類型安全的函數定義
  • 內建錯誤處理
  • 輕量級執行時

適合對象

  • 使用 Supabase 的 Flutter 開發人員
  • Dart中的後端邏輯
  • 無伺服器架構
  • 全-stack Dart 應用
  • 偏好 Dart 而非 JavaScript 的 Teams

使用建議

  • 需要 Supabase 帳戶
  • 僅限 Supabase Functions 平台
  • 無原生本地開發環境
  • 依賴 Dart Edge 執行時間
  • 函數執行限制適用
  • 冷啟動延遲可能

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

[!WARNING] This repository is no longer maintained and is left archived for educational purposes. Whilst an interesing project, there were too many issues around DX and stability (testing, compilation times etc) to take it any further.

Dart Edge (Experimental)

Run Dart on the Edge - supporting Vercel, Cloudflare Workers & Supabase Edge Functions (more coming soon).

Melos docs.page Chat on Discord

Documentation • Examples • License

About

Dart Edge is a project aimed at running Dart code on Edge functions, including support for platforms such as Cloudflare Workers, Vercel Edge Functions & Supabase Edge Functions (more to come).

import 'package:vercel_edge/vercel_edge_shelf.dart';
import 'package:shelf_router/shelf_router.dart';
import 'package:shelf/shelf.dart';

void main() {
  VercelEdgeShelf(
    fetch: (request) async {
      final app = Router();

      app.get('/user/<id>', (request, String id) async {
        return Response.ok('Welcome, $id');
      });

      app.all('/<ignored|.*>', (request) {
        return Response.notFound('Resource not found');
      });

      final handler = const Pipeline().addMiddleware(logRequests()).addHandler(app);
      return handler(request);
    },
  );
}

Edge functions are serverless functions which run on Edge networks, providing a number of benefits to server based environments (but also carried some limitations). Some of these benefits include:

  • ⚡ Decreased Latency: Edge functions run close to your users, reducing request latency (rather than running in a region(s)).
  • ⏱ Code Boot Times: Edge functions have minimal code boot times vs traditional serverless functions.
  • ✨ Platform APIs: Access powerful platform specific APIs, such as Cloudflare Workers HTMLRewriter, KV, Durable Objects & more.
  • 🌎 Runtime APIs: Edge functions run on the JavaScript V8 runtime, and provides a subset of standard Web APIs to access familar APIs such as Cache, Crypto, Fetch, etc.

This project provides Dart bindings to the Edge runtime APIs, allowing you to write Dart code which can be run on Edge functions. Your code is compiled to JavaScript and deployed to the Edge network (WASM support possible in the future).

Supported Platforms

We are working to enable Dart Edge to be deployed to many platforms as possible. Currently we support:

Please see the platform documentation for API status.

Other platforms we'll likely add support for are; Netlify Edge, Deno Deploy, Supabase Functions, AWS Lambda@Edge. Feel free to reach out if you'd like to see support for a specific platform.

FAQs

❓ Why is it experimental?

This project is a new concept, and we're still figuring out things such as the public APIs, testing, best practices for local development & deployment and other complicated matters such as error handling and debugging (since Dart is compiled to minified JavaScript). We use this project in production ourselves as a dog-fooding exercise, however we'll keep it as experimental until we're happy we've covered all bases of what you'd expect from Dart development.

We will probably be making breaking changes without following semver until we're happy for a major release. So please be aware of this.

There's also some unimplemented APIs which we're working on. Please see the API documentation for more information.

❓ What is the motivation for this project?

We're big fans of serverless environments, and are using both Cloudflare Workers & Vercel Edge Functions on our own projects. Some of these projects (including Zapp!) are written in Dart. We wanted to be able to write Dart code and deploy it to these platforms to allow for code sharing & collaboration between the team, hence this project started.

❓ What are the limitations of Edge functions?

If you're not familar with the concept of serverless functions, you should be aware of the limitations. Typically to run Dart as a backend service, you will most likely reach for Shelf, (or use a framework such as as ServerPod, Dart Frog etc) which are deployed to services such as Google Cloud Run, AWS etc. These setups run your code in a container, running one or more long lived processed to keep your service running. You can access the file system, use a single database connection, establish a long-lived WebSocket connection, etc.

Serverless functions on the Edge are different. They are invoked once-per-request and are not long lived. You cannot access the file system, and in some cases cannot establish long-lived connections (depending on the platform). Netlify has a great article explaining the differences.


Built and maintained by Invertase.

所屬分類

依賴

依賴清單 5 項

  • deno_deploy^0.0.1-dev.6
  • edge^0.0.7
  • edge_runtime^0.0.4+2
  • js^0.6.5
  • js_bindings^0.1.0

原始碼儲存庫

使用此套件的專案

暫無相關資料。