Basic architecture - All Dart Client Server Web Applications

147 views
Skip to first unread message

Manuel Gilbert Riviere

unread,
Mar 1, 2015, 7:43:01 PM3/1/15
to mi...@dartlang.org
I need to build a bunch of web applications for a company and I'm pretty much starting with a clean slate, which is awesome.
Here is how I would like to build them:

-Dart on the client side
-Dart on the server side
-A websocket connection between the two
-The Server connects to mySQL (required)
-Users authenticate via LDAP (required since from an existing AD)
-I would like to use the standard Dart Editor (to keep it simple)
-The whole thing will be deployed on an Ubuntu server in the company's internal network. 

So far I've put the server and client code in the same project folder in the Dart Editor, the server code in the 'bin' folder and the client code in the 'web' folder. This way I can run/develop it easily on my local machine.
The server looks something like this:

  HttpServer.bind(InternetAddress.ANY_IP_V4, port).then((server) {
    log
.info("Calendar server is running on " "'http://${server.address.address}:$port/'");
   
var router = new Router(server);
    router
.serve('/ws').transform(new WebSocketTransformer()).listen(handleWebSocket).onError((value) => print(value));

There are a few questions I'd like to ask. I'd be happy if someone could point me in the right direction.

1. Does this kind of architecture make sense to you?
2. Since I'm surely not the only one building web apps with these kinds of requirements, where can I find examples of projects with a similar setup?
3. Am I maybe on the wrong track/missing something basic?
4. Is there an alternative way to authenticate users from an existing Active Directory (some easy to use middleware maybe)?
5. Where can I find an example of a Dart client to Dart server SSL encrypted websocket connection?

Lex Berezhny

unread,
Mar 1, 2015, 8:12:12 PM3/1/15
to misc
On Sun, Mar 1, 2015 at 7:45 AM, Manuel Gilbert Riviere <riviere...@gmail.com> wrote:
1. Does this kind of architecture make sense to you?

One project with bin/ for server and web/ for client makes sense. If you are sharing code between client and server put it in lib/ (just keep in mind that you can't share any code that uses either dart:html or dart:io).
 
 
5. Where can I find an example of a Dart client to Dart server SSL encrypted websocket connection?

I run the Dart server part behind Nginx which does the SSL part. I don't think you'd want to do it any differently (especially for production).

 - lex

Thomas Schranz

unread,
Mar 2, 2015, 6:18:22 AM3/2/15
to mi...@dartlang.org
Exciting, please keep us posted Manuel.
We still use Python on the server side at Blossom but I'm really interested in any experiences with a setup like you've outlined.

Joris Hermans

unread,
Mar 2, 2015, 6:44:50 AM3/2/15
to mi...@dartlang.org
You can always look at the 'product hunt' clone I am building as an example for the dart force framework.

It uses code that I need to share between client & server in the lib folder!


It is an example of the dart force framework, a realtime web framework for dart. It also uses websockets under the hood ;-) The data is been stored in a mongodb.

Greg Lowe

unread,
Mar 2, 2015, 4:13:12 PM3/2/15
to mi...@dartlang.org
I usually put my libraries at the top level.

The example has:

web/lib/hunt.dart
web/main.dart:
  import 'lib/hunt.dart';


This is what I usually do:

lib/hunt.dart
web/main.dart:
  import 'package:aproducthunt/hunt.dart'
Reply all
Reply to author
Forward
0 new messages