I recently started writing a path-finding algorithm simulation application in python.

It takes user inputs, randomly generates a 2d graph, and shows displays the simulation via GUI.

Now, what I found was that Python, and stand-alone applications aren't very appropriate for sharing this kind of application, as you need to get people to run it on their own computer etc. It would be much more convienient to simply direct them to a website.

Obviously the display and control elements need to be written on the client side.

But the actual path finding algorithm could be written on either the client or server side.

Now, given that there's no need for a server side backend (ie. no database), it would be possible to do the entire webapp in client side HTML/JavaScript.

The question is, is there a good reason not to do this?

The way I see it, doing it client-side only would greatly reduce the complexity, because there's no need to handle on going interaction between the client and the server. The only thing the server is for, is to initially serve up the Javascript to the client.

On the other hand... I'd have to write the entire thing in Javascript...

Also, the idea of having a reusable model module appeals to me. Eg. If I want to later have a standalone application, I'd just need to write the View/Control modules.

I'm wondering what generally the accepted practise would be here.

  • 2
    The generally accepted practice is to take the approach that best meets your software's functional and non-functional requirements. For example, if you don't need server-side data or computations, and the entire thing can be held in the browser, then not only do you get availability of a platform that's already installed on everyone's machine (the browser), but you also get cross-platform support for free. In other news, why don't you like Javascript? Apr 26, 2015 at 1:10
  • Python-to-JavaScript convertors are available, which might help with the bulk of the translation work. Apr 26, 2015 at 13:01
  • Validation should also happen server side, especially for client-facing sites otherwise there is a risk it could be bypassed.
    – garryp
    Apr 27, 2015 at 7:46
  • Is there any reason that you might not want to let just anyone run the app? If so, you need to authenticate them at a server, so it can't be 100% client-side (but still mostly so) Apr 28, 2015 at 8:48
  • I've built a web app like this and I am really happy with the results. Mind you, my web app relied on a REST API provided by a third party server. I too wonder why more web apps aren't built this way.
    – leif81
    Apr 17, 2018 at 17:21

1 Answer 1


You've outlined the pros of doing the app client side only. Here are some possible cons - if any or all of them apply, consider shifting to a server based solution:

  • Performance. Would a client based solution be noticeably slower than a server-based one (including traffic)? Javascript is fast nowadays, but a computationally expensive algorithm might require dedicated server-side hardware or HPC farms.
  • Productivity. If you're a Python dev with no JS background, the time required to learn a new language and its idioms might be prohibitive, or at least longer than implementing client/server logic. Additionally, there may be useful Python libraries you could use which are unavailable for JS, which would increase development time considerably.
  • Intellectual Property. If this algorithm is something you wish to protect, having the code available on client machines could be a problem.
  • Compatibility. More browser-based code means more browser compatibility issues. This is much easier these days, but could still be a concern, depending on your intended audience and reach.

In short, client-side Javascript is a perfectly viable platform for algorithmic computing, and can easily be deployed both to a browser and as a standalone app (using a browser engine like Awesomium), but it does have its caveats. Go over them to make an informed choice.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.