
Ask HN: Why am I still writing server-side code? - adamcharnock
This may be a crazy question, but I'm getting an increasing feeling that every time I write a new web app, I am writing the same server-side code over and over again. On the other hand, the JavaScript-heavy client-side needs careful control to get the interactions just right.<p>So, why do I still have to write server-side code?<p>Isn't there some service out there which I can spit data at from the client, and then read data back? Perhaps set some kind of data integrity rules? Some basic built in user auth system and permission control would be good.<p>Does this not already exist? If not, why? How hard can it be?<p>If it doesn't exist, and is possible, lets build it!
======
aespinoza
Have you looked at Backend as a Service providers? What a BaaS platform
provides is a way to avoid writing a lot of the server-side code. Which might
be what you are looking for.

We are currently in beta testing right now. You might want to check it out:

* iKnode (<http://iknode.com>)

If you like an invite, just signup here: <http://iknode.com/register/>

If what iKnode offer doesn't match what you are looking for, don't dismiss the
idea of a Backend as a Service just yet. Try the following as well:

* Parse (<http://parse.com>)

* Kinvey (<http://kinvey.com>)

* Stackmob (<http://stackmob.com>)

Among others...

EDIT: Fixed the Kinvey Link.

~~~
adamcharnock
Ah, that seems to be pretty much what I am after. There seems to be a definite
slant towards mobile backends though, but that is the place to be I suppose.

I've signed up for iknode - it would be great to check it out!

~~~
kls
Technically if it relies on HTTP symantics like REST or JSON-RPC a JavaScript
client can consume it just as easily. They probably market to mobile more
heavily because that is a hot market but generally mobile and JavaScript
clients rely on the same back end, which is usually some form of REST, JSON-
RPC, document literal XML or SOAP, the last two being less common.

~~~
aespinoza
Yes I know. Parse and Kinvey are extremely focused on Mobile right now, even
thought their technology could easily be used in Web apps. They use REST and
JSON just like we do.

In the case of iKnode, we are focusing mostly on web sites. I have to be
honest. We don't particularly like the mobile environment so much, specially
because it feels like a step backwards for standards. We believe firmly in the
Web. So we do support mobile environments, but we are pushing for the web to
be successful. Even if mobile is hot right now.

------
Arelius
On the same note, why do we keep writing the same client-side code over and
over again, Isn't there some sort of system that can take arbitrary data from
the server, and display it for user input/modification? Perhaps some
layout/templating and simple data interaction rules.

Also, I'm not really being sarcastic or the like. But overall, data
presentation has always been pretty trivial IMO. For the bsaic set of data-
munging apps that so many tend to build, I can't imagine a 90% solution can't
exist as a simple set of basic data definitions and rules.

In fact, aren't we both just talking about something like Filemaker on
steroids?

~~~
AznHisoka
to take it even a step further, why do we keep writing the same web app over
and over again? that should be a machine that autogenerates web apps given a
template with the name of the app, url, and purpose.

------
ericktai
StackMob has that prebuilt backend that you're talking about. It has the REST
API and datastore/schema generation built already so that you can just start
connecting and saving right away. By the way I do work at StackMob, so in the
interest of full disclosure I ought to mention that! But I'm here as a fellow
frontend developer.

I had to make a site for my fiancee and I's wedding, and I realized I could
whip one up really quick and just stick it on StackMob - backend, hosting,
everything.

An example saving/fetching data to/from StackMob via the StackMob JS SDK
(built on Backbone.js):

var user = new StackMob.User({ username: 'ericktai', password: 'opensesame',
..}); user.create(); //this saves your user to the datastore on StackMob's
servers in the background via AJAX

var users = new StackMob.Users(); //notice plural users.fetch(); //this
fetches all users

var user = new StackMob.User({ username: 'ericktai'}); //notice singular
user.fetch(); //this fetches my user from StackMob

Sounds like you're writing a JS web app, so you can also try our JS SDK that
lets you connect to StackMob's backend - it's your datastore already built on
servers. Here's a tutorial I wrote up to give you an idea of what that
actually means programatically.

<http://www.stackmob.com/devcenter/docs/JS-SDK-Tutorial>

To make sure you don't run into any cross domain AJAX call issues, we host
your html app also. This relieves you of having to worry about whether
browsers support cross-origin headers or not.

Good luck to you developing! It's great that there are so many tools out there
nowadays like aespinoza mentioned! Find the tool that works best for you :)

~~~
kls
I don't want to diverge too far of topic but do you know if there is a way to
support Clojure on StackMob? You guys are definitely the closest to what I am
looking for, but I would really like to use a Lisp for my logic. Given that
custom logic is added via a user supplied jar, can the user supply the Clojure
jar in their environment and get "unsupported" Clojure support on StackMob?

~~~
_jrwest
If you are looking to implement your server-side logic in Clojure, our Custom
Code feature does support it as well as Java and Scala. Let us know if you
have any questions: support.stackmob.com

~~~
kls
Thanks for the info, I assumed that the Clojure jar could just be added but I
thought I would clarify, thanks I will check it out.

------
peterwwillis
Well. If you wanted to be really annoying about it you could make a web
service which just gets and sets keys and values according to an authorization
ruleset.

You'd still need _something_ to handle transactions which can not be allowed
to be performed by a user, such as credit card transactions, web service
account-linking authorizations, etc. You could have an app on your iPhone
written in JavaScript that just queries for transactions to process and does
all the heavy lifting, in effect being the "backend" on your phone. But again,
that would be really annoying.

We have frameworks and libraries for a reason: to make writing the monotonous
backend quicker and easier. When you utilize the right tools it shouldn't be
too much work. But yes, you could probably offset a lot of crap on the server
with simple key/value sets sent from the client. Whether or not that's a good
thing i'll leave up to the users to decide.

~~~
kls
_You'd still need something to handle transactions which can not be allowed to
be performed by a user, such as credit card transactions_

This was the issue I had with Parse when looking at it, while I think it is a
great service, we need more than just a data store, there has to be some way
to perform logic behind the REST service, because it is just not an operation
that you can trust the client to do. You may be able to get away with a mobile
device to card authorization but a JavaScript client should not be trusted to
orchestrate it. So for me, with these services that look like a data store
there is a core piece missing and that is the ability to perform business
computation and orchestration that the client should not be responsible for.

~~~
aespinoza
We have that in iKnode. You can create your own logic and access it through
the REST service. You can even upload your own assemblies as well.

You can see the screenshot here:

* Editor: <http://iknode.com/images/tour/appeditor.png>

* Assembly Upload: <http://iknode.com/images/tour/asmupload.png>

You can create your application that becomes a service endpoint and then just
call your logic.

You can call your application using a REST POST like this:

[https://api.iknode.com/Applications/execute/<application...](https://api.iknode.com/Applications/execute/<application_name>/<application_method/)

And in the body just put your parameters:

{ parameters: "{ myParam1: myValue1, myParam2: myValue2 }" }

~~~
kls
Do you support any .NET language or just C#? I am personally looking for
something that can support a lisp, there is a lisp for the .NET VM but I don't
know how active the community is for it.

~~~
aespinoza
Right now we only support C# in the Editor, but assemblies can be implemented
in any language as long as it is CLS Complaint.

We are planning to support IronPython and IronRuby in the future. In the case
of Lisp, we looked at Clojure, which can run on top of the CLR. But we have no
plans for it so far.

------
devs1010
If simple CRUD functionality in a web service is all you need, you are right
that you shouldn't be writing this and you don't need to if you choose the
right rapid application dev framework. I currently do Java dev and even for
the bad rap it gets as far as rapid dev, I have used Spring Roo, which is sort
of a Java-Spring knock off of Ruby on Rails and it can generate JSON web
services for you for your model layer. You can then implement custom
validators, etc but the boilerplate services, etc are all done for you. I
believe other languages have similar frameworks that can do this as well

------
mullr
Depending on your requirements, CouchDB may be useful to you. I'm frankly a
little bit leery about sticking my database straight on the Internet without
something in between to mediate access, but at least in principle CouchDB has
a user authentication mechanism that you can you for your application.

See also the somewhat passé <http://couchapp.org/> (how quickly we tire of
such things)

------
Piskvorrr
"How hard can it be?" is a double-edged red flag - both the spark at the base
of many wonderful inventions, and the most common last words.

Who would own that super-backend-service? Who would own the data submitted? Oh
and btw, single point of failure (see the recent debacle inflicted upon
jotform)?

------
canterburry
Have you asked yourself if you are putting business logic that belongs server
side in your front-end?

