GreenForce
National energy transmission system operator data hub developing to support change toward decarbonised economies.
https://github.com/Energinet-DataHub/greenforce-frontend
Category: Energy Systems
Sub Category: Grid Management and Microgrid
Keywords
angular dotnet energy energy-origin green-energy-hub monorepo nx typescript
Keywords from Contributors
observation geocoder annotation optimize measur virtual compose animals transforms archiving
Last synced: about 17 hours ago
JSON representation
Repository metadata
GreenForce monorepo for the DataHub and Energy Origin frontends. Part of Energinet DataHub.
- Host: GitHub
- URL: https://github.com/Energinet-DataHub/greenforce-frontend
- Owner: Energinet-DataHub
- License: apache-2.0
- Created: 2021-08-24T13:13:11.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-16T12:26:12.000Z (11 days ago)
- Last Synced: 2025-04-19T03:29:48.885Z (8 days ago)
- Topics: angular, dotnet, energy, energy-origin, green-energy-hub, monorepo, nx, typescript
- Language: TypeScript
- Homepage:
- Size: 1.07 GB
- Stars: 75
- Watchers: 19
- Forks: 16
- Open Issues: 193
- Releases: 3,023
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
README.md
GreenForce
Monorepo for the DataHub and
Energy Origin
frontends backed by Nx and Angular.
Table of Contents
- General
- Prerequisites
- DataHub
- Energy Origin
- Watt Design System
- Workspace
- Scripts
- Workflows (CI/CD)
- Visual Studio Code
- Domain C4 model
General
The documentation in this README assumes the reader has a general understanding
of Nx and Angular. For beginners in these technologies, the
Core Nx Tutorial and
Angular Tour of Heroes serves as a good
introduction.
This repository is a monorepo which hosts serveral applications that all share
the same dependencies (for example, every application is running the same
version of Angular).
Note: Since this is an Nx workspace, the Nx CLI should be used
over the Angular CLI.
Prerequisites
- Volta: Manager for JavaScript command-line tools like Node.js®, Yarn and Bun.
- Bun: Alternative to Node.js® and Yarn that this repository use. Can also be installed with Volta.
- .NET SDK: Required for running and developing DataHub.
DataHub
The application is deployed to the following environments:
Development 001 | Development 002 | Test 001 | Test 002 | PreProd | Prod |
---|---|---|---|---|---|
dev_001 | dev_002 | test_001 | test_002 | preprod | prod |
Documentation
Be sure to check out the additional DataHub documentation for the following
areas:
Getting Started
Before starting the development server, you must install localhost.crt
in your list of locally trusted roots.
Run the following command as an administrator from the root of the repository (Windows):
certutil -addstore -f "Root" localhost.crt
Use the following command to serve the DataHub application locally (with request mocking):
bun dh:mock
The application utilizes request mocking for some of the requests to the
backend for frontend (BFF), but there are still
features that are not mocked. When working with those features, it might be
required to serve the BFF locally as well. To do so, run the following command
(requires some initial setup, see
Setup of BFF).
bun api:dev
Note: It is recommended to use mocking as much as possible, see
mocking.md.
Development
When it is time to add a new library, refrain from writing files manually or
copying from existing libraries. Instead, use the provided local generators
that takes care of all the manual work and avoids common pitfalls.
Note: Make sure to read the Workspace section beforehand to understand
which library type to generate. It is currently not possible to generate
libraries of type assets
and styles
.
To generate a new library, run the below command* and follow the instructions:
bun nx g @energinet-datahub/tools/workspace:library
While rarely needed, it is also possible to generate an entirely new domain.
Running the following command* will create a new domain with
data-access-api
, feature
, and shell
libraries included:
bun nx g @energinet-datahub/tools/workspace:domain
Also available in Nx Console.
Best Practices$$
Take a look at our dev examples to see how to implement certain features like, and an overall best practice guide:
Backend For Frontend (BFF)
There is currenly only one BFF located in api-dh
under apps/dh
.
It is for app-dh
and is using .NET 8.x.
Check the Development notes
for how to get started.
Configuration
Configuration files are located in the libs/dh/shared/assets/src/assets/configuration
folder. These local configurations have a .local
filename suffix, but is
overridable by a configuration file without the suffix. For example,
dh-api-environment.local.json
configures the DataHub frontend to use a local
DataHub API. To use a remote DataHub API, place a dh-api-environment.json
file
in the same folder and set the remote address in the relevant property.
Energy Origin
Use the following command to serve the Energy Origin application locally (with request mocking):
bun eo:mock
Watt Design System
Contributing? Check the Watt Design System README
for developer documentation.
This is a shared UI library meant to be used by all frontend apps and it
contains basic components and functionality for speeding up app development.
It is located in libs/watt
and can be imported from
@energinet-datahub/watt
in other libraries.
The design system is showcased using Storybook,
and can be found here: Latest version (main)
To use components or other functionality from Watt, import as in the following
example:
import { WattButtonComponent } from '@energinet-datahub/watt/button';
Workspace
The structure of the monorepo is based on general conventions from
Nx with a few extensions. On the highest level the
workspace is separated into apps and libs, with most of the logic
placed within the libs folder. The apps should mostly be slim
containers that links to functionality implemented in libraries.
On the top level, the workspace is divided into the following folders:
Energinet-DataHub/greenforce-frontend
├── apps # Source code for applications
├── build # Infrastructure related to deployment
├── dist # Output files when building artifacts
├── docs # General documentation
├── libs # Source code for libraries
├── scripts # Code needed for running certain commands
└── tools # Logic for executing or generating code
Applications
Within the apps folders resides the applications, which includes frontends,
BFF and E2E tests. These applications are prefixed with their type and further
grouped by a product root folder. Expanding the apps folder looks like this:
...
└── apps # Source code for applications
├── dh # DataHub application (product root)
│ ├── api-dh # - BFF for DataHub
│ ├── app-dh # - Frontend for DataHub
│ └── e2e-dh # - E2E tests for DataHub
└── eo # Energy Origin (product root)
├── app-eo # - Frontend for Energy Origin
└── e2e-eo # - E2E tests for Energy Origin
In other words, all applications must follow the naming scheme
apps/<product>/<type>-<product>
.
Below is an exhaustive list of permitted application types, along with their
intended purpose, folder name and which library types they are
allowed to have direct dependendies to:
Type | Description | Name | Allowed Dependencies |
---|---|---|---|
api |
Serves as BFF for the product | api‑<product> |
- |
app |
Entry point for the frontend | app‑<product> |
shell environments assets styles |
e2e |
Runs E2E tests on the frontend | e2e‑<product> |
e2e-util |
Libraries
As mentioned above, libraries are where most of the logic goes. They are all
either related to a single product or shared across multiple products*.
There are many different library types which are listed further below, but they
all follow the same naming convention:
The special
gf
product can be used for libraries that must be shared
across multiple products.
...
└── libs # Source code for libraries
└── <product> # Libraries are grouped by a product root folder
└── <domain> # Products can contain several domains ex. auth, core, etc.
└── <library type>-<library name> # Domains can contain several libraries prefixed by type
└── watt # Special product, see "Watt Design System" section
Note: Certain library types should not have a name; in that case simply omit
the -<library name>
suffix.
Following is an exhaustive list of permitted library types, what they should
contain, their name and which other library* types they are allowed to
depend on:
Only
libraries of typedata-access
may have dependencies to apps and only apps of type
api
.
Library types
Type | Contains | Name | Allowed Dependencies |
---|---|---|---|
feature |
Smart UI (with access to data sources) for specific business use cases or pages in an application. | feature‑<name> |
assets configuration feature ui data‑access domain util test‑util environments |
ui |
Presentational logic (presentational components, pipes, presentational services, directives). | ui‑<name> |
ui util test-util domain assets styles environments |
data‑access |
Code for interacting with a back-end system. It also includes all the code related to state management, and HTTP interceptors. | data‑access‑<name> |
data-access util test-util domain environments |
util |
Low-level utilities used by many libraries and applications (services, pure functions, contants). | util‑<name> |
util test-util environments domain |
test‑util |
Stubs, jest matchers, testing modules and test library configuration. | test‑util‑<name> |
data-access util test-util domain configuration assets |
e2e‑util |
Cypress commands and fixtures. | e2e‑util‑<name> |
util test-util e2e-util |
domain |
Interfaces, types, constants, functions and services related to domain objects. | domain |
domain util test-util |
shell |
Entrypoint for an application or domain. Orchestration and routing. | shell |
feature ui data-access util test-util e2e-util shell domain configuration environments assets styles |
configuration |
Configuration and setup of libraries and concerns (for example i18n). | configuration‑<name> |
data-access util test-util configuration environments domain |
environments |
Code related to loading different environment configurations. | environments |
util test-util environments assets |
assets |
Icons, images, fonts, JSON etc. | assets |
assets |
styles |
SCSS functions, mixins, variables, partials, and global stylesheets. | styles |
assets styles |
Tools
This folder contains code only meant for use during development or within
workflows. Expanding it looks like this:
...
└── tools/src
├── executors # Perform all sorts of actions on your code
├── generators # Automate tasks using code generation
└── <helpers> # Various other helper tools e.g. for scripting
Executors and generators are Nx inventions; for
documentation on how to work with them, see
Use Task Executors and
Use Code Generators.
Scripts
bun dep-graph
: Generate a dependency graph for the applications in the monorepo.
Workflows (CI/CD)
The repository is using GitHub Actions workflows
for automation including CI/CD pipelines for each application.
Workflows are located in .github/workflows
which currently contains the following:
ci-orchestrator.yml
- Markdown check and YAML validation, detects changes to start relevant workflows and branch policy status check.create-tokens.yml
- Generates design tokens based on a JSON file exported from Figma.detect-changes.yml
- Figures out what part of the codebase is affected by a change.dh-cd.yml
: Used by DataHub for updating BFF code coverage, publishing a release, dispatching a deployment request, and dispatching a notification on failure.dh-ci-dotnet.yml
- Verifies the ASP.NET Core Web API by building and running all tests. Used inci-orchestrator.yml
for verifying if PR merge is allowed.dh-ci-frontend.yml
- Used by DataHub frontend for publishing a release and generating API clients. Used inci-orchestrator.yml
for verifying if PR merge is allowed.dh-healthchecks.yml
- Runs E2E health check tests every hour against all DataHub environments.eo-cd.yml
- Used by "Energy Origin" app.frontend-ci.yml
- Used to build, format and lint all frontend apps. Also used for running unit, integration, component and E2E tests.license-check-ci.yml
- Used to check for license headers in files and adding them if missing.production-dependencies-license-check.yml
- Used for documenting used versions and licenses of production dependencies.watt-cd.yml
- Used for publishing Watt to Chromatic and dispatching a notification on failure.watt-ci.yml
- Used by Watt for verifying a production build can be created. Used inci-orchestrator.yml
for verifying if PR merge is allowed.
Bots are used for certain trivial tasks such as adding license headers to files,
formatting code, fixing lint errors, and generating API clients based on OpenAPI.
For this to work, bots have to use the repository secret PAT_TOKEN
when pushing
changes or creating releases that trigger a workflow. Only do this for idempotent
tasks to prevent circular workflows from causing infinite workflow runs.
Visual Studio Code
It is recommended to use the Visual Studio Code
editor, as it supports the entire toolchain of this repository and has
been preconfigured with a list of recommended extensions stored in
.vscode/extensions.json
. The editor will automatically prompt for installing
these extensions when the project is opened for the first time, but they can
later be found by executing the Show recommended extensions
command.
Domain C4 model
In the DataHub 3 project we use the C4 model to document the high-level software design.
The domain C4 model and views are located in c4-arch-diagrams repository.
Thanks to all the people who already contributed
Owner metadata
- Name: Energinet-GreenForce
- Login: Energinet-DataHub
- Email: [email protected]
- Kind: organization
- Description: National energy transmission system operator data hub developing to support change toward decarbonised economies
- Website: https://energinet.dk/
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/71637070?v=4
- Repositories: 25
- Last ynced at: 2023-03-03T19:30:49.974Z
- Profile URL: https://github.com/Energinet-DataHub
GitHub Events
Total
- Create event: 3205
- Issues event: 137
- Release event: 2964
- Watch event: 4
- Delete event: 2527
- Issue comment event: 591
- Push event: 2368
- Pull request review comment event: 567
- Pull request review event: 1200
- Pull request event: 980
- Fork event: 2
Last Year
- Create event: 3205
- Issues event: 137
- Release event: 2964
- Watch event: 4
- Delete event: 2527
- Issue comment event: 591
- Push event: 2368
- Pull request review comment event: 567
- Pull request review event: 1200
- Pull request event: 980
- Fork event: 2
Committers metadata
Last synced: 7 days ago
Total Commits: 3,507
Total Committers: 74
Avg Commits per committer: 47.392
Development Distribution Score (DDS): 0.79
Commits in past year: 1,131
Committers in past year: 34
Avg Commits per committer in past year: 33.265
Development Distribution Score (DDS) in past year: 0.753
Name | Commits | |
---|---|---|
Dzhavat Ushev | d****u@e****k | 735 |
Morten Vestergaard Hansen | m****o@m****m | 496 |
frontend-specialisten | a****r@f****k | 380 |
Bjørn Hoffmann | M****M | 257 |
Alex | 7****i | 171 |
Michael | 5****d | 156 |
Mads Heimdal Thy | m****s@h****k | 131 |
Jesper Justesen | 1****s | 130 |
Dzhavat Ushev | x****s@e****k | 113 |
github-actions[bot] | g****] | 80 |
Vitalie Belinschi | X****E@e****k | 72 |
Dan Stenrøjl | 5****l | 70 |
Karsten M | x****k@g****m | 68 |
Lars Gyrup Brink Nielsen | l****n@g****m | 48 |
Jonas Michelsen | 3****i | 43 |
Mads Magnus Due | m****e@h****m | 42 |
Jeppe Langhoff Sørensen | j****f@g****m | 40 |
Mathias Sejrup Plougmann | m****p@e****k | 39 |
René T. Nielsen | r****v@g****m | 33 |
Thomas Bach Andersen | x****n@e****k | 31 |
PernilleChristiansen | 1****n | 28 |
Morten Kjærgård | 3****e | 25 |
Ebbe Knudsen | x****n@e****k | 22 |
Patrick Brockmann | p****k@e****k | 18 |
dependabot[bot] | 4****] | 17 |
djorgensendk | 3****k | 17 |
Klemmensen | j****0@h****m | 16 |
RasmusGraabaek | r****k@h****m | 15 |
Lasse Ringgren Nielsen | s****h@g****m | 14 |
Jakob Jensen | j****j@j****k | 13 |
and 44 more... |
Committer domains:
- energinet.dk: 14
- abpconsulting.dk: 1
- topswagcode.com: 1
- jakobk.dk: 1
- it-minds.dk: 1
- mjolner.dk: 1
- kbeconsult.dk: 1
- scoding.dk: 1
- dchr.dk: 1
- jakobj.dk: 1
- heimdal-thy.dk: 1
- frontend-specialisten.dk: 1
- mimo-design.com: 1
Issue and Pull Request metadata
Last synced: 1 day ago
Total issues: 477
Total pull requests: 1,754
Average time to close issues: 6 months
Average time to close pull requests: 3 days
Total issue authors: 10
Total pull request authors: 51
Average comments per issue: 0.07
Average comments per pull request: 1.48
Merged pull request: 1,569
Bot issues: 0
Bot pull requests: 14
Past year issues: 366
Past year pull requests: 1,167
Past year average time to close issues: 4 months
Past year average time to close pull requests: 1 day
Past year issue authors: 6
Past year pull request authors: 32
Past year average comments per issue: 0.02
Past year average comments per pull request: 1.17
Past year merged pull request: 1,056
Past year bot issues: 0
Past year bot pull requests: 5
Top Issue Authors
- mimse (364)
- frontend-specialisten (38)
- dzhavat (20)
- ManBearTM (17)
- PernilleChristiansen (16)
- renehossle (8)
- mknic (6)
- PSkarregaard (3)
- ELH-Energinet (3)
- stephaniegitha (2)
Top Pull Request Authors
- dzhavat (452)
- mimse (380)
- ManBearTM (198)
- frontend-specialisten (176)
- defectiveAi (94)
- FirestarJes (76)
- michaelmajgaard (71)
- sahma19 (31)
- Sejruppen (27)
- vbelinschi (23)
- dstenroejl (21)
- PernilleChristiansen (18)
- ebbeknudsen (16)
- NicolajAaH (15)
- RSIEnerginet (14)
Top Issue Labels
- Frontend (444)
- Signals (292)
- 🏗️ Platform (29)
- ⚡ Watt (27)
- Priority - Medium (25)
- Raccoons (21)
- UX (20)
- 🐞 Bug (15)
- Priority - Low (14)
- Priority - High (9)
- Team Titans (8)
- Team Mandalorian (8)
- 💀💀 Moderate Effort (8)
- Blocked (3)
- FEG (3)
- 💀 Low Effort (3)
- Team Mosaic (2)
- User Story (2)
- 💀💀💀 High Effort (2)
Top Pull Request Labels
- cla-signed (543)
- Raccoons (51)
- Dependencies (14)
- JavaScript (14)
- 🐞 Bug (5)
- 🏗️ Platform (4)
- :warning: do not merge (3)
- Frontend (2)
- ⚡ Watt (1)
- EnergyOrigin (1)
Dependencies
- affected.mjs node16 javascript
- Energinet-DataHub/.github/.github/actions/find-related-pr-number v9 composite
- peter-evans/repository-dispatch v2 composite
- ./.github/actions/affected * composite
- ./.github/actions/setup-postinstall * composite
- Energinet-DataHub/energy-origin/.github/actions/build-and-push-container main composite
- Energinet-DataHub/energy-origin/.github/actions/chart-info main composite
- Energinet-DataHub/energy-origin/.github/actions/get-semver main composite
- Energinet-DataHub/energy-origin/.github/actions/helm-release-bundle-chart main composite
- Energinet-DataHub/energy-origin/.github/actions/update-base-environment main composite
- Energinet-DataHub/energy-origin/.github/actions/yaml-check-incremented-version main composite
- SonarSource/sonarcloud-github-action master composite
- actions/checkout v3 composite
- actions/setup-node v3 composite
- actions/upload-artifact v2 composite
- ./.github/actions/setup-postinstall * composite
- SonarSource/sonarcloud-github-action v1.6 composite
- actions/checkout v3 composite
- actions/setup-node v3 composite
- actions/checkout v3 composite
- actions/setup-node v3 composite
- kt3k/license_checker v1.0.3 composite
- ./.github/actions/dependencies-have-changed * composite
- ./.github/actions/update-production-dependencies-list * composite
- actions/cache v3 composite
- actions/checkout v3 composite
- actions/setup-node v3 composite
- actions/checkout v3 composite
- actions/setup-node v3 composite
- chromaui/action v1 composite
- ./.github/actions/setup-postinstall * composite
- actions/checkout v3 composite
- actions/setup-node v3 composite
- Energinet-DataHub/energy-origin/.github/actions/yaml-get main composite
- WyriHaximus/github-action-next-semvers v1 composite
- actions/checkout v3 composite
- fjogeleit/yaml-update-action d98ee6a10a971effea75480e3f315e4dacc89a23 composite
- rubenesp87/semver-validation-action 0.1.0 composite
- actions/cache v3 composite
- actions/checkout v3 composite
- actions/checkout v3 composite
- github/codeql-action/analyze v2 composite
- github/codeql-action/autobuild v2 composite
- github/codeql-action/init v2 composite
- actions/checkout v3 composite
- actions/setup-node v3 composite
- stefanzweifel/git-auto-commit-action v4 composite
- ./.github/actions/affected * composite
- ./.github/actions/yarn-nm-install * composite
- actions/checkout v3 composite
- actions/setup-node v3 composite
- dorny/paths-filter v2 composite
- ./.github/actions/yarn-nm-install * composite
- actions/checkout v3 composite
- actions/setup-node v3 composite
- marvinpinto/action-automatic-releases 6273874b61ebc8c71f1a61b2d98e234cf389b303 composite
- thedoctor0/zip-release master composite
- ./.github/actions/yarn-nm-install * composite
- actions/checkout v3 composite
- actions/setup-node v3 composite
- actions/upload-artifact v3 composite
Score: 9.895052073715027