Building Static Content
Overview
This document explains how you can generate static assets from a WaveMaker web application.
Introduction
A WaveMaker application consists of two major parts:
- Frontend (UI) artifacts: HTML, CSS, JavaScript, images, and other static assets
- Backend artifacts: Java classes which can be packaged as a WAR file
For better performance, it is recommended to host frontend static assets on a Static Content Server or a CDN (such as AWS CloudFront, Azure CDN, Nginx, or Apache), while the backend can be deployed on an application server like Tomcat.
Generating Deployable Artifacts
To generate frontend and backend artifacts from a WaveMaker application, follow these steps:
- Ensure that the selected profile has the
build.ui.modeset asangular. - Execute the following Maven command:
mvn clean install -P<profile-name>
For example
mvn clean install -Pdeployment
This command generates two deployable artifacts: ui-artifacts.zip and project.war, both located in the target folder.
Both artifacts are required for the application to function correctly.
Deploying only the frontend assets to a CDN without deploying the WAR file will result in an incomplete application.
Preparing Static Assets for CDN Deployment
- Unzip the generated file:
unzip ui-artifacts.zip
-
Upload the extracted contents to one of the following:
- AWS CloudFront (via an S3 bucket as the origin)
- Azure CDN (via a Storage Account container)
- Static servers such as Nginx or Apache
Configuring CDN URL
After hosting the static assets, the WaveMaker application must know where to load the frontend assets from. This is done using the property:
app.cdnUrl
The CDN URL usually points to the CDN endpoint followed by the application path.
For example
https://mydomain.cloudfront.net/my_app/1234/
WaveMaker supports multiple ways to configure the CDN URL.
-
Environment / System Property (Highest Priority)
Setapp.cdnUrlas an environment or system property on the server. For details, see: Using Environment Properties [ link to be given] -
Maven Build Parameter
Pass the CDN URL during the Maven build:mvn clean install -Pdeployment \
-Dapp.cdnUrl=https://mydomain.cloudfront.net/my_app/1234/ -
Profile Property
Define theapp.cdnUrldirectly in the WaveMaker profile configuration.
Build and Deploy Static Content
Watch for deeper understanding of Static Content in WaveMaker