FireCore is designed to be a drop-in DataSource for SproutCore that uses Firebase as the back-end to store your data.
It's super-easy, and super-fast to get started!
If you just want to play around with FireCore/Firebase, clone the example application,
BigFlames and just run sproutcore server.
Using FireCore in your own app is very easy, but we'll walk you through the entire process from start to finish.
-
First sign up for a Firebase account, then create your app by entering a name in the App Name field.
-
Click on your new app, and you will see a fairly blank screen with a section showing all of the data in your application. Currently, that would just be the empty, root node.
Now you're ready to setup your project to work with FireCore:
-
Next, clone this project into the
frameworksdirectory of your SproutCore application:cd MyProject mkdir -p frameworks/firecore git clone https://github.com/profoundry-us/FireCore.git frameworks/firecore -
Edit your app's
Buildfileto require it:config :my_app, :required => [:sproutcore, :firecore] -
Generate a data source:
sproutcore gen data-source MyApp.MyDataSource -
Edit the data source to use FireCore:
MyApp.MyDataSource = FireCore.DataSource.extend({ firebaseApp: "myfirebaseapp" }); -
Edit your app's
core.jsfile to use the new data source:SC.Store.create().from('MyApp.MyDataSource') -
Define a model:
MyApp.MyModel = SC.Record.extend({ title: SC.Record.attr(String), isHot: SC.Record.attr(Boolean, { default: YES }) }); -
Start your server and start creating content!
MyApp.store.createRecord(MyApp.MyModel, { title: "FireCore rocks!", isHot: YES }); MyApp.store.commitRecords();
When you look at your Firebase App's data view, you'll see your data appear magically!
By default, Firebase data is fully open. That means that if someone has your URL, they can read your data. This is generally not a good idea, so you'll want to add some Security Rules to your app to protect your data.
If you run into any problems when using FireCore, please submit a new issue and we'll get right on it!

