Our SPA
We're currently working in a number of apps which are in the form of a Single Page Application. This article describes the common SPA structure we're using for such projects.
Technology stack
Our system uses NodeJS on the server side with FeathersJS for authentication (using ExpressJS) and real-time bidirectional communications (using SocketIO). We use MongoDB for our no-SQL database layer and Mongoose to integrate it with NodeJS. On the client side we use the VueJS framework for templating and component model with the Vue router and Vuex storage layer.
To manage all our separate source files, assets and dependencies we use NPM (Node package manager) for the server side and WebpackJS (see also this noob intro) on the client side which also integrates more tightly with NodeJS and it's build process.
Application initialisation
When the application starts a number of requests to the server side need to be made for things such as user and localisation details. Before this information has arrived and been used to initialise the environment, the site should show only a loading screen.
This has been done by initialising the Vue router with a default "catch-all" route to the "Loading" router component. The initialisation sequence is then run (using $.when so they can all load asynchronously in parallel), and then the proper routes are switched in on completion and installation of the sequence. This is all done in main.js directly after the instantiation of the main App Vue component since the initialisation sequence depends on the Vuex App.store object.