[READ-ONLY] Mirror of https://github.com/crutchcorn/coldspa. Give your CFML a spa day. The Islands Architecture for ColdFusion. coldspa.dev
cfml coldfusion hydration islands islands-architecture react ssr vite vite-plugin vue
ColdFusion 70%
JavaScript 26%
MDX 2%
Vue 1%
CSS <1%
TypeScript <1%

README.md

Coldspa

splatter

Give your CFML a spa day. The Islands Architecture for ColdFusion.


Build Status ForgeBox NPM Version NPM downloads MIT License

Mount Vue or React components into CFML pages with server-side rendering and progressive hydration.

Install #

CFML side (via CommandBox / ForgeBox):

box install coldspa

Node side (Vite plugin + SSR sidecar):

npm install coldspa vite vue   # or: react react-dom

Setup #

Register the module's directory as a custom tag path so <cf_Island> and <cf_Slot> resolve from anywhere in your app, and delegate to coldspa.Bootstrap from your lifecycle methods so Coldspa can boot the Vite + SSR sidecar processes:

// Application.cfc
component {
    this.name = "MyApp";
    this.customTagPaths = expandPath("/modules/coldspa");

    function onApplicationStart() {
        new coldspa.Bootstrap().onApplicationStart();
        return true;
    }

    function onApplicationStop() {
        new coldspa.Bootstrap().onApplicationStop();
    }

    function onRequestStart(targetPage) {
        new coldspa.Bootstrap().onRequestStart();
        return true;
    }
}

ColdBox users can skip this — the bundled ModuleConfig.cfc registers the custom tag path and wires the bootstrap lifecycle automatically.

Configure Vite #

// vite.config.js
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import coldspa from 'coldspa/vite';

export default defineConfig({
    plugins: [
        vue(),
        coldspa({
            frameworks: ['vue'],
            globs: { vue: '/src/**/*.vue' } // where your components live
        })
    ]
});

Use the normal framework Vite plugin for every framework you enable. For React, install and add @vitejs/plugin-react; for mixed Vue + React configs, include both vue() and react() before coldspa(...).

Use it from CFML #

<cfinclude template="/coldspa/renderers/Vue.cfm">

<cf_Island
    framework="#Vue#"
    path="./src/App.vue"
    props="#{ hello: 'World' }#"
    strategy="visible">

    <p>Default-slot content rendered by CFML.</p>

    <cf_Slot name="header">
        <h2>Header from CFML</h2>
    </cf_Slot>
</cf_Island>

That's it — start your CF server and load the page. coldspa.Bootstrap auto-spawns the Vite dev server and Node SSR sidecar in the background and tears them down on app stop. For Docker, supervised deployments, or opting out, see Getting started.

Documentation #