Ams design architecture - gpdoud/ams-client GitHub Wiki
AMS Architecture
This page details the architecture of the AMS application.
Architecture
The AMS is a three-tier, full-stack, SPA web application. The three tiers are called the front-end, back-end, and data store.
Front-end
The front-end is the user interface written in Angular 5 and Typescript. It is a single-page application (SPA) meaning there is only a single HTML file. The HTML file is named index.html. All the various functions of the application are 'injected' into the HTML file based on the contents of the URL called the 'route'. The user interface is created and managed by Angular components which are self-contained code that includes the HTML and CSS needed to render a part of the page.
Virtually all the processing occurs in the browser except for interacting with the data. The Angular components interact with the back-end tier through 'services' which can be shared among components. There is a service for each major type of data. The service makes AJAX calls to the back-end server to retrieve and maintain data.
Back-end
The back-end is the heart of the architecture as it must communicate with both the front-end (via JSON) and the data store (via SQL).
The back-end is written in Microsoft C#.Net, EntityFramework, MVC, and WebAPI. Each data entity in AMS has a model (for the data layout) and a controller (providing methods on that data). Each of the api controllers has a minimum set of methods.
- Get an array of all the data
- Get a single data item by primary key
- Add a new item
- Change an existing item
- Delete an existing item
These and any other methods are invoked based on routing which is defined in the project.
Within each method, EntityFramework is used to manage the data. EF makes it easy to interact with the data store and reduces the amount of code needed to, for example, retrieve subsets of data and sort it. All data received and returned from methods is JSON.
Data Store
The data store tier is SQL Server 2017 at this time. Though SQL Server 2017 Express is used, any version will work.
The database name is AMS and currently contains the following tables:
- User - Provides authentication and privileges
- Asset - Common properties of all assets
- Locations - Defines geographic addresses where assets may reside
- ServiceCategories - Different types of services performed on assets
- ServiceHistories - Collection of services performed on an asset
- MigrationHistory - Used for database maintnance by EntityFramework (dev support only)