Database for an App

Hello, I’m new with ember. For my app I want to add, list, edit and remove data secure in a database. For that i used PHP and MySQL yet. Now I want to use Amber to do that.

What is the best way to do that ? Can/should I use an MySQL/MariaDB Database for that? When which Add-on can I use for that ? Is it easy to write my own adapter for that ? Do you recommend an other database?

I’ve got an linux EC2 instance to use and can install everything there.

Thanks for your help.

Hi Kevin, I think you’ll find that the database doesn’t matter as much as the conventions you use when coding your API. Ember supports three standard adapter/serializer types out of the box: JSON (raw json objects), REST (very similar to JSON but wrapped in objects with type keys), and JSON API (a whole different spec). Depending on what server framework you use you could create an API that serves any one of these with pretty much any database. Of course you can customize any of those or write your own from scratch, it’s usually easiest to use the stock ones though if you can, and sticking with a convention like JSON API can make your life easier on the server side as well.

If you don’t to code your own API server you could use Firebase or PouchDB (I’m sure @broerse can weigh in more on that). Firebase at least is better suited to simpler database designs with little backend logic.

So if I understand it right then I need to write an API that serve Databases data in JSON or REST format and after editing push it back to the database ?

That’s sounds complicated. Thought there is an easier way to do that. How is it with Firebase or PuchDB ? Do they do that for me ?

Yup that’s pretty much it. And yeah it’s definitely complicated. Ember is front-end only, as are any javascript SPA frameworks these days.

It really depends on what sort of app you’re trying to write. If you just want simple database read/writes then something like Firebase or Pouch would probably be a great choice. I can’t speak to Pouch as much but I’m pretty familiar with Firebase and have written a couple apps with it.

Essentially firebase is a JSON database and a light server layer built in. You can read from/write to the database easily and as long as you don’t need to do lots of data processing or heavy backend logic it’s really easy and requires no backend coding. They also fairly recently introduce cloud functions which actually let you write bits of server-side logic more or less. Another nice thing about firebase in particular is that it comes with easy plug and play authentication support with a variety of providers (email/password, google, facebook, twitter, etc) and some other features, many of which are geared more towards mobile. There’s an ember addon for it too, so getting started is pretty easy.

So yeah if the app you have in mind is pretty straightforward read/write logic and you don’t need to lots of heavy processing or server-side logic I’d recommend looking into both to see which meets your needs. Firebase is fully managed, and the new database (firestore) scales automatically, but it costs money once you get to a certain volume. I believe Pouch is more of a self hosted server.

1 Like

@KevinK1 as @dknutsen mentioned we use a CouchDB / PouchDB combination that works with little setup effort out-of-the-box . If you are in the Northern part of Europe you can visit this Meetup where there is a talk about using Ember and CouchDB / PouchDB to manage a real forest for the Wageningen University. Also clone my Bloggr Example and start testing. Is works without you setting up a CouchDB server. This can you do later on when you like ember-pouch.

1 Like

Hey, I tried all day to set/get data from an CouchDB Server with ember-pouch. Is it with ember-pouch the right way to get/set data from a Server DB (couch db) from/to the App to present it to all his users ?? Or is that for just for a offline internet explorer DB ? I don’t now why there aren’t any good tutorials for this simple process. I tried just with ember-pouch…

  1. I installed it:

install ember-pouch

  1. Add in config the following:

adapted from your blog code BECAUSE add

described in the README.MD Tutorial from ember-pouch doesn’t work …

  1. add an adapter

ember g pouch-adapter application

  1. Generate a simple modle
  • name : DS.attr(‘string’),
  • rev : DS.attr(‘string’)
  1. tried to get data
export default Ember.Route.extend({

should it work ??

I don’t get any data in my Ember developer tool shown, just a DS.RecordArray. Don’t now what is to do with that. :frowning: It would be really nice if you can help me out there before I waste more time in that.

Thank you!