Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Iosched | 21,724 | 5 months ago | 77 | apache-2.0 | Kotlin | |||||
The Google I/O Android App | ||||||||||
React Native Firebase | 10,851 | 43 | 79 | 6 days ago | 184 | September 17, 2022 | 66 | other | JavaScript | |
🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services. | ||||||||||
Rowy | 4,755 | 6 days ago | 6 | August 23, 2020 | 54 | other | TypeScript | |||
Low-code backend platform. Manage database on spreadsheet-like UI and build cloud functions workflows in JS/TS, all in your browser. | ||||||||||
Flutter Tutorials | 4,612 | a month ago | 50 | mit | Dart | |||||
The repo contains the source code for all the tutorials on the FilledStacks Youtube channel. | ||||||||||
Firebase Js Sdk | 4,471 | 2 days ago | 589 | other | TypeScript | |||||
Firebase Javascript SDK | ||||||||||
React Firebase Starter | 4,457 | 2 | 5 months ago | 25 | July 22, 2016 | 135 | mit | JavaScript | ||
Boilerplate (seed) project for creating web apps with React.js, GraphQL.js and Relay | ||||||||||
Wild Workouts Go Ddd Example | 4,047 | a month ago | 28 | mit | Go | |||||
Go DDD example application. Complete project to show how to apply DDD, Clean Architecture, and CQRS by practical refactoring. | ||||||||||
Vuefire | 3,538 | 149 | 6 | 25 days ago | 47 | December 07, 2020 | 35 | mit | TypeScript | |
🔥 Firebase bindings for Vue.js | ||||||||||
Reactfire | 3,308 | 882 | 8 | 5 months ago | 165 | August 19, 2022 | 70 | mit | TypeScript | |
Hooks, Context Providers, and Components that make it easy to interact with Firebase. | ||||||||||
React Redux Firebase | 2,543 | 795 | 26 | 4 months ago | 165 | November 23, 2021 | 173 | mit | JavaScript | |
Redux bindings for Firebase. Includes React Hooks and Higher Order Components. |
This is an experimental plugin for Security Rules, which means you should always validate these by hand before you decide to deploy these to a production environment.
This repository is maintained by Googlers but is not a supported Firebase product. Issues here are answered by maintainers and other community members on GitHub on a best-effort basis.
This is an experimental protoc
plugin
that generates Firebase Rules for Cloud
Firestore based
on Google's Protocol Buffer
format.
This allows you to easily validate your data in a platform independent manner.
Here is a quick example:
syntax = "proto2";
package tutorial;
message Person {
required string name = 1;
optional string email = 2;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
optional string number = 1;
optional PhoneType type = 2;
}
optional PhoneNumber phone = 3;
}
This plugin generates the following Firebase Rules function that can be used to validate your incoming data.
// @@[email protected]@
function isPersonMessage(resource) {
return resource.keys().hasAll(['name']) &&
(resource.keys().hasOnly(['name','phone','email'])) &&
((resource.name is string)) &&
((!resource.keys().hasAny(['email'])) || (resource.email is string)) &&
((!resource.keys().hasAny(['phone'])) || (isPerson_PhoneNumberMessage(resource.phone)));
}
function isPerson_PhoneNumberMessage(resource) {
return resource.keys().hasAll([]) &&
(resource.keys().hasOnly(['type','number'])) &&
((!resource.keys().hasAny(['number'])) || (resource.number is string)) &&
((!resource.keys().hasAny(['type'])) || (isPerson_PhoneTypeEnum(resource.type)));
}
function isPerson_PhoneTypeEnum(resource) {
return resource == 0 ||
resource == 1 ||
resource == 2;
}
// @@[email protected]@
// Start your rules (these don't get generated!)
service cloud.firestore {
match /databases/{database}/documents {
match /users/{userId} {
allow read: if request.auth.uid == userId;
allow write: if isPersonMessage(request.resource.data) &&
request.auth.uid == userId;
}
}
}
To use this protoc
plugin once you have your protocol buffers defined, follow
these steps:
protoc
$PATH
or use the
--plugin=protoc-gen-firebase_rules=./path/to/protoc-gen-firebase_rules
optionprotoc
tool using the --firebase_rules_out=./directory
flag
to output your firestore.rules
file with generated functions"firebase_rules_options.proto"
like the below example
the --proto_path=./directory
flag will need to be added to include the
directory of the firebase_rules_options.proto
file along with the protobuf
files from the src
directory of the Google Protobuf
repo. An more indepth
discussion of this can be found in this
issue.If you run into trouble feel free to check out our
example_usage.sh
script or file an issue
syntax = "proto3";
package tutorial;
import "firebase_rules_options.proto";
option (google.firebase.rules.firebase_rules).full_package_names = true;
message Person {
string name = 1;
string email = 2 [(google.firebase.rules.firebase_rules_field).validate =
"resource.email.matches('.*@domain\\.com')"];
enum PhoneType {
option (google.firebase.rules.firebase_rules_enum).string_values = true;
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
string number = 1;
PhoneType type = 2;
option (google.firebase.rules.firebase_rules_message).extra_properties =
true;
}
PhoneNumber phone = 3;
// Currently, we can only check this is a list :(
repeated string starred_websites = 4;
// This message must have either a phone or an email.
option (google.firebase.rules.firebase_rules_message).validate =
"resource.keys().hasAny(['email', 'phone'])";
}
This would generate the following functions.
// @@[email protected]@
function istutorial_PersonMessage(resource) {
return resource.keys().hasAll([]) &&
(resource.keys().hasOnly(['starredWebsites','phone','email','name'])) &&
((!resource.keys().hasAny(['name'])) || (resource.name is string)) &&
((!resource.keys().hasAny(['email'])) || (resource.email is string && (resource.email.matches('.*@domain\.com')))) &&
((!resource.keys().hasAny(['phone'])) || (istutorial_Person_PhoneNumberMessage(resource.phone))) &&
((!resource.keys().hasAny(['starredWebsites'])) || (resource.starredWebsites is list)) &&
(resource.keys().hasAny(['email', 'phone']));
}
function istutorial_Person_PhoneNumberMessage(resource) {
return resource.keys().hasAll([]) &&
((!resource.keys().hasAny(['number'])) || (resource.number is string)) &&
((!resource.keys().hasAny(['type'])) || (istutorial_Person_PhoneTypeEnum(resource.type)));
}
function istutorial_Person_PhoneTypeEnum(resource) {
return resource == 'MOBILE' ||
resource == 'HOME' ||
resource == 'WORK';
}
// @@[email protected]@
// Start your rules...
Install Bazel.
Build with bazel build //...
A sample invocation of the plugin, protoc-gen-firebase_rules
, is available
in example_usage.sh
. This script can be run from the command line.
It's easy to use protobuf_rules_gen if your project already uses Bazel.
proto_gen_firebase_rules_commit = "TODO"
http_archive(
name = "proto_gen_firebase_rules",
sha256 = "TODO",
strip_prefix = "protobuf-rules-gen-" + proto_gen_firebase_rules_commit,
url = "http://github.com/FirebaseExtended/protobuf-rules-gen/archive/" + proto_gen_firebase_rules_commit + ".tar.gz",
)
load("@proto_gen_firebase_rules//bazel:repositories.bzl", "protobuf_rules_gen_repositories")
protobuf_rules_gen_repositories()
load("@proto_gen_firebase_rules//bazel:defs.bzl", "firestore_rules_proto_library", "firestore_rules_binary")
There are three rules available:
See example/BUILD for an example of how to use these rules.
Build the proto-gen-firebase_rules
binary via bazel build //...
Ensure all the tests pass via bazel test //...
Build a binary for each platform (windows, linux, and darwin).
Tag a GitHub release and attach each prebuilt binary to the release.
protobuf-rules-gen
was initiated with ❤️️ by Tyler
Rockwood.
This is not an official Google product (experimental or otherwise), it is just code that happens to be owned by Google.