Well, in many cases it's best to separate back-end from front-end. I use something called Deepstream.io which emphasis on building your back-end as microservices, so I often wound up with ~10-20 repos per project that can be independently deployed via CI, depending on the size of the project this can easily span up to 100's of microservices.
How I manage dependencies depends on the type of project, but often NPM with Webpack. Sometimes I use JSPM with SystemJS, but that requires a build environment like Gulp, while Webpack is like SystemJS combined with Gulp - although a much simpler version of it but at the same time very messy.
The type of application you're building would completely dictate what you need. For example if you're building a completely server-side rendered website where your back-end language or framework takes care of rendering the page, you'll have a much easier time without a front-end package manager at all, but you can of course use something like Bower, NPM or JSPM if you want to - but I find myself having barely any front-end dependencies when building server-side rendered applications as most of that is handled back-end.
On the other hand, if you're building a SPA (Single Page Application) also known as a client-side rendered application you'll want to use something like NPM + Webpack or JSPM + SystemJS + Gulp. This will allow you to easily manage bundles and optimize the output production-ready code with code-splitting and dynamic loading of modules.
Building SPA's are becoming more and more attractive thanks to the new browser features such as Service Workers and the Push API, where you can have native-like push notifications, full offline support, optimized caching and milliseconds loading times (thanks to Service Workers pre-rendering the page).
In this scenario your back-end would be nothing more than an API, normally RESTful JSON structure, easiest to work with and offers most of what you need.
We just started using it and finding the different paths as we went along the project, really. The docs are a bit scarced but if you combine the tutorials (https://deepstream.io/tutorials/getting-started.html) and the docs (https://deepstream.io/docs/deepstream.html) it's fairly easy to get started =)
I have thought about writing a blog entry about Deepstream but haven't gotten around to do it yet =P
Definitely try out Deepstream.io. It's like a self-hosted firebase. They also have an official Polymer library and the elements and behavior included corresponds to those found in polymerfire, albeit with some minor differences.
No no I can tell you lots. I'm making a client for deepstream.io
A .Net client and a JS client have already been made.
I've been looking at the .Net client today and got this to work.
static void Main(string[] args) { DoStuff(); Console.ReadLine(); }
static async Task DoStuff() { var client = new DeepStreamClient("127.0.0.1", 6021); var client2 = new DeepStreamClient("127.0.0.1", 6021); await client.LoginAsync(); await client2.LoginAsync(); await client.Events.Subscribe("test", x => { Console.WriteLine("From client 1 " + x); }); await client2.Events.PublishAsync("test", "random data"); await client2.Events.PublishAsync("test", "more data"); await client2.Events.PublishAsync("test", "some more data"); await client2.Events.PublishAsync("test", "even more data"); await client2.Events.Subscribe("test", x => { Console.WriteLine("From client 2 " + x); }); await client.Events.PublishAsync("test", "new data"); await client.Events.PublishAsync("test", "heaps of data"); }
Which prints out
From client 1 random data From client 2 new data From client 1 more data From client 1 some more data From client 1 even more data From client 2 heaps of data
Which is what I'm wanting.
Is there a way to do this in Python?
I've never worked with Koa before, only Express. But they're web servers in general so they work the same.
Speaking from experience, you shouldn't use Node.js to serve static assets in production. It is fine for development, but when you deploy to production you should completely disable static file serving from Node.js and use something like Nginx.
Nginx is one of the most performant web servers out there, and the reason you should have Nginx serve static assets is because it is much better at handling memory caching of assets that are frequently accessed, has a very fast gzip compression implementation and uses the sendfile(2) syscall.
Personally, I've completely dropped HTTP for building private API's. I use Deepstream which is a WebSocket-based implementation that's built as microservices. It offers real-time data out of the box and is very performant and easy to scale. It might be a bit advanced if you're still learning, but you should definitely check it out once you get further into Node.js.