All Projects → ThomasWeiser → Elmfire Extra

ThomasWeiser / Elmfire Extra

High-level API for ElmFire

Programming Languages

elm
856 projects

Labels

Projects that are alternatives of or similar to Elmfire Extra

Bookdash Android App
An Android app that lets you download free children's books in different languages from non-profit publisher Book Dash
Stars: ✭ 649 (+3505.56%)
Mutual labels:  firebase
React Native Firestack
A firestack v3 react-native implementation
Stars: ✭ 726 (+3933.33%)
Mutual labels:  firebase
Awesome Presentations
A community-curated list of selective conferences around the world for developers
Stars: ✭ 16 (-11.11%)
Mutual labels:  firebase
Firebase Server
Firebase Realtime Database Server Implementation
Stars: ✭ 673 (+3638.89%)
Mutual labels:  firebase
Packtpub Crawler
Download your daily free Packt Publishing eBook https://www.packtpub.com/packt/offers/free-learning
Stars: ✭ 717 (+3883.33%)
Mutual labels:  firebase
Chat Sdk Ios
Chat SDK iOS - Open Source Mobile Messenger
Stars: ✭ 813 (+4416.67%)
Mutual labels:  firebase
Firesharp
An asynchronous cross-platform .Net library for Firebase
Stars: ✭ 601 (+3238.89%)
Mutual labels:  firebase
Miteb Frontend
Online portal to book events and rooms for clubs of MIT, Manipal ✨
Stars: ✭ 18 (+0%)
Mutual labels:  firebase
React Router Firebase Auth
Example of how to have protected routes with Firebase and React Router.
Stars: ✭ 725 (+3927.78%)
Mutual labels:  firebase
Dapp Boilerplate
🌀 Decentralize application boilerplate with React Redux and Firebase integration.
Stars: ✭ 6 (-66.67%)
Mutual labels:  firebase
Pyfcm
Python client for FCM - Firebase Cloud Messaging (Android, iOS and Web)
Stars: ✭ 674 (+3644.44%)
Mutual labels:  firebase
Emberfire
The officially supported adapter for using Firebase with Ember
Stars: ✭ 689 (+3727.78%)
Mutual labels:  firebase
Supabase
The open source Firebase alternative. Follow to stay updated about our public Beta.
Stars: ✭ 25,142 (+139577.78%)
Mutual labels:  firebase
Firebase Admin Go
Firebase Admin Go SDK
Stars: ✭ 651 (+3516.67%)
Mutual labels:  firebase
Thenetwork Open
TheNetwork is a blog cum chat app. It's completely built using firebase. Users can post, comment, like and bookmark the blogs, also users can send follow requests to connect with people. Users can create events and also prepare an event roadmap. Pagination for realtime data is also included in chats, blogs and events.
Stars: ✭ 17 (-5.56%)
Mutual labels:  firebase
App Framework
Applications for any device with HTML, CSS and JavaScript - free and open source!
Stars: ✭ 639 (+3450%)
Mutual labels:  firebase
Wild Workouts Go Ddd Example
Complete application to show how to apply DDD, Clean Architecture, and CQRS by practical refactoring of a Go project.
Stars: ✭ 756 (+4100%)
Mutual labels:  firebase
Espionage
An android application that can be run in background and give commands from fcm console to share sensor data
Stars: ✭ 18 (+0%)
Mutual labels:  firebase
Redux Firebase Middleware
🔌 🔥 Redux firebase middleware for React and React-native
Stars: ✭ 17 (-5.56%)
Mutual labels:  firebase
Angularfire
The official Angular library for Firebase.
Stars: ✭ 7,029 (+38950%)
Mutual labels:  firebase

High-level API for ElmFire

Treat your Firebase data like a local Dict

This package provides an API layer on top of the basic ElmFire API, that treats a Firebase collection as a key-value store and makes it available basically as an Elm dictionary with corresponding operations on it.

The package consists of two modules, for reading and writing respectively:

  • ElmFire.Dict

    • Mirroring a Firebase location as an Elm Dict
    • Getting a signal of all updates
    • One-time retrieval
  • ElmFire.Op

    • Inserting, updating and deleting of single key-value pairs
    • Inserting and deleting lists of key-value pairs
    • Updating the whole collection via the higher-order functions map, filter and filterMap
    • Operations on the whole store can selectively be run sequentially, in parallel or as a single transaction.

General Usage Pattern

These two modules are intended to be used together.

  • The state of the mirrored store will be held as a dictionary as part of the application's model.
  • Operations on the store are performed by the appropriate actions of the application.

Local modifications will be reflected immediately in addition to be sent to the Firebase server and to other clients subscribed to the same Firebase location. Likewise, remote modifications will be reflected in the local mirror.

Configuration

All functionality of the package is guided by a configuration record that defines type mappings and other specifics of the Firebase collection.

type alias Config v =
  { location: ElmFire.Location
  , orderOptions: ElmFire.OrderOptions
  , encoder: v -> JD.Value
  , decoder: JD.Decoder v
  }

location specifies the Firebase and sub-path where the store is hosted.

orderOptions can be used to filter and limit the elements, that should be included in the local mirror. Use ElmFire.noOrder to access the whole collection.

The API is parameterized on the store's value type v. This can be any Elm type, as long as suitable conversion functions are provided. Note that the keys are always of type String.

encoder and decoder are the functions used to convert between the value type in Elm code and the JSON schema in the Firebase.

Example Code

We setup a simple store with values of type Int.

url = "https://myfirebase.firebaseio.com/sub/path"

config : ElmFire.Dict.Config Int
config =
  { location = ElmFire.fromUrl url
  , orderOptions = ElmFire.noOrder
  , encoder = Json.Encode.int
  , decoder = Json.Decode.int
  }

Start to mirror the store as a signal model.

mirror = ElmFire.Dict.mirror config

port initSubscription : Task ElmFire.Error (Task ElmFire.Error ())
port initSubscription = fst mirror

model : Signal (Dict String Int)
model = snd mirror

Define two operations on the store and run them. The result will be reflected in the mirror.

-- Initialize the store  (run the tasks via a port)
opInit : ElmFire.Op.Operation Int
opInit =
  ElmFire.Op.fromList
    ElmFire.Op.sequential
    [("foo",1), ("bar",2)]

-- Double each value
opMap : ElmFire.Op.Operation Int
opMap =
  ElmFire.Op.map
    ElmFire.Op.sequential
    (\key val -> val * 2)

port runOperation : Task ElmFire.Error (List ElmFire.Reference)
port runOperation =
  Task.sequence <|
    List.map (ElmFire.Op.operate config) [opInit, opMap, opMap]

The package includes the complete example code in directory example/. There is also a more detailed demonstration app in directory demo/

Examples of projects using elmfire-extra

TodoMVC

An example usage of this package is this fork of TodoMVC. It uses Firebase to store and share the todo items.

It utilizes ElmFire.Dict and ElmFire.Op in the aforementioned usage pattern.

elmfire-extra-hello-world

Raine Revere published some instructive minimal example code. Starts here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].