Ask HN: Why am I still writing server-side code?

11 points by adamcharnock ↗ HN
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.

So, why do I still have to write server-side code?

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.

Does this not already exist? If not, why? How hard can it be?

If it doesn't exist, and is possible, lets build it!

24 comments

[ 3.3 ms ] story [ 58.9 ms ] thread
"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)?

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?

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.
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.

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!

Thank you for checking it out. If you have any questions please don't hesitate to contact me.
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.
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.

Having LOTS of fun with StackMob. They are great. Support team is wonderful and documentation is plentiful (usually)
I would love to see a BaaS that have a visual interface and supported a work-flow. Somewhere between a rules engine, a workflow diagram and a object diagram, where scripts (my preference a Lisp, but I don't see why a variety of languages could not be supported) could be inserted into the workflow.

For a good deal of small mobile apps and simple web apps this would be a great tool for modeling simple CRUD workflows. I have several apps that this would be great for where 90% of it is just save and retrieve data where the other 10% need transforms or business logic, hence being able to place small transform scripts in the workflow. Now granted it's not going to scale to an enterprise solution, but there would be a lot of value to being able to stand a back-end up in a few hours by diagramming it out. I think of it as kind of like BPEL for REST services. If it existed I would pay for it, and I can't imagine that I am the only one.

aespinoza, good luck in your endeavors!
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.

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.

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...

And in the body just put your parameters:

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

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.
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.

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)

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 :)

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?
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
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.
Have you asked yourself if you are putting business logic that belongs server side in your front-end?
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