LogoLogo
  • Technical Direction
  • Technical overview
    • Technical Implementation
    • API Design Guide
      • Data Definitions and Standards
      • Data Transfer Objects
      • Documentation
      • Environments
      • Error Handling
      • Example API Service
      • GraphQL Naming Conventions
      • Methods
      • Naming Conventions
      • Once Only Principle
      • Pagination
      • Resource Oriented Design
      • REST Request
      • REST Response
      • Security
      • Versioning
    • Ísland.is Public Web Data Flow
    • Code Reviews
    • Code Standards
    • Monorepo
    • Project Management
    • Teamwork
    • Architectural Decision Records
      • Use Markdown Architectural Decision Records
      • Use NX
      • Continuous Integration
      • CSS
      • Branching and Release Strategy
      • Error Tracking and Monitoring
      • What API Management Tool to Consider
      • Viskuausan Static Site Generator
      • Use OAuth 2.0 and OpenID Connect As Protocols for Authentication and Authorization
      • Unified Naming Strategy for Files and Directories
      • CMS
      • Open Source License
      • What Chart Library Should We Use Across Island.is?
      • What Feature Flag Service/application Should We Use at Island.is?
      • Logging, Monitoring and APM Platform
      • ADR Template
    • Log Management Policy
  • Products
    • Island.is Authentication Service
      • Terminology
      • Integration Options
      • Authentication Flows
      • Authorising API Endpoints
      • Session Lifecycle
      • Scopes and Tokens
      • Delegations
      • Configuration
      • Tools and Examples
      • Environments
      • Test IAS with Postman
      • Using the IAS admin portal
    • Notifications / Hnipp
      • New Notification Setup Guide
      • Notifications service workflow overview
      • Email notifications
    • Pósthólfið
      • Security Checklist
      • Introduction
      • Skjalatilkynning API
      • Skjalaveita API
      • Sequence Diagram
      • Interfaces
    • Straumurinn (X-Road)
      • Architecture Guidelines for Service Providers and Consumers
      • Setting up an X-Road Security Server
        • Network Configuration
      • X-Road - Uppfærsla á öryggisþjónum
      • Straumurinn - Notkun og umsýsla
      • X-Road Central - current version
  • Development
    • Getting Started
    • Generating a New Project
    • Definition of done
    • Devops
      • Continuous Delivery
      • Database
      • Dockerizing
      • Environment Setup
      • Logging
      • Metrics
      • NextJS Custom Server
      • Observability
      • Operations Base Principles
      • Security
      • Service Configuration
      • Support
    • AWS Secrets
    • Feature Flags
    • Documentation Contributions
    • Defining Monorepo Boundaries With Tags
    • OpenAPI
    • Code Generation
    • Workspace Settings (Deprecated)
    • External Contributions
  • REFERENCE
    • Problems
      • 400 Validation Failed
      • 400 Attempt Failed
      • 403 Bad Subject
      • 400 500 Template API Error
    • Glossary
  • Misc
    • Guide: Adding a Payment Step to an Application
    • Guide: Enable Organisations to Make Requests to an Application
    • README Template
Powered by GitBook
On this page
  • GitBook
  • Storybook
  • Reading material
  • External contributors
  • Prerequisites
  • For fetching secrets
  • Usage
  • Fresh start/changing branches
  • Development server
  • Build
  • Formatting your code
  • Running lint checks
  • Running unit tests
  • Running end-to-end tests
  • Schemas
  • Understand your workspace
  • AWS Secrets
  • Running proxy against development service
  • Environment variables with static websites

Was this helpful?

  1. Development

Getting Started

PreviousX-Road Central - current versionNextGenerating a New Project

Last updated 1 year ago

Was this helpful?

This is the center of development for digital government services on island.is. It is managed by the department inside the .

These solutions are and open to contributions, but most development will be performed by teams that win tenders to develop new functionality for Digital Iceland.

The repository is a that has multiple apps (something that can be built and run) and libraries (which other apps and libraries can depend on). All custom-written services are also stored there.

