Page created:
Jun 16, 2009 (? ago)
Last modified ? ago
To main page | Opera Unite HowTo's

Intro: Web Apps with Opera Unite


Maybe you were looking for From PHP to Opera Unite ? (I don't know why Google thinks this is the relevant page and not that one.)

In a nutshell: if you know PHP/MySQL, you're probably already too advanced for Unite (no grinding), but for the rest of people - Unite is a great way to develop Web Applications.

If you ARE advanced user - that won't stop you from creating a simple local helper app, like billing for your customers that only you would use.

If you're too advanced - see "Future" section below, point #3.

If you haven't tried Opera Unite yet - go do it. It's basically a browser with a button "Run a web server on my computer", you push it and instantly your visitors can access whatever you share - music, movies, etc.

Web Apps?

But this won't impress your regular PHP guy. Here's a kicker:

You can write your own Web Applications (think PHP/MySQL) in plain HTML/JavaScript (no more "server-side" languages, like PHP), with the addition of some kind of javascript-read database, like CouchDB - you've got yourself a great technology for prototyping new Web Application.

Writing a blog that will be run from your computer takes 60 lines of JavaScript here (and half of that is HTML output). The API is very simple - you just store whatever data you need in JavaScript variables, Opera keeps them between user requests (unlike PHP, which has "amnesia" by default - each time your visitor loads a page - it forgets all variables, yes, there's $_SESSION, but it's not as convenient as just remembering state between calls). Opera keeps saved state between requests.

Also Opera's JS engine is lightning-fast, so I guess it's JS can easily compete with PHP and without calls to MySQL - it's even faster.

There's a problem of size though. You can't build a Flickr-sized service on your local computer. But, actually, you don't need to. You can prototype/build a service that is "you"-centric. For example - you and millions of other users are using Flickr to show your pictures, so Flickr needs to be huge to handle the load. But when you take those images back from cloud and build a local (but availble from Web) photo-sharing service, you need to serve only a handful of users, therefore the amount of data is not that big and can easily fit into memory. And it it grows - there's an option of growing with local databases that have REST interface.

I still can't believe simple blog can be done in 60 lines of JS code without even having to deal with annoying things like DNS setup, MySQL setup, PHP, nginx configurations, etc - you just download a browser, push a button and write some JavaScript.

If you want to jump start, glance at Basic HowTo.

There is a number of problems though.

Concerns

1. When you close Opera - service is closed. Probably solvable with things like TrayIt.

2. Security. I do really trust Opera with security stuff - they've been more than reliable in that matter, but still, maybe it would make sense to run Opera inside of some controlled environment, like local virtualized VMWare.

3. Performance. Probably not an issue, since you're going to only serve a handful of users. If you need to server more - well, then you need to move to a bigger language, like PHP & MySQL (as a first step). But since there are many services that aren't moving beyond the point of serving <100 visitors a day - Opera Unite seems to be a great way to prototype things withough having to deal with PHP/MySQL/DNS.

4. User-friendly URLs. http://my.login.operaunite.com isn't a great URL to start with, and http://my.login.operaunite.com/test/service is even worse. So I need to figure out how to hide it behind real_domain.com. One way could be to use framed domain, which is a service many registrars offer. (You can't use CNAME's, that's for sure. Maybe some kind of VPS-hosted proxy? maybe nginx?)

Possibly a problem?

5. Persistence. Opera Unite primer doesn't show how to store data after Opera is closed (or after service is stopped), but since they have sandbox filesystem, this should be possible.

Conclusions

Is Opera Unite for everybody? I'd say "no".

Compared to PHP/MySQL (or other server-side languages) it's like Google SketchUp vs 3DSMax - you can create complex models in SketchUp, you can even use it for game modelling, etc, but your regular "professional" will dismiss it as it isn't advanced enough. But SketchUp is highly popular among non-professional 3D modelers, like architects or wood-workers.

Likewise, Unite isn't "advanced", it's simple. It's meant to do simple things, that are browser-owner-centric. I believe it will achieve those goals.

The professional web developers won't use it, but guys, who just want some simple stuff - will. Given the speed of JS engine of Opera - I'd say those "simple" things will be complex enough.

But, no denying it - it's probably a great prototyping tool and maybe even for solving small local tasks (like my own client billing, which is written in Django and works on localhost, probably could be replaced with Opera web app in much-much less code).

Advantages



1. Damn simple - simple counter app is 15 lines of code
2. Has templating library
3. No problems with maintaining your DNS entries
3a. No problems with routers/NATs
4. Zero-configuration (vs httpd.conf & mysql.cnf)
5. Opera with Opera Unite = 7Mb (Google Chrome is 17MB)
6. 2 languages (HTML/JS both client-side and server-side) vs 4 languages (HTML/JS
for client-side, PHP/SQL for server-side)
7. Number of libraries available, even for graphs (incl. charts for output), feed readers , animation, multi-page help and even web scraper . All this can be used "server side" (i.e. on your computer). Seems like no installation required.
8. Your visitor is free to use whatever browser he wants to (no need to install Gears or plugins like AIR).
9. Cross-platform runs on Windows, Unix, and Mac.
10. All your data belongs to you and stored on your computer (as opposed to storing data in the "cloud")
11. Three ways of distributing your app:
- upload it to unite.opera.com (but you can't delete it, if it gets approved)
- just ZIP IT and distribute yourself, user would just drag-and-drop the file
- Serve a zip from your webserver with "Content-Type: application/x-opera-uniteservice; charset=UTF-8" header.

Disadvantages

1. If Opera is closed - web app is unavailable too => need to keep computer on 24/7
2. User-unfriendly URLs

Future

1. If they ever plan to implement this on Opera Mini - it would be the day my phone would start being a web server. Might be stupid, but awfully fun.
2. Cross-platform web server? Opera runs on many platforms, including Mac and Linux.
3. I'm pretty sure somebody would soon develop some kind of real web server for production Linux/FreeBSD use, probably like noss@HN points out V8-based.
So, like Google App Engine you would develop an app on your local computer and then push-button deploy it to production server.

See also

Basic HowTo

Slava V. [about me]


main page



Last updated


  1. Markuper (HTML templates)
  2. .ua
  3. Opera Unite HowTo's
  4. .us (files)
  5. Distribute Your Application
  6. 24/7 sites (permanent applications - idea) [stub]
  7. Issues
  8. HTTP Connections (AJAX/REST)
  9. Cookies
  10. file_wrap.js - File Wrapper
  11. Basic HowTo: Simple app (tutorial)
  12. Static images, client-side scripts
  13. Application Examples
  14. How to Debug Opera Unite apps
  15. Persistence & databases
  16. Opera Unite benchmark
  17. From PHP to Opera Unite
  18. Uniteness (Framework)
  19. Config.xml
  20. Key-value storage
  21. Widget Object
  22. Notifications (Growl'esque)
  23. Reset (debug)
  24. Cron example
  25. What I meant by CNAMEs
  26. Wish List
  27. Device Unavailable
  28. StopLorem (Opera Unite blogging)
  29. uniteness-0.11
  30. GET/POST data
  31. CRUD And Static (example)
  32. Opera object
  33. URLs
  34. Headers & Redirects
  35. Error Console
  36. JSON State (storing data)
  37. Security
  38. /storage/ (in fileio)
  39. Yusef library
  40. unite_info (a-la php_info)
  41. Javascript Imports
  42. onunload / _close
  43. fileio: Sandboxed Filesystem
  44. Request Hierarchy (like php_info)
  45. Intro: Web Apps with Opera Unite