# @gemeentenijmegen/webapp

> This packages provides the building blocks to create a standardized webapp. It contains both infrastructure (CloudFront, S3 buckets etc.) as application code (login/authetnication)

Latest version **1.1.15** (published 2026-04-02) · EUPL-1.2 license · 0 weekly downloads

## Install

```sh
npm install @gemeentenijmegen/webapp
pnpm add @gemeentenijmegen/webapp
yarn add @gemeentenijmegen/webapp
bun add @gemeentenijmegen/webapp
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads; no esm support; large bundle.

## Facts

| | |
|---|---|
| Version | 1.1.15 |
| Published | 2026-04-02 |
| First published | 2024-02-09 |
| Weekly downloads | 0 |
| License | EUPL-1.2 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 15 |
| Unpacked size | 28.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1 |
| Author | Gemeente Nijmegen |
| Maintainers | espernijmegen, teppei01, jvanderborg, martijnvdijk, bramwithaar, marnixdessing, wkremer |
| Keywords | cdk |

## Links

- npm: https://www.npmjs.com/package/@gemeentenijmegen/webapp
- Repository: https://github.com/GemeenteNijmegen/modules-webapp
- Homepage: https://github.com/GemeenteNijmegen/modules-webapp#readme
- Issues: https://github.com/GemeenteNijmegen/modules-webapp/issues
- npm.io page: https://npm.io/package/@gemeentenijmegen/webapp

## Dependencies (15)

- [axios](https://npm.io/package/axios.md) ^1.14.0
- [cookie](https://npm.io/package/cookie.md) ^0.7.2
- [dotenv](https://npm.io/package/dotenv.md) ^16.6.1
- [mustache](https://npm.io/package/mustache.md) ^4.2.0
- [openid-client](https://npm.io/package/openid-client.md) ^5.7.1
- [cdk-remote-stack](https://npm.io/package/cdk-remote-stack.md) ^2.1.0
- [@gemeentenijmegen/utils](https://npm.io/package/@gemeentenijmegen/utils.md) ^0.0.38
- [@aws-sdk/client-dynamodb](https://npm.io/package/@aws-sdk/client-dynamodb.md) ^3.1022.0
- [@gemeentenijmegen/session](https://npm.io/package/@gemeentenijmegen/session.md) ^0.0.35
- [@gemeentenijmegen/apiclient](https://npm.io/package/@gemeentenijmegen/apiclient.md) ^0.0.41
- [@aws-lambda-powertools/logger](https://npm.io/package/@aws-lambda-powertools/logger.md) ^1.17.0
- [@aws-sdk/client-secrets-manager](https://npm.io/package/@aws-sdk/client-secrets-manager.md) ^3.1022.0
- [@gemeentenijmegen/aws-constructs](https://npm.io/package/@gemeentenijmegen/aws-constructs.md) ^0.0.49
- [@gemeentenijmegen/apigateway-http](https://npm.io/package/@gemeentenijmegen/apigateway-http.md) ^0.0.37
- [@aws-solutions-constructs/aws-lambda-dynamodb](https://npm.io/package/@aws-solutions-constructs/aws-lambda-dynamodb.md) ^2.100.1

## Recent versions

- 1.1.15 (latest) — 2026-04-02
- 1.1.14 — 2026-03-18
- 1.1.13 — 2025-12-15
- 1.1.12 — 2025-10-23
- 1.1.11 — 2025-08-19
- 1.1.10 — 2025-07-24
- 1.1.9 — 2025-06-18
- 1.1.8 — 2025-05-20
- 1.1.7 — 2025-05-06
- 1.1.6 — 2025-04-03
- 1.1.5 — 2025-03-03
- 1.1.4 — 2025-02-05
- 1.1.3 — 2024-12-10
- 1.1.2 — 2024-11-22
- 1.1.1 — 2024-11-12
- … 9 more at https://npm.io/package/@gemeentenijmegen/webapp/versions

## README

# Generic webapp

This packages provides the building blocks to create a standardized webapp.
It contains both infrastructure (CloudFront, S3 buckets etc.) as application code (login/authetnication)


## Usage

Creating the webapp foundation is easy.
```ts
/**
 * Create the webapp!
 */
const webapp = new WebappConstruct(this, 'app', {
  applicationName: Statics.projectName,
  cloudFrontCertificate: certificate,
  domainName: `${hostedZone.zoneName}`,
  additionalSourceFilesDir: 'src/resources',
  hostedZone: hostedZone,
  staticResourcesDirectory: './src/app/static-resources/',
  defaultPath: '/home',
  postLoginProcessor: this.postLoginHook(secretBrpMtlsPrivateKey, ssmBrpMtlsCertficate, ssmBrpMtlsRootCa),
  oidcProfiles: props.configuration.oidcProfiles,
});
```

<details>
<summary>Post login processor</summary>
Example on how to setup a post login processor function

```ts
  /**
   * Constrcut a post-login hook function that is passed directly
   * to the webapp. It will register the function and redirect trafic
   * there after the pre-login (auth lambda).
   * @returns
   */
  postLoginHook(privateKey: ISecret, cert: IStringParameter, rootCa: IStringParameter) {
    const hook = new ApiFunction(this, 'post-login-function', {
      description: 'Post-login lambda',
      apiFunction: PostloginFunction,
      environment: {
        BRP_API_URL: StringParameter.valueForStringParameter(this, Statics.ssmBrpApiEndpointUrl),
        MTLS_PRIVATE_KEY_ARN: privateKey.secretArn,
        MTLS_CLIENT_CERT_NAME: Statics.ssmBrpMtlsCertificate,
        MTLS_ROOT_CA_NAME: Statics.ssmBrpMtlsRootCA,
      },
    });
    privateKey.grantRead(hook.lambda);
    cert.grantRead(hook.lambda);
    rootCa.grantRead(hook.lambda);
    return hook;
  }
```

</details>

## Adding multiple pages
```ts
/**
 * Add a home page to the webapp
 * @param webapp
 */
addHomePage(webapp: WebappConstruct) {
  const homeFunction = new ApiFunction(this, 'home-function', {
    description: 'Home lambda',
    apiFunction: HomeFunction,
  });
  webapp.addPage('home', homeFunction, '/home');
}
```

---
_Source: https://npm.io/package/@gemeentenijmegen/webapp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
