I don't see a problem with compiling an OGL app to javascript. Games are soft real time, it's not like a GC hitch will kill someone. So that really depends on the complexity of your game.
For the database thing I managed to cook up a primitive ORMish thing in a weekend (it works kinda like SqlAlchemy's core module). What I did was made an untyped macro that would parse a statement such as: select(col: seq[string], another: int) from table_name and generate a real sql query and the appropriate tuple type to return.