2

I seek your advice on SPA (Single-page application) architecture.

I'm building an SPA which edits a model. The models consists of objects which have a relation to one another. The objects (and relations) are stored in a single a collection on the server's database. The user must authenticate on server and sessions are implemented to track user activities.

For this SPA I have a choice in thick or thin serve architecture.

SPA thin server architecture

  • The complexity of managing inter object relations (model) is done on the client
  • Full data set is exchanged between client and server and there
  • Few interactions between client and server
  • Heartbeat pattern is implemented to keep session alive after authentication

  • Process:
  • User logs in (heartbeat starts)
  • Client fetches all objects from the server database collection
  • Client constructs a data model from the objects (using the relations) and visualizes the model
  • User edits the model and saves the changes
  • On save the client deconstructs the data model
  • All objects are submitted to the server which stores these 1:1 in the database collection
  • SPA thick server architecture

  • The complexity of managing inter object relations (model) is done on the server
  • Small data packages are exchanged between client and server (after initial load)
  • Many interactions between client and server
  • Frequent changes omit the need for heartbeat to keep the session alive
    (though I except the risk of a session will time-out due to prolonged inactivity of the user)

  • Process:
  • User logs in
  • Client fetches all objects from the server database collection
  • Client visualizes the server side model but does not construct a client side data model
  • User edits the visualized model where each change is submitted to the sever
  • Servers logic determines the changes to the model and updates (1 or more) the collection accordingly
  • Which architecture would be favored for my SPA - and why?