1
1

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アプリのSPA基盤整備(Zustand移行・Supabase認証)

Posted at

現在取り組んでいるproject

  • クリニック向けの在庫管理Webアプリ(社内利用想定)
  • 在庫・入出庫・施設間移動・棚卸などを扱うSPA構成
  • 公開ルート(ログイン)と認証保護ルート(アプリ本体)を分離

技術スタック

  • フロントエンド: Next.js 15(App Router, RSC), React 19, TypeScript 5
  • UI: Tailwind CSS, Radix UI, Lucide Icons, tailwindcss-animate
  • フォーム/バリデーション: React Hook Form + Zod
  • 状態管理: Zustand(selectorベース購読)
  • 認証/バックエンド: Supabase(@supabase/ssr, @supabase/supabase-js
  • ユーティリティ: date-fns, Recharts, clsx, tailwind-merge, sonner
  • ビルド/その他: PostCSS, Next Lint

本日行ったこと

  • 【認証ルートガードを導入】app/(auth)/layout.tsx で Supabase のサーバークライアントによる getUser チェックを実装し、未ログイン時は /login にリダイレクト
  • 【SPAシェルの整理】app/page.tsx をSPAシェルとして整理し、(public)/login(auth) のルートグループを明確化
  • 【状態管理の再設計(段階移行)】Zustand を導入し、InventoryContext を薄いファサード化、inventoryOrchestrator を抽出、selectorベース購読・shallow比較対応、Rules of Hooks 違反を修正
  • 【監査ログの一本化】AuditServiceuseAuditLogger で操作・ルーティングの監査経路をサービス経由に統合し、window依存を排除
  • 【環境/施設切替の整備】EnvironmentContextsetCurrentFacility を追加し、施設変更のブリッジを実装
  • 【ドキュメント整備】SPA構成ベストプラクティス、Supabase Auth + Next.js 実装手順、監査ログ要件/修正ガイドを追加・更新
  • 【その他】不要なセレクタ/インポートの削除、依存整理、ビルド安定化対応
1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?