How kishorekanchi/computerstoragesolutions works
Main Components
• Frontend (ComputerStorageSolutionsUI): This folder is dedicated to the Angular application. It contains multiple Angular components, services, assets, and configuration files. Notable directories include:
• /src/app: Encompasses various Angular components such as loginpage, signuppage, nav-bar, productpage, add-productpage, cartpage, orderspage, statistics, etc.
• /src/app/Services: Contains API service interactions, cookie management, and user detail handling.
• Angular-specific configuration and build files (angular.json, package.json, tsconfig.*.json).
• Backend (ComputerStorageSolutionsWebApi): This is the server-side component handling business logic and API endpoints. It includes:
• Controllers: Responsible for the API endpoints (e.g., ProductsController, CartController, LoginController, etc.).
• Models: Represent domain entities like Products, Users, Orders, etc.
• Services: Including token and JWT creation services, which handle security and authentication.
• Middleware: ExceptionHandlingMiddleware for managing errors.
• Program.cs and project configuration files (csproj, appsettings.json) that dictate the API’s startup behavior.
• Database: The Database directory holds the SQL Server files (.mdf, .ldf) along with a SQL script, which implies usage of a local SQL Server or similar RDBMS for data persistence.
Relationships and Interactions
• The Angular frontend communicates with the ASP.NET Web API using HTTP requests. The API endpoints exposed by various controllers respond to these requests.
• Services within the Angular application (e.g., api-service.service.ts) encapsulate the communication details with the backend, handling tasks such as user authentication (likely using jwt-decode) and data fetching.
• The backend controllers perform CRUD operations on the database, interacting with Models that represent data structures stored in the SQL database.
• Security and authentication are implemented using JWT (with services like JwtCreationService and TokenService) ensuring secure data exchange.
Architectural Patterns and Design Principles
• Separation of Concerns: Clearly delineating the frontend (UI and client-side logic) from the backend (API, business logic, data access), upholding modularity.
• MVC (Model-View-Controller) Pattern on the backend: Controllers handle HTTP requests, Models represent data, and the service layer processes business logic.
• RESTful API principles: The backend controllers are structured to act as REST APIs.
• Service abstraction on the frontend: Angular services abstract away API calls from the component logic.
• Error Handling Middleware: A centralized approach to capture and handle exceptions across the web API.