• Stars
    star
    302
  • Rank 133,678 (Top 3 %)
  • Language
    Dart
  • License
    Apache License 2.0
  • Created over 1 year ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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.

More Repositories

1

react-native-firebase

πŸ”₯ A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
JavaScript
11,434
star
2

rdash-angular

AngularJS implementation of the RDash admin dashboard theme
HTML
4,691
star
3

react-native-material-design

React Native UI Components for Material Design
JavaScript
3,155
star
4

notifee

βš›οΈ A feature rich notifications library for React Native.
TypeScript
1,712
star
5

react-native-apple-authentication

A React Native library providing support for Apple Authentication on iOS and Android.
JavaScript
1,338
star
6

react-native-firebase-starter

DEPRECATED: For RNFB v5 only.
JavaScript
1,170
star
7

melos

πŸŒ‹ A tool for managing Dart projects with multiple packages. With IntelliJ and Vscode IDE support. Supports automated versioning, changelogs & publishing via Conventional Commits.
Dart
1,034
star
8

react-native-google-mobile-ads

React Native Google Mobile Ads enables you to monetize your app with AdMob.
TypeScript
609
star
9

react-native-material-design-demo

An Android app to demonstrate react-native-material-design
JavaScript
494
star
10

react-native-notifee

Moved to https://github.com/invertase/notifee
TypeScript
467
star
11

docs.page

Instant Open Source docs with zero configuration.
TypeScript
424
star
12

stripe-firebase-extensions

Repository of Firebase Extensions built by Stripe.
TypeScript
418
star
13

firestore-ios-sdk-frameworks

⚑ Precompiled Firestore iOS SDKs extracted from the Firebase iOS SDK repository release downloads for faster build times.
Ruby
402
star
14

react-query-firebase

React Query hooks for managing asynchronous operations with Firebase. Supports Authentication, Analytics, Firestore & Realtime Database.
TypeScript
367
star
15

denque

The fastest javascript implementation of a double-ended queue. Used by the official Redis, MongoDB, MariaDB & MySQL libraries for Node.js and many other libraries.
JavaScript
347
star
16

zapp.run

Zapp! A free online sandbox environment for building Flutter applications in the browser.
Dart
309
star
17

spec

βœ… A streamlined testing framework for Dart & Flutter.
Dart
303
star
18

dart_custom_lint

πŸ’‘ Easily write powerful Dart & Flutter lint rules for your projects or for users of your packages.
Dart
269
star
19

angular-toasty

A simple standalone AngularJS module with extensive features that provides growl-style alerts and messages for your app!
CSS
255
star
20

react-native-firebase-docs

DEPRECATED: For RNFB v5 only.
189
star
21

github-action-dart-analyzer

A GitHub action to run Dart analyzer with annotation support.
TypeScript
168
star
22

flutterfire_cli

A CLI to help with using FlutterFire in your Flutter applications.
Dart
160
star
23

react-native-firebase-authentication-example

An example React Native Firebase application integrating authentication.
TypeScript
138
star
24

conference-app

Dart
116
star
25

dart_firebase_admin

πŸ”₯ A Firebase Admin SDK for Dart.
Dart
103
star
26

jet

✈️ Test your React Native modules e2e; mock-free and native testing code free.
JavaScript
98
star
27

globe

🌎 The global deployment platform for Dart & Flutter applications.
Dart
98
star
28

react-native-gradle-plugin

A gradle plugin for React Native Android that simplifies and standardises build configurations (such as dependency versioning) for Projects & React Native modules.
Groovy
62
star
29

dart_docker

πŸ‹ A Dart client for the Docker API via local unix socket.
Dart
41
star
30

flutter_desktop_webview_auth

WebView OAuth flows for desktop flutter apps
C++
31
star
31

dart_firebase_apis

πŸ”₯ Generated Firebase APIs for Dart. Additionally Includes private and unlisted APIs.
Dart
29
star
32

