I started playing with Meteor – a Node.js and MongoDB framework – last week as a toy app to help some friends, and it is actually really nice. I don’t know yet how serious it is – I’ve only got maybe five hours playing with it – but one thing it has over almost every other framework I’ve played with lately: a trivial way to handle account and user management.
meteor add accounts-ui accounts-password alanning:roles
… and done. To provide a login component, you add an invocation to your HTML template:
{{> loginButtons}}
Role management isn’t quite as trivial; you have to set up the roles for the users, but checking for roles is pretty easy too:
{{#if currentUser}}
You're logged in.
{{#if isInRole 'admin' 'default-group'}}
You're in the admin group.
{{/if}}
{{else}}
You're not logged in.
{{/if}}
Considering that this is one of the first things an application needs to set up, I have no idea why no other framework I’ve looked at has anything quite so trivial – or if it does, why it’s so hard to find. I’ve looked at multiple languages – Python, Ruby, Java – and multiple frameworks for most of those languages, and Meteor has them all beaten, hands down.
So for the first time I’m actually looking at using Javascript – via Node – seriously as a development platform for myself. It’s … interesting; my thought that Javascript just isn’t that great remains, and the Meteor interface to Mongo is actually quite constrained, but I think I can manage that.
The account management isn’t perfect – but it is good enough that you can actually get started with it, and focus on your app, while using what you need from the users collection.
In fact, some of the things about it are confusing – for example, account names seem to be populated (by registration) inconsistently – but these are problems that are probably caused by my lack of experience, rather than actual issues with the mechanisms themselves.
Well played, Node. Well played.
I’ve been trying (unsuccessfully) to keep code separate for account management (as a sort of project bootstrap). This looks good, although node and js aren’t _my_ favorite platforms either.
I’d be interested in seeing what you use as a project bootstrap – it seems the sort of thing that should be *incredibly* common and very much standardized, but it isn’t as far as I could tell.
Node is actually pretty nice, but the Javascript part takes some getting used to.