Skip to content

cbcdn - Self-Hosted CDN

Self-hosted static assets for Campaign Brain applications, eliminating external CDN dependencies.

Purpose

Provides local hosting of JavaScript libraries, CSS frameworks, and web fonts to:

  • Enable network isolation / air-gapped deployments
  • Reduce external dependencies
  • Improve load times with local caching
  • Ensure asset availability

Assets

JavaScript Libraries

Library Version Path Used By
htmx 2.0.4 js/htmx/ cbapp, cbworkflow, cbsurveys
Alpine.js 3.x js/alpine/ cbuserguide
Chart.js 4.x js/chart/ cbsurveys, cbradio
Leaflet 1.9.4 js/leaflet/ cbmaps, cbdistricts, tenant apps
MapLibre GL 4.7.1 js/maplibre/ cbmaps, cbdistricts
Lucide latest js/lucide/ cbapp, cbpublic
Supercluster 8.0.1 js/supercluster/ cbmaps

CSS

Library Path
Leaflet css/leaflet/leaflet.css
MapLibre GL css/maplibre/maplibre-gl.css
Tailwind CSS css/tailwind/tailwind.min.css

Fonts

Font Path Used By
Libre Baskerville fonts/libre-baskerville/ cbpublic
Source Sans 3 fonts/source-sans-3/ cbpublic
Montserrat fonts/montserrat/ cbapp, tenant sites
Open Sans fonts/open-sans/ cbworkflow
Bebas Neue fonts/bebas-neue/ cbmaps
Barlow fonts/barlow/ cbdistricts

Map Tiles

Map tile fonts stored in tiles/fonts/ are proxied through tiles.nominate.ai.

Usage

Reference assets from any Campaign Brain application:

<!-- htmx -->
<script src="/cdn/js/htmx/htmx.min.js"></script>

<!-- Alpine.js -->
<script src="/cdn/js/alpine/alpine.min.js" defer></script>

<!-- Leaflet -->
<link rel="stylesheet" href="/cdn/css/leaflet/leaflet.css">
<script src="/cdn/js/leaflet/leaflet.js"></script>

<!-- Fonts -->
<link rel="stylesheet" href="/cdn/fonts/open-sans/open-sans.css">

Deployment

Assets are served via NGINX at cdn.nominate.ai (port 32402).

location /cdn/ {
    alias /home/bisenbek/projects/nominate/cbcdn/;
    expires 7d;
    add_header Cache-Control "public, immutable";
}

Updating Libraries

  1. Download the new version of the library
  2. Replace files in the appropriate directory
  3. Update MANIFEST.json with the new version
  4. Test in a Campaign Brain application
  5. Commit and deploy