GitBook

The apps and libraries documentation and our handbook are hosted on and is publicly available at .

Storybook

The Ísland.is design system is developed and showcased using and is publicly available at .

Reading material

To get more technical information about the project please make sure to read this .

External contributors

If you want to contribute to the repository, please make sure to follow .

Prerequisites

For fetching secrets

    • brew install awscli

    • brew install jq

Usage

There are many projects that can be built and run.

To list projects that can be built the following command can be used

yarn nx show projects --with-target build

Fresh start/changing branches

Run on whenever you check out a branch:

yarn install
yarn infra
yarn codegen

When you clone the repo for the first time, and whenever you change branches, you need to update your dependencies to match your current branch using yarn install. In addition, schemas change frequently, so you will also need to update the generated schemas and clients using yarn codegen.

Development server

For a dev server:

yarn start <project>

The app will automatically reload if you change any of the source files.

Build

To build the project:

yarn build <project>

The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Formatting your code

You need to format all files to follow Nx code conventions. To do so run:

yarn nx format:write

Running lint checks

We have many lint rules to help having a unify code all over the project. To execute the linting:

yarn lint <project>

Running lint locally is slow and fill up heap memory. This is related to Typescript compilation and Nx lint builder being slow. As a result you might get a JavaScript heap out of memory. Nx is working on fixing this for an upcoming update. In the meantime you can do NODE_OPTIONS=“--max-old-space-size=4096” yarn lint <project> to raise the memory limit.

Running unit tests

yarn test <project>

To execute the unit tests affected by a change:

yarn affected:test

Running end-to-end tests

Schemas

Understand your workspace

To see a diagram of the dependencies of your projects:

yarn nx dep-graph

AWS Secrets

Running proxy against development service

If you have AWS access to our development account, you can connect to development databases and services using a proxy. We've set up a proxy and connection helpers for our development Postgres, Elastic Search, Redis and X-Road Security Server.

To do so, you can run for example:

./scripts/run-db-proxy.sh

If you want to run your app against one of this service (e.g. db), you may need to edit your app environment or sequelize config to pass the proxy credentials.

The following services will run on the associated ports: db:5432, es:9200, redis:6379, xroad:80. If you have docker running on theses ports or any others services you will need to stop them in order to run the proxies.

Environment variables with static websites

To be able to access environment variables in purely static projects, you need to do the following:

  1. In the index.html file, add <!-- environment placeholder -->.

  2. Use the getStaticEnv function from the @island.is/shared/utils library to fetch your environment variables.

  3. Prefix your environment variables with SI_PUBLIC_, for example SI_PUBLIC_MY_VARIABLE.

NOTE: This is only to get environment variables when running in kubernetes, not for when running locally. So you should only use getStaticEnv in your environment.prod.ts file.

What happens behind the scenes is that static projects have a bash script that runs when the docker container starts up. This script searches for references of SI_PUBLIC_* in the code and tries to find a match in the environment. It then puts all the matches inside the index.html which is then served to the client.

You have Node and Yarn installed as outlined in the engines section in the repository's

You have installed.

You have installed.

You have >= 1.8 installed (for schema generation).

If you are running on Windows we recommend using

You have installed.

You have installed.

See further useage of the Nx show command in their .

To execute the unit tests via :

See our technical documentation on our .

If your project is generating schemas files from an OpenAPI, Codegen or is an API, check out .

A dedicated documentation about fetching shared development secrets or creating new secrets, using AWS secrets is available .

It will try to get your AWS credentials from your environment variables and from your ~/.aws/credentials file. You can find more instructions .

GitHub organization
Digital Iceland
Ministry of Finance and Economic Affairs
FOSS
monorepo
GitBook
docs.devland.is
Storybook
ui.devland.is
overview
this guide
package.json
Docker
direnv
Java
Docker and WSL2
AWS command line tools v2
jq
docs
Jest
system e2e setup
this documentation
here
here