This repository contains a frontend and backend setup designed for building hybrid web applications using React islands within an Umbraco CMS project.
.
🔗 frontend/ # React components (Vite project) — compiled as standalone scripts
🔗 backend/ # Umbraco CMS project — loads React islands into Razor views
The frontend folder houses a Vite-based React project. This project isn't a traditional SPA — it outputs individual components as JavaScript modules, ready to be loaded into the Umbraco backend and mounted as React islands within Razor views.
-
Navigate to the
frontenddirectory:cd frontend -
Install dependencies:
pnpm install
-
Start it dev/watch mode:
pnpm dev:watch
OR
pnpm dev:build
-
Build for production:
pnpm build
The output will be placed in the backend's wwwroot/assets/ folder, separated between Javascript and CSS files
The backend folder contains an Umbraco CMS project that serves as the main application.
- The backend loads the compiled React component scripts from the
frontendbuild output.
@if (Debugger.IsAttached) {
<script type="module" src="~/assets/js/main.js"></script>
<link rel="stylesheet" href="~/assets/css/main.css" />
} else {
<script type="module" asp-src-include="~/assets/js/main.*.js"></script>
<link rel="stylesheet" asp-href-include="~/assets/css/main.*.css" />
}<div data-component="BlogListing"></div>- Build React components in the
frontendproject. - Reference the output into the layout of the site.
- Mount React components by using the
data-component="..."annotation