This project is part of IroCO2. You are not in the principal repository. For any general information about the project, please refer to the principal repository.
This is the frontend of the IroCO2 application, developed using Nuxt 3 and Vue 3. It provides the user interface and client-side logic for the IroCO2 carbon calculator platform.
- Node.js >= 20.0.0 < 21.0.0
- npm >= 9.0.0 < 11.0.0, or Yarn / pnpm / Bun. All npm commands described below can be executed with
yarn,pnpmorbun)
Clone the repository and install dependencies:
npm install# to check linting problems on the whole project
npm run lint-all
# to check linting problems on a specific folder or file
npm run lint ./path/to/folder/
npm run lint ./path/to/NameOfTheFile.vueReplace lint with lint:fix to automatically fix the problems found on the whole project or the specific folder / file.
To launch tests on the project, use following commands :
# to launch all the tests
npm run test
#to launch only the tests written in NameOfTheComponent.spec.ts file
npm run test NameOfTheComponent
#to launch only the test declared at line 10 of NameOfTheComponent.spec.ts file
npm run test ./path/to/NameOfTheComponent.spec.ts:10To launch the server, a .env file is required at the front-end project root folder (ask an IroCO2 referent on how to document it).
Start the development server at http://localhost:3000:
npm run devnpm run buildPreview the production build locally:
npm run previewcomponents/— Vue components (UI, forms, charts, navigation, etc.)pages/— Application pages (e.g., calculator, catalog, admin, login, help, etc.)service/— Business logic and API service layerspublic/— Static assets (favicon, icons, etc.)assets/— Styles and imageslayouts/— Application layoutsmiddleware/— Middleware logicstores/— Pinia stores (state management)lib/,enum/,type/— Utilities, enums, and typesnuxt.config.ts— Nuxt configurationtailwind.config.js— Tailwind CSS configurationpackage.json— Project dependencies and scripts
The frontend is deployed on AWS Cloudfront. The cloudfront distribution is configured in the terraform repository.
To deploy the frontend, provide the following variables through .env file :
- CLERK_PUBLISHABLE_KEY : See official Clerk documentation
- IROCALC_API_URL : FQDN of the IroCO2 backend API
Run yarn generate to generate the static files.
Connect to your AWS environnement and run the following commands :
export S3_BUCKET_ID=`aws ssm get-parameter --name /IROCO2/PARAMETERS/FRONTEND/CLOUDFRONT_BUCKET_ID --query 'Parameter.Value' --output text --region eu-west-3 --with-decryption`
export CLOUDFRONT_DISTRIBUTION_ID=`aws ssm get-parameter --name /IROCO2/PARAMETERS/FRONTEND/CLOUDFRONT_DISTRIBUTION_ID --query 'Parameter.Value' --output text --region eu-west-3 --with-decryption`
aws s3 sync ${BUILD_FOLDER} s3://${S3_BUCKET_ID}/
aws cloudfront create-invalidation --distribution-id ${CLOUDFRONT_DISTRIBUTION_ID} --paths '/*' Distributed under the Apache 2.0 License. See LICENSE for more information.
See docs/ for technical documentation. (If this folder is empty, refer to the principal repository.)
For ADRs and workflow documentation, see the principal repository and workflows.
See CONTRIBUTING.md