TDC
TDC

Reputation: 1929

Angular2 Data Storage Architecture

I am at the very beginning of a new project for an enterprise client and am considering the fundamental architectural decisions. My experience to date has been in .NET applications, WPF and Flash but this new project has to be web delivered and I intend to use Angular 2 for the client-side application so I have little experience, only common sense and research, to draw upon.

This project will undoubtedly evolve as it grows and although I am comfortable with MS SQL I am aware of how difficult it is to manage as schemas change and tables are adjusted. I like the look of Microsoft Web API to act as a service provider, though it's completely new to me, and perhaps MongoDB for its flexibility but beyond that I am in the dark. This project may move from my own secure server to an Azure location in the near future if that has any bearing.

This project will probably evolve and be used for the next 15 years so I need some stability and not the current 'hot solution'. I recognise that I need to design for change, but I want to try and keep the long term maintenance simple.

Can anyone suggest a good, robust solution which will scale well, where there are plenty of resources to assist in development and where the solution, or the owning company, have a solid track record?

I look forward to hearing your thoughts.

Chris

Upvotes: 0

Views: 491

Answers (1)

Bruno João
Bruno João

Reputation: 5535

About Backend

Using Microsoft Web API or another backend service does not matter for this question. You must choose the one you are confortable writing code and getting things done ASAP. The biggest point here is how you delivery the API data and how you store this data.

About data delivery

I suggest you to use REST API and delivery data in JSON format. Using Angular you can communicate with REST API's easily.

About database

Schema and data loss

Relational and Non relational databases have different targets. One is more flexible in schemas but have less security against data loss and consistency. Another is better in security against data loss but have a static schema. Others are trying to accomplish both, consistency and flexibility.

If your application will be used to save sensitive data, I think is better use SQL. If your application have no sensitive data, you can use NoSQL and enjoy the schema flexibility.

You have a third option using some hibrid db as PostgesSql that also implements NoSQL.

Read and write

SQL have better performance in writing data to DB because you have singleton data that are stored in only one place and used by its relations. But SQL have less performance in reading data because we need to use join to get data from many tables for avoid redundant data and inconsistency.

NoSQL have better performance in reading than writing because we use nested schemas and a document can have its children data inside it so you do not need to read another table (collection) to get nested data. All information is inside the doc even children data. For other hand, writing in NoSQL is slower than in SQL because you have to insert/update data in children tables and in parent document because we use to have more redundant data. Another thing is the consistency because you have to write the same data in more than one table (collection) and that can cause some problem if we forget to update some document.

I hope my point of view can help you find the better solution for your project.

Upvotes: 2

Related Questions