Giter VIP home page Giter VIP logo

fusion-app-ipad's Introduction

iPad Service

Fusion app for iPad orders, returns and service.

Frontend Backend Codacy Badge Cypress

Deployments

We have 3 different environments deployed, CI, QA and Prod. The CI environment corresponds to the main branch, while QA and Prod have their respective branches. Promotions to the different branches are done through pull-requests. The application is deployed to Radix.

Environment Deployment Status
CI Frontend
Backend
CI
QA Frontend
Backend
QA
Prod Frontend
Backend
Prod

Frontend

The frontend is built using Typescript and React, and was created using the fusion-cli. Components from the Equinor Design System (EDS) and Fusion components are used.

To run the frontend locally, you need to explicitly provide an API_URL and AD_CLIENT_ID variable. This can be done by either setting an environment variable or creating an .env file in frontend. An example file .env.example is provided. You can then run

cd frontend
npm install
npm start

and navigate to localhost:3000.

Formatting

We use Prettier to format our frontend code in js, ts, tsx and css. To check the format of the files run

cd frontend
npm run prettier_check

and to fix the formatting of said files run

cd frontend
npm run prettier_write

Backend

The backend is built using .NET 6.0.

Swagger documentation for the backend can be found here.

The common environment variables are stored in the appsettings.json file. When running locally, the environment variables from appsettings.Development.json are used.
When running as a radix deployment, the environment variables that are not common to all environments (CI, QA and Prod) are stored in Radix as described here and here.

To start the backend locally, you need to provide some environment variables. One way to do this is to add a appsettings.Development.json file, which you can make from the appsettings.Development.json.example file.
In the appsettings.Development.json, fill in the missing values. The client secret is the only secret needed to run locally because it is needed for the connection to the Azure KeyVault. This can be provided either through the ASP.NET Secret Manager or in the appsettings.Development.json file.

All other environment variables and secrets are stored in the Azure KeyVault.

You can then run

cd backend/api
dotnet run

The default URL is set to localhost:5000.

Formatting

We use dotnet format to format and verify code style in backend based on the C# coding conventions.

Dotnet format is included in the .NET6 SDK.

To check the formating, run

cd backend
dotnet format --severity info --verbosity diagnostic --verify-no-changes

and to fix the formatting run

cd backend
dotnet format --severity info --verbosity diagnostic

Database

The backend is connected to a SQL database hosted in Azure in the Fusion "Database cluster". We are using Entity Framework Core to manage the database from our code.

Migrations

Updates to the database structure are done in Github Actions.

When a pull request contains changes in the backend/api/Database/Migrations folder, a workflow is triggered to notify that the pull request has database changes. After the approval process, a user can then trigger the database changes by commenting /UpdateDatabase on the pull request. This will trigger another workflow which updates the database with the new changes.

By doing migrations this way, we ensure that the commands themselves are scripted, and that the database changes become part of the review process of a pull request.

Docker

To run the project using Docker, you need to provide the ClientSecret as an environment variable to the image.
This can be done by adding a ".env-file" outside the directory and referencing it using the --env-file flag.
From the repository root, you can then run docker-compose --env-file <path-to-env-file> up --build. This will build and run a docker container for both the frontend and backend.
The --env-file flag must come before the up command.

Testing

Cypress is used as a E2E test framework. To run Cypress tests locally, run docker-compose -f docker-compose.cypress.yml up --build.

Additionally, Jest is used to test the frontend code. To run all Jest tests, run

cd frontend
npm run test

xUnit is used for unit testing the backend code. To run all xUnit tests, run

cd backend
dotnet test

Monitoring

We use Azure Application Insights to monitor the backend of our application.

We have one application insight instance for each environment, each in their respective resource group in Azure.
The connection strings for the AI instances are stored in the keyvault.

fusion-app-ipad's People

Contributors

godvenn avatar vegardoztan avatar maiaht 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.