Code Monkey home page Code Monkey logo

electricityconsumption's Introduction

Deployed links

Web Application

The frontend application is a Single Page Application built using Angular. It is calling the deployed REST API to get the electricity usage information. It is following the structure of presentational components, containers and views. A service is used to get the data from the API.

REST API

API application is built using .NET 6 and follows the guidelines of the Clean Architecture pattern.

ElectricityConsumption.API project has the controllers, validators for the API requests and the health check service. It also has an Error Controller as a global error handler. Fluent Validation library is used to validate the incoming requests.

In the ElectricityConsumption.API.Core project, the shared services are implemented. For example, Protos and the service used to fetch data from the GRCP server. This project is acting as a client to get data from the GRCP server. The GRCP client is injected using dependency injection and client factory instead of creating a new client on the spot. It is using OpenAPI to document its API endpoints and the Logger to log information to Application Insights.

ElectricityConsumption.API.Infrastructure project act as the point to call the external GRC service and is registering the GRCP client and the handler to be used in the Core project.

  • Grpc.Net.Client and Grpc.Net.ClientFactory libraries are used to implement the GRCP client.
  • Fluent Validation to validate requests.

GRCP Server

ElectricityConsumption.Server is the GRCP server. It implements the GRCP server in the Proto file.

ElectricityConsumption.Server.Core is the business logic project and implements the shared Proto file and the service interfaces. Since the implementation follows the repository pattern, it also has the interfaces for the repositories.

ElectricityConsumption.Server.Infrastructure project implements the infrastructure used by the project. It is using an SQLite database to store the data and is managed as code using EF Core. All the requests are paginated to improve the performance.

Since the initial data is provided using a CSV file, in the project startup, that CSV file is read and its content seeded into the SQLite database using the database Configuration service.

  • gRPC for .NET library is used to implement the GRPC server.
  • EF Core and SQLite libraries are used to implement the database infrastructure.

Docker

docker-compose up will build and run the application containers locally.

Docker compose links.

Future Considerations

Core libraries can be implemented as a nuget package and used in both projects without repeating the files.

electricityconsumption's People

Contributors

dishanrajapaksha avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.