0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

数秘術Webアプリ「Destiny Matrix」の技術実装解説

Posted at

はじめに

Destiny Matrixは、生年月日から数秘術的な分析を提供する多言語対応のWebアプリケーションです。100%無料で、ユーザー登録不要で即座にパーソナル分析が可能な点が特徴です。本記事では、その技術的な実装について詳しく解説します。

技術スタック概要

フロントエンド

  • HTML5 - セマンティックマークアップ
  • CSS - TailwindCSS(CDN経由)+ カスタムCSS
  • JavaScript - Vanilla JS(フレームワーク不使用)
  • フォント - Plus Jakarta Sans(Google Fonts)

インフラ・ツール

  • 静的サイト - サーバーサイド処理なし
  • Analytics - Google Analytics + Umami
  • 広告 - Google AdSense
  • PWA - プログレッシブWebアプリ対応

アーキテクチャ設計

1. モジュラー設計

プロジェクトは機能別にJavaScriptファイルを分割し、保守性を高めています:

src/
├── script_2025.js          # メインアプリケーションロジック
├── analysis.js             # 解釈ルールと分析ロジック
├── code.js                 # 数学的計算(マトリックスポイント)
├── compatibility_interpretation.js  # 相性分析
├── share.js                # ソーシャル共有機能
├── style.js                # 動的スタイリング
└── [lang]_analysis.js      # 言語別分析ファイル

2. 多言語対応アーキテクチャ

/                    # 英語版(メイン)
├── de/             # ドイツ語
├── es/             # スペイン語
├── fr/             # フランス語
├── id/             # インドネシア語
├── pt/             # ポルトガル語
├── az/             # アゼルバイジャン語
├── it/             # イタリア語
└── km/             # クメール語

各言語版は独立したディレクトリ構造を持ち、SEO最適化のためhreflangタグで適切にリンクされています。

3. データフロー

核心機能の実装

1. 生年月日バリデーション

// 現在から120年前までの日付制限
let today = new Date();
document.getElementById('date').setAttribute("max", today.toLocaleDateString("en-CA"));
let ancientDate = new Date(today.getFullYear() - 120, today.getMonth(), today.getDay());
document.getElementById('date').setAttribute("min", ancientDate.toLocaleDateString("en-CA"));

2. 数秘術計算エンジン

code.jsでは、22個のマトリックスポイント(A〜X + 追加ポイント)を計算:

function Points(person) {
  // A-Xまでの各ポイントをDOMに反映
  document.querySelector('#apoint').textContent = person.points.apoint;
  document.querySelector('#bpoint').textContent = person.points.bpoint;
  // ... (22個のポイント)
}

3. 分析システム

analysis.jsでは、計算されたスコアに基づく動的解釈を実装:

const interpretations = {
  coreEnergy: {
    strong: {
      text: "Your core energy is exceptionally strong...",
      status: "Strong",
      statusClass: "bg-green-500/20 text-green-400"
    },
    balanced: { /* ... */ },
    weak: { /* ... */ }
  },
  lifePath: {
    spiritual: {
      text: (scores) => `Your life path scores of ${scores.personal}/${scores.social}...`,
      // 動的テキスト生成
    }
  }
}

4. 相性計算

二人の生年月日から相性を分析:

// compatibility_interpretation.js
// クロスリファレンス計算による相性スコア算出

PWA実装

1. Manifest設定

<link rel="manifest" href="/assets/logo/site.webmanifest">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">

2. レスポンシブデザイン

TailwindCSSのユーティリティクラスを活用:

<!-- モバイル優先のレスポンシブ設計 -->
<div class="lg:hidden flex items-center justify-between px-4 py-3">
  <!-- モバイル用ヘッダー -->
</div>

SEO最適化

1. 構造化データ

<!-- Open Graph -->
<meta property="og:type" content="website" />
<meta property="og:title" content="Destiny Matrix Chart | 100% Free Analysis" />
<meta property="og:description" content="..." />

<!-- Twitter Cards -->
<meta name="twitter:card" content="summary_large_image" />

2. 国際化SEO

<!-- 各言語版への適切なリンク -->
<link rel="alternate" hreflang="en" href="https://destiny-matrix.cc/" />
<link rel="alternate" hreflang="de" href="https://destiny-matrix.cc/de/" />
<!-- 9言語対応 -->

パフォーマンス最適化

1. 軽量化戦略

  • フレームワーク不使用 - Vanilla JSで高速化
  • CDN活用 - TailwindCSS、Google Fontsなど
  • 画像最適化 - WebP形式の採用

2. 遅延読み込み

<script defer src="https://umami.bri-calculator.com/script.js"></script>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

技術的な工夫点

1. 状態管理

グローバルオブジェクトを活用したシンプルな状態管理:

let person = {};
let points = {};
let purposes = {};
let chartHeart = {};
let years = {};

2. 動的UI更新

計算結果に応じたコンポーネントの表示制御:

const pentoContainer = document.querySelector('.pento');
if(pentoContainer !== null) {
  pentoContainer.classList.add('display-none');
}

3. エラーハンドリング

各コンポーネントでnullチェックを実装:

const karmicTailSection = document.getElementById('karmic-tail-result');
if(karmicTailSection === null) {
  return;
}

多言語実装の詳細

1. 分析テキストの国際化

各言語用の分析ファイル:

  • de_analysis.js - ドイツ語解釈
  • es_analysis.js - スペイン語解釈
  • fr_analysis.js - フランス語解釈
  • など

2. 言語切り替えUI

<!-- 言語切り替えボタン -->
<button id="mobile-lang-toggle" class="p-2 rounded-lg bg-white/10">
  <svg><!-- 言語アイコン --></svg>
</button>

セキュリティ考慮事項

1. クライアントサイド処理

  • すべての計算をクライアントサイドで実行
  • 個人情報のサーバー送信なし
  • プライバシー保護の徹底

2. 入力バリデーション

  • 日付形式の厳密チェック
  • 年齢制限の実装(120年間)

今後の改善点

1. パフォーマンス

  • Service Workerの実装
  • キャッシュ戦略の最適化

2. 機能拡張

  • オフライン対応の強化
  • より詳細な分析アルゴリズム

3. 技術的負債

  • TypeScriptへの移行検討
  • モジュールバンドラーの導入

まとめ

Destiny Matrixは、シンプルな技術スタックで複雑な数秘術分析を実現している興味深いプロジェクトです。特に以下の点が技術的に優れています:

  1. 軽量性 - フレームワーク不使用による高速化
  2. 国際化 - 9言語対応の包括的実装
  3. プライバシー - クライアントサイド完結設計
  4. SEO - 多言語SEO最適化
  5. PWA - モバイル体験の最適化

静的サイトでありながら、豊富な機能と優れたユーザー体験を提供している点で、モダンWeb開発の良い参考例と言えるでしょう。


関連リンク

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?