- TypeScript 54.1%
- Vue 39.9%
- Python 5%
- CSS 0.6%
- HTML 0.4%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .github | ||
| .kiro | ||
| backend | ||
| cypress | ||
| public | ||
| src | ||
| .editorconfig | ||
| .env.prod | ||
| .env.production | ||
| .gitignore | ||
| .oxlintrc.json | ||
| .prettierrc.json | ||
| cypress.config.ts | ||
| env.d.ts | ||
| eslint.config.ts | ||
| index.html | ||
| LICENSE | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.app.json | ||
| tsconfig.cypress-ct.json | ||
| tsconfig.json | ||
| tsconfig.node.json | ||
| vite.config.ts | ||
Solar Roof Application
Description & Purpose
Interactive web application to visualize the solar energy potential of Swiss buildings (roofs and facades). The application allows users to search for any address in Switzerland and instantly see the estimated photovoltaic and solar thermal production potential of the building.
This project is built on behalf of the Swiss Federal Office of Energy (SFOE). The application template is based on drill-frontend (DrillCheck).
Key features
- Interactive map with solar suitability overlay (WMTS from swisstopo)
- Basemap switcher (satellite / grey map)
- Address search with autocomplete via the geo.admin.ch SearchServer API
- Outline highlighting of the selected surfaces
- Zoom buttons (+ / −, stacked) without scale line
- Single selection mode (default) — each click shows the data of one roof or facade surface
- Multiple selection mode — click multiple surfaces to see aggregated totals across your selection
- PV and solar thermal production estimates based on the solar suitability dataset
- Suitability distribution visualization (% of area per class)
- PV feed-in tariff display per municipality via the VESE PvTarif API (Lambda proxy in production)
- GWR address and commune lookup after building identification
- Toggle between roofs and facades (layer selection)
- Summary banner with the overall suitability and the economic potential of the selection
- Multilingual (DE, FR, IT, EN) — switchable via UI or
?lang=xxquery parameter - Responsive design
- FAQ section with links to official resources
Data sources
- Building geometries: swissBUILDINGS3D 3.0 Beta since the 2026 update, 2.0 before (swisstopo)
- Solar irradiation: Satellite-based data 2015–2024 (MeteoSwiss)
- Calculation model: Meteotest AG on behalf of SFOE
- Building register: GWR (Federal Statistical Office)
- PV feed-in tariffs: VESE PvTarif API — tariff data per energy provider and municipality
Backend (VESE Proxy)
A lightweight AWS Lambda function (solar-roof-dev-vese-proxy) acts as a proxy to the VESE PvTarif API. This keeps the API license key server-side and avoids exposing it in the browser. In production the key is stored in AWS Secrets Manager and fetched by the Lambda at runtime (never committed to git, never a plaintext Lambda env var). In development, a Vite middleware plugin proxies /api/pvtarif/* requests locally with the key from .env.local.
Note: Access to the VESE PvTarif API requires a license agreement with VESE. See PvTarif data documentation for details and contact VESE to obtain a license key.
Security — the license key must never reach the browser. The VESE key is injected only server-side: by the Vite dev proxy in development, and by the Lambda in production. Do not read
VITE_VESE_API_KEY(or any secret) from frontend code — anyVITE_*variable referenced insrc/is inlined into the public JavaScript bundle and becomes readable by anyone inspecting the page. Frontend code only ever calls the proxy/Lambda (/api/pvtarif/*in dev, the Lambda URL in prod). A Cypress regression test (cypress/e2e/vese-tarif.cy.ts) asserts that browser tariff requests never carry alicenseKeyand never hit the VESE host directly.
License & Privacy
This repository is under the MIT License.
The application does not collect, store or process any personal data. All API calls are made directly from the user's browser to public Swiss government APIs (geo.admin.ch), except for the VESE tariff requests which pass through a Lambda proxy. No analytics or tracking is implemented.
Installation & Setup
Prerequisites
- Node.js ≥ 20.19.0 or ≥ 22.12.0
- npm
Setup
npm install
Environment variables
Create a .env.local file for development:
VITE_VESE_API_KEY=<your-vese-license-key>
The Lambda proxy URL of each environment is configured in a committed file (it is public): .env.production for dev (the default build) and .env.prod for prod (built with --mode prod):
VITE_PVTARIF_API_URL=https://<api-gateway-id>.execute-api.eu-central-1.amazonaws.com
Usage
# Start development server (hot reload)
npm run dev
# Open http://localhost:5173
# Build for production
npm run build-only
# Preview production build
npm run preview
# Type check
npm run type-check
# Lint (check only, as in CI)
npm run lint-check
# Lint and auto-fix
npm run lint
# End-to-end tests (needs a production build first)
npm run build-only && npm run test:e2e
Tech stack
- Vue 3 + TypeScript
- Vite — build tool (with custom VESE proxy plugin for dev)
- Pinia — state management
- OpenLayers — map rendering
- vue-i18n — internationalization
- Axios — HTTP client
- proj4 — coordinate projections (Swiss LV95 / LV03)
- Cypress — E2E and component testing
- oxlint + ESLint — linting
Known limitations
- Partial building selection: In areas with row houses, a click may only select part of the visible building due to how
building_idis assigned in the source data. (See FAQ in the app) - Missing addresses: Some buildings (non-residential, annexes, agricultural) may not display an address, as the GWR register does not cover all structures. (See FAQ in the app)
Folder Structure
├── src/
│ ├── components/ ← Vue components (Map, SearchBar, InfoPanel, SummaryBanner, ModeToggle, SelectionModeToggle, FAQ, Header, Footer, LanguageSwitcher)
│ ├── composables/ ← Reusable logic (useProjections, useSolarIdentify, usePvTarif)
│ ├── locales/ ← i18n translations (de, fr, it, en)
│ ├── stores/ ← Pinia stores (mapStore, languageStore)
│ ├── types/ ← TypeScript interfaces (solar.ts)
│ ├── views/ ← Page-level components (SonnendachView)
│ ├── assets/ ← CSS, logos
│ └── main.ts ← App entry point
├── backend/ ← Lambda function for VESE API proxy
├── cypress/ ← E2E and component test specs
├── .github/ ← CI/CD workflows, Dependabot config, auto-merge
├── package.json ← Dependencies and scripts
├── vite.config.ts ← Vite configuration + VESE dev proxy plugin
├── cypress.config.ts ← Cypress test configuration
├── tsconfig.json ← TypeScript configuration
└── README.md ← This file
CI/CD
- Lint, Test & Build (
lint-test-build.yml): lint, type-check, build and E2E tests of the frontend. It runs by itself on every pull request, and it is called by the frontend pipeline on every push tomain. It never deploys anything. It does not check the backend. - Check Backend (
check-backend.yml): syntax check and lint (ruff, pinned) of the Lambda code, a few seconds. It runs on every pull request (no path filter), so it can be required, and the backend pipeline runs it first. The frontend pipeline does not run it. It has no tests (the Lambda has none yet) and no AWS access. - Package and Deploy Frontend (
package-and-deploy-frontend.yml): automatic on every push tomain(this includes merged Dependabot updates). It runs Lint, Test & Build first. Only if everything passes, it builds the site, then deploys to dev (S3 sync + CloudFront invalidation). No frontend archive is kept in S3: a past version is rebuilt from its git commit. A manual run lets you choosedevorprod; prod is never deployed automatically. The API URL is baked into the build, so the build uses the file of the chosen environment:.env.productionfor dev (also what the checks build with),.env.prodfor prod (Vite modeprod). - Package and Push Backend (
package-and-push-backend.yml): manual only. Run it frommain, choosing the environment (devorprod) and a new version tag (for examplev1.2.0).latestand tags with unusual characters are refused; the workflow does not check whether the tag was already used, so pick one that was not. It first runs Check Backend (a few seconds); nothing is packaged if it fails. It packages the VESE proxy Lambda (zip) and pushessolar-roof-vese-proxy-<tag>.zipto the backend artefact store of that environment (solar-roof-<env>-backend-artifact-store). It does not deploy: afterwards, setsource_code_versionto the same tag indeploy.auto.tfvars.jsonof the infrastructure repo of that environment and push (damquake-style). - Dependabot (
dependabot.yml,dependabot-automerge.yml): once a month, one grouped pull request updates the npm libraries of the frontend and the GitHub Actions used by the workflows. There is no update for the backend (a single Python file without dependencies to install). Every Dependabot pull request, major versions included, is merged automatically once its checks pass:mainonly deploys to dev, and prod is deployed by hand. Before the first prod deployment, restrict the auto-merge to patch/minor again. For this to protect anything, "Lint, Test & Build" and "Check backend" must be required checks in the branch rules ofmain. A failing update stays open and blocks the others of its group until it is handled by hand. Once merged, the frontend is redeployed to dev. TypeScript major updates are ignored untiltypescript-eslintsupports TypeScript 7.
Merge protection (GitHub setting, not in the code): in Settings, Branches (or Rules), on main, turn on "Require status checks to pass before merging" and add two checks: Lint, Test & Build and Check backend. The checks only appear in the list after they have run once. From then on a pull request, Dependabot's included, cannot be merged while one of them fails.
GitHub secrets required
| Secret | Description |
|---|---|
SFOE_SOLAR_ROOF_PIPELINE_ROLE_DEV |
ARN of the IAM role SFOE-solar-roof-application-pipeline-role (OIDC, dev account). Used by the frontend workflow (deploy) and by the backend workflow (Lambda zip push). It is the ARN of the role, not of a bucket |
SFOE_SOLAR_ROOF_PIPELINE_ROLE_PROD |
Same, for the prod account (manual runs with prod) |
SFOE_SOLAR_ROOF_CLOUDFRONT_DEV |
CloudFront distribution ID (dev) for cache invalidation |
SFOE_SOLAR_ROOF_CLOUDFRONT_PROD |
CloudFront distribution ID (prod) for cache invalidation |
Both workflows have an environment input (dev/prod) for a manual run; the prod secrets above must exist. The automatic frontend deployment on main always targets dev. To release to prod: run Package and Push Backend with prod and a new tag, set that tag in deploy.auto.tfvars.json of the prod infrastructure repo, then run Package and Deploy Frontend with prod.
Note: The VESE API key (stored in AWS Secrets Manager) is not a GitHub secret and is not used by the application. The infrastructure repo references the secret by name. The frontend only ever uses the public API Gateway URL (
VITE_PVTARIF_API_URL).