This repository contains the source code for the Miagati website, implemented as a client-side single-page application (SPA) with modular HTML fragments and JavaScript page controllers. The site emphasizes staged rendering, deterministic cleanup, and configuration-driven content for pricing, galleries, and background imagery.
The project is intended to be viewed and evaluated as a polished portfolio and production-style front-end codebase. It is not designed for reuse as a general-purpose template.
- SPA navigation with staged fragment loading and lifecycle-managed page controllers.
- Modular components (header, footer, background, logo) loaded at runtime.
- Configuration-driven content from JSON and markdown sources.
- Script and command registries to avoid duplicate loads and enable debug tooling.
- Gallery and background features powered by structured configuration data.
- HTML5 and CSS3 (modular stylesheets per feature/page)
- Vanilla JavaScript (ES modules, fetch-based fragment loading)
- LocalStorage for runtime toggles
- Font Awesome (CDN)
- SwiperJS (CDN)
- Marked (local copy for markdown rendering)
The application bootstraps from index.html, which loads js/app/App.js. At startup:
IncludeHtmlLoaderresolvesinclude-htmlattributes for shared components.PageManagermanages SPA navigation and hash-based routing.PageRegistryloads page controllers on demand.FragmentLoaderfetches and stages HTML fragments, executes scripts, and handles cleanup.
This structure keeps layout components persistent while swapping page fragments into #content-area.
- Navigation buttons specify a
data-pagetarget. PageManagerrequests the page controller viaPageRegistry.FragmentLoaderfetches the fragment and prepares a staging DOM.- The controller initializes and validates the staging content.
- The fragment commits into
#content-area, the URL hash is updated, and the page title is set. - Cleanup hooks run when navigating away to prevent stale event handlers or scripts.
index.html-- entry point and dependency wiringhtml/component/-- shared fragments (header, footer, background, logo)html/page/-- SPA page fragments (pricing, terms-of-service, gallery)js/app/-- app orchestration and SPA routingjs/core/-- fragment loading, registries, and utilitiesjs/pages/-- page controllers and lifecycle hookscss/-- global and page-specific stylesdata/config/-- source JSON configuration inputs (pricing, gallery, background)data/markdown/-- markdown content rendered at runtimedocs/-- architecture and development documentation
- Architecture:
docs/Architecture.md - Developer Manual:
docs/Developer-Manual.md - Configuration Guide:
docs/Configuration-Guide.md - License:
LICENSE.md
- Build and content config schemas are in
schemas/. - Editor mappings for config files are in
.vscode/settings.json. scripts/build-config.jsonand all source files indata/config/include inline$schemareferences.
- Serve the project with a local static file server so ES modules and fetch requests work correctly.
- Opening via
file://is not supported due to browser security restrictions. - The app now expects a generated runtime config (
/data/config/runtime-config.json), so run the build pipeline before serving production-like output. - External dependencies load via CDN, and markdown rendering uses a local
lib/marked.min.js.
Build a deployable static output in dist/ with cache-busted JS/CSS URLs in index.html.
- Run:
npm install npm run build
- Deploy the contents of
dist/.
Alternative (auto-installs local Node/npm if missing):
python3 scripts/bootstrap_build.py
# Or alternatively:
python scripts/bootstrap_build.pyRun Docker dev container (detached by default):
python scripts/bootstrap_build.py --run-devRun Docker dev container in attached mode:
python3 scripts/bootstrap_build.py --run-dev --attachedBuild behavior:
BUILD_IDis generated automatically at build time.- Resolution order:
BUILD_IDenvironment variable -> git short commit hash -> UTC timestamp. - Build logging uses
loglevelwithBUILD_LOG_LEVELsupport (trace|debug|info|warn|error|silent). - Set
BUILD_DEBUG=1for verbose debug output (equivalent toBUILD_LOG_LEVEL=debugwhen no explicit level is set). npm run buildauto-installs required npm runtime packages when missing (setBUILD_SKIP_NPM_INSTALL=1orSKIP_NPM_INSTALL=1to disable this behavior).- Local CSS files are bundled and minified per HTML entry in
dist/(for this project:dist/index.html->dist/css/index.bundle.min.css), while CDN stylesheets remain unchanged. - Non-minified copied CSS files in
dist/css/are removed during build; only minified bundle outputs remain there. - HTML, JS, and JSON outputs in
dist/are minified during the asset optimization stage. - Every local
.jsand.cssURL in built HTML files receives or updates?v=<BUILD_ID>. - All
data/config/*.jsonsources are merged intodist/data/config/runtime-config.json. - Gallery and background images are processed into optimized WebP variants during build, with metadata injected into
runtime-config.json. - Watermarking is rule-driven via
scripts/build-config.json(imagePipeline.watermark) and currently applies by default to galleryspotlightand galleryoriginal(download) assets usingscripts/watermark.png. - Per-file config JSON artifacts are removed from
dist/data/config(single runtime config contract). scripts/bootstrap_build.pyuses system npm when available; otherwise it downloads a local portable Node.js/npm toolchain under.tools/node.scripts/bootstrap_build.pyinstalls npm dependencies before running the build (npm ciwhen possible, fallback tonpm install).scripts/bootstrap_build.pyvalidates that every required runtime package fromscripts/build-config.jsonis declared inpackage.jsonand installed before runningnpm run build.- With
--run-dev, the script checks whetherDockerfile.devalready runsnpm run build; if yes, it skips local pre-build and lets Docker handle it.
The Docker image now uses the build pipeline (npm run build) and serves the generated dist/ output from nginx.
- Start the container:
docker compose -f compose.dev.yml up --build -d
- Open the app in a browser:
http://localhost:8080 - Stop the container:
docker compose -f compose.dev.yml down
Notes:
- The image build stage runs
npm run buildto generate cache-busted assets. - The runtime nginx container serves only the built static files from
dist/.
- AI tools were used during development; all architectural decisions and system design choices are authored by the project owner.
- The commit history has been collapsed into a single commit to remove images and material that do not belong to the author.
This repository uses a custom source-available license defined in LICENSE.md. The code is provided for educational and portfolio review only, and it is not open source. Commercial use of the software is explicitly and exclusively granted to Miagati. All other commercial usage, redistribution, derivative works, or deployment are prohibited unless explicitly authorized by the author.