State manager for mobile and web applications