Live data from Hacker News

Backend-as-a-service for web apps?

davewasmer.tumblr.com

11–20 of 68 posts

Re: Backend-as-a-service for web apps?

#11
Pedantically, RESTful APIs do not maintain session state on the server. This is important for scalability. (Whether "pure" REST is appropriate for a given API, or will be adopted if it is, is another question.)

If too much is done on the client-side, it loses some of the benefits of webapps, such as easier to pirate the working code; so the competitive advantage needs to be in the data (or in the server side processing) rather than the client app itself.

EDIT There's a general problem with RESTful APIs: they are fixed and can't be adapted to every use. You might end up doing a lot of transformation on the client side to assemble the info you want, and it might take several calls, causing latency. What's needed is something like relations and SQL, so you can extract the data in whatever structure you need, taking into account latency (assembled on the server, the message short though including oft-needed related data, and minimizing slow network trips). An obvious solution is for the server to just accept SQL directly - i.e. for that to be your RESTful API.

This doesn't sound right - it's certainly not a conventional RESTful API - but what exactly is the problem with it?

I think we don't have it yet, because there isn't a need for it in these early days - because, so far, it's common for one server to be used by just one client application, so that they are specifically customized for that one use-case. But what will happen when several different client applications want to use the same server? Secondly, these APIs are new, and there has been little time for them to change much, so the problem of compatibility with old clients hasn't arisen much.

SQL solves both these problems, of different application and of changes, but these problem don't exist so far. And I guess it's not certain that they will exist - if clients are always silently upgraded; if for a second app you just create a second RESTful API for it (so the integration occurs further back, at the database, instead of at the API).

Re: Backend-as-a-service for web apps?

#12
If a "BaaS" for a web app sounds appealing, try http://github.com/adelevie/parse_resource.

It lets you use Parse in a Ruby/Rails app with a very ActiveRecord-y API. By using it, your web app gets the following for free: documented REST API, documented iOS and Android SDKs, and the guy who helped scale Scribd is your DBA.

I've been using parse_resource to make some throwaway apps, and I'm currently "dog-fooding" it for a production app. I've found that the schema-lessness and zero-db-admin makes prototyping a snap.

I'm fairly active in developing it, and would really like some feedback, feature requests, and contributors.

Re: Backend-as-a-service for web apps?

#13
post #7

Earlier quoted context omitted.

Seems like that would only work in the simplest of cases. And then why would I pay someone for the backend of a trivial app?

I'm not sure. It certainly couldn't handle every use case, but maybe with some convention-style configurations (e.g. a record created via a POST to /users would hash any "password" field) you could handle a bunch of typical web app scenarios. And if that doesn't work, perhaps the schema-less prototyping is a free tier with a more robust backend service offering for the paid tier?

"The password field is handled differently than the others; it is encrypted on the server and never returned to any client request."

https://www.parse.com/docs/rest#users

Re: Backend-as-a-service for web apps?

#14
post #11

Pedantically, RESTful APIs do not maintain session state on the server. This is important for scalability. (Whether "pure" REST is appropriate for a given API, or will be adopted if it is, is another question.) If too much is done on the client-side, it loses some of the benefits of webapps, such as easier to pirate the working code; so the competitive advantage needs to be in the data (or in the server side processi…

I don't think I was clear enough on that point - I didn't mean that the session state itself would be accessed as a REST resource.

I imagine the session state would consist of client side Javascript (since this service would be ideal for the type of single page apps served well by Backbone.js and the like). The javascript would probably submit time-expiring authentication tokens with each request. That way, session could be persisted client side, while maintaining permissioned access to the CRUD actions on the service side.

EDIT (to respond to 6ren's edit):

I agree that, in a production environment, the flexibility of the rapid prototyping could, in many cases, turn into rigidity when faced with just a RESTful API.

But not necessarily in all cases, especially when implementing a single page app style site, where you are more likely to persist data client side in the background for when you need it.

Ultimately, I think the tradeoff might be worth in some circumstances. And given the apparent success of the many mobile BaaS solutions, it seems to be often enough to capitalize on.

Re: Backend-as-a-service for web apps?

#16
See CouchDB.

What is CouchDB?

A document database server, accessible via a RESTful JSON API.

Ad-hoc and schema-free with a flat address space.

Distributed, featuring robust, incremental replication with bi-directional conflict detection and management.

Query-able and index-able, featuring a table oriented reporting engine that uses JavaScript as a query language.

http://couchdb.apache.org/docs/intro.html

Re: Backend-as-a-service for web apps?

#17
post #11

Pedantically, RESTful APIs do not maintain session state on the server. This is important for scalability. (Whether "pure" REST is appropriate for a given API, or will be adopted if it is, is another question.) If too much is done on the client-side, it loses some of the benefits of webapps, such as easier to pirate the working code; so the competitive advantage needs to be in the data (or in the server side processi…

[deleted]

Re: Backend-as-a-service for web apps?

#18
This highly depends on the kind of apps which needs to be done. Its highly difficult to generalize a backend for a n number of apps. I am not comparing the term "backend" here with Parse or YQL or aggregating datasources which is great. You write a backend to custom suite your app so that its highly performant both on the client and server side and you have paas hosting services for the language of choice. I would personally not like to have a generalized backend.

Re: Backend-as-a-service for web apps?

#19

Earlier quoted context omitted.

The problem with webapps using a BAAS intended for mobile apps is the same origin policy. I've yet to find any providers that support Cross-Origin Resource Sharing. This restriction doesn't apply to mobile apps (or Chrome extensions)

If it were to operate as simply a REST API, then the service could simply return everything via JSONP to avoid the CORS trap.

JSONP should only be used for public web services. otherwise, any third party website could make privileged calls.

The BaaS architecture is actually a perfect situation for making privileged calls with CORS, because the server is wholly responsible for the user's identity and permissions.

Re: Backend-as-a-service for web apps?

#20
On the REST part it is not ideal for complex object based system where there are multiple resources which have n number of relationships and different http verbs on them can be mean different operations when exposed in a different way. ( I know its confusing.. :)). I just look at it as a design pattern which makes client side devs consume your services easily. It definitely helps in creating simple webservices but REST as a whole I would say doesn't satisfy everything a backend developer would want to expose or do in an efficient way. Think of batching... in REST.
Post reply on HN