firebase-extensions

A collection of Firebase Extensions built by Invertase.
TypeScript
29
star
33

puppeteer-pool

Flexible Puppeteer Browser instance resource pooling.
JavaScript
28
star
34

deeps

Performant utilities to manage deeply nested objects. get, set, flatten, diff etc.
JavaScript
26
star
35

nodejs-paddle-sdk

A fully typed Node.js library for integration with Paddle.
TypeScript
26
star
36

samples

Collection of samples from our projects and tutorials.
Dart
20
star
37

dart-cli-utilities

βš’οΈ A monorepo containing a collection of packages that provide useful functionality for building CLI applications in Dart.
Dart
20
star
38

cluster-key-slot

Generates CRC hashes for strings - for use by Node Redis clients to determine key slots.
JavaScript
17
star
39

react-native-firebase-workshop-app

Showcasing React Native + Firebase
TypeScript
13
star
40

sails-firebase-auth

A SailsJS v1 JSON starter api with Firebase token authentication.
JavaScript
10
star
41

crc16

Native node addon to calculate CRC16 values.
C++
10
star
42

firebase-firestore-fields

Convert Firebase Cloud Firestore fields into a usable JavaScript format
JavaScript
10
star
43

react-native-auto-link-example

Init a React Native project with auto-linking πŸ”₯
Objective-C
10
star
44

react-native-template

Generic template for Invertase React Native projects
Objective-C
10
star
45

remix-firebase-storage-file-handler

An upload handler for Remix using Firebase Storage
TypeScript
8
star
46

a2a

Async await to Array -> `const [error, value] = await A2A(fooPromise());`
JavaScript
7
star
47

nodejs-google-java-format

Node.js repackaging of Google's native `google-java-format` tool.
JavaScript
7
star
48

dart_globe_examples

Repository containing various Dart examples for Globe.
6
star
49

nx-dart

A Nx plugin, that adds support for developing Dart and Flutter packages in a Nx workspace.
TypeScript
6
star
50

babel-preset-react-native-syntax

πŸ“¦Babel preset providing syntax only plugins used by babel-preset-react-native - supports React Native ^0.56.0.
JavaScript
5
star
51

firebase-relationship

A simple Firebase Realtime Database relationship manager.
JavaScript
5
star
52

firebase-extension-utilities

TypeScript
4
star
53

sails-ioredis

Redis adapter for waterline with sentinel and cluster support support (ioredis)
JavaScript
4
star
54

tutorials

πŸŽ“ A collection of open-source tutorials by us and the open-source community covering topics such as React Native and Firebase.
4
star
55

balanced-employee-ip-agreement

An English law and Open Source friendly Balanced Employee IP Agreement - providing a balanced approach to assigning control of intellectual property (IP) created by UK company employees. See releases for PDF/MD files
4
star
56

flutterfire_ui

Dart
3
star
57

redis-writable

Fast conversion of commands and args to redis protocol writables.
JavaScript
3
star
58

wtfork

Subscribe to and publish events between parent and child node processes using the standard node event emitter api or call parent methods directly from the child process and vice versa.
JavaScript
3
star
59

firebase-functions-python-old

[WIP] Firebase SDK for Cloud Functions and Python.
Python
3
star
60

llm-gcp

Python
3
star
61

extensions-quickstart-js

Firebase Extensions quick start examples
TypeScript
3
star
62

firebase_performance_flutter_example

Testing
Dart
2
star
63

meta

General guidelines and documentation for the Invertase GitHub org.
1
star
64

ios-sdk-10-issues

iOS SDK 10 Firebase Storage issues
Objective-C
1
star
65

react-custom-event

React hook for window CustomEvent
JavaScript
1
star
66

docker-react-native-firebase-android

Dockerfile
1
star
67

oss-discord-community

Nothing to see here.
1
star
68

.github

Default community health files for Invertase.
1
star