フィールドノート
プロジェクトから学んだ短い記録です。各ログでは、問題、修正方法、
学んだことをまとめています。
2026-07-11 · 認証 / デバッグ / FastAPI
JWT Dashboard の管理者アクセスを修正する
問題:
JWT Authentication Dashboard ではログインはできましたが、
管理者ページからユーザー一覧を取得できませんでした。
ブラウザでは CORS エラー、接続エラー、500 Internal Server Error が表示されました。
原因:
FastAPI バックエンドの CORS 設定に、ローカル開発用の
http://localhost:5175 が含まれていませんでした。
さらに、管理者チェックでは current_user.role を使っていましたが、
実際の current_user は辞書型でした。
修正:
CORS の許可リストにローカルフロントエンドのURLを追加し、
管理者ロールの確認を current_user.get("role") に変更しました。
学んだこと:
フロントエンドに表示されるエラーでも、原因がバックエンドにある場合があります。
CORS、認証、認可、デプロイログを順番に確認することが重要だと学びました。
2026-07-11 · ポートフォリオ / フロントエンド / プロジェクト整理
ポートフォリオの注目プロジェクトを更新する
問題:
ポートフォリオの注目プロジェクトが、現在のスキルや最新の作業内容を
十分に反映していませんでした。
修正:
ホームページの注目プロジェクトを4つに増やし、
Inventory Management System、Bloom、Mini User API、
JWT Authentication Dashboard を中心に表示するようにしました。
学んだこと:
ポートフォリオはプロジェクト一覧ではなく、
「それぞれのプロジェクトで何を証明できるか」を伝える場所です。
2026-06-13 · バックエンド / テスト / Pytest
pytest の import path を修正する
問題:
app/__init__.py は存在していたのに、
pytest が app パッケージを見つけられませんでした。
修正:
pytest.ini を追加し、pythonpath = . と
testpaths = tests を設定しました。
学んだこと:
__init__.py はフォルダを Python パッケージとして扱えるようにします。
しかし、pytest がどこから探し始めるかは pytest.ini で指定します。
2026-06 · フロントエンド / アクセシビリティ / UI
アプリの表示設定を使いやすくする
問題:
アクセシビリティ設定が深い設定ページにあると、ユーザーが見つけにくくなります。
修正:
フォントサイズや読みやすいフォント設定など、重要な表示設定を
ヘッダーの小さなメニューに移動します。
学んだこと:
アクセシビリティ設定は、プロフィール設定だけでなく、
公開ページやログイン後のページからも簡単に使えるべきです。
2026-07 · バックエンド / デバッグ
空のAlembicマイグレーションの修正
問題:
Alembic がマイグレーションファイルを生成しましたが、以下が含まれていませんでした:
op.create_table(「tickets」, ...)
解決策:
プロジェクトルートおよび Backend フォルダ内の正しいコマンドの場所を使用して、
マイグレーションファイルを再生成します。
教訓:
Alembicは、SQLAlchemyのモデルを現在のデータベースの状態と比較します。
テーブルがすでに存在する場合、Alembicは空のマイグレーションを生成することがあります。
2026-07 · フルスタック / React / FastAPI
Bloomのルーティン同期問題を修正
問題:
ログインユーザーがRoutinesページで作成したルーティンが、
HomeページやProgressページに表示されず、再読み込み後も正しく保存されていませんでした。
バックエンドAPIはすでに存在していましたが、複数のルーティン機能が動作していないように見える状態でした。
修正:
フロントエンドのデータフローを調査し、Routines.jsxがバックエンドのCRUD関数を
インポートしているにもかかわらず、実際には呼び出していないことを確認しました。
認証済みユーザー向けのバックエンド永続化、ページ間同期イベント、
ローディング表示、エラー表示、Homeページの自動再読み込みを実装しました。
学び:
複数の不具合が、実際には1つの根本原因から発生している場合があります。
個別の症状だけを修正するのではなく、UIからAPI、データベースまで
データの流れ全体を追跡することが重要だと学びました。
2026-07-26 · フルスタック / React / FastAPI
ページネーション導入後のダッシュボード分析の修正
問題:
Inventory Management System の商品数を増やしている際に、ダッシュボードの
統計情報が PostgreSQL に保存されている在庫データと一致していないことに
気づきました。新しい商品を追加しても、ダッシュボードは10件分のデータだけを
使用して合計を表示していました。
修正:
バックエンド API を確認し、/items エンドポイントが意図的に
10件までのデータを返すページネーション設定になっていることを確認しました。
次に、/items/stats、/items/category-summary、
/items/category-value をテストし、データベース全体を対象に
集計していることを確認しました。React フロントエンドを修正し、
ダッシュボードの統計には集計専用エンドポイントを使用しながら、
在庫一覧にはページネーションを残しました。
学び:
ページネーションされた一覧データを、ダッシュボード全体の統計計算に
使用するべきではありません。React の UI から API、データベースまで
データの流れを確認したことで、問題がバックエンドの計算ではなく、
フロントエンドのデータ取得方法にあることを特定できました。
Field Notes
Short notes from my projects. Each entry explains the problem, the fix,
and the lesson learned.
2026-07-11 · Authentication / Debugging / FastAPI
Fixing JWT Dashboard Admin Access
Problem:
The JWT Authentication Dashboard login flow worked, but the Admin page
could not load users from the deployed Mini User API backend.
The browser showed CORS errors, connection errors, and a 500 Internal Server Error.
Cause:
The deployed FastAPI backend did not allow the local frontend origin
http://localhost:5175. The admin route also tried to use
current_user.role, but current_user was actually
a dictionary returned from the auth dependency.
Fix:
I added the local frontend origin to the backend CORS allow list and changed
the admin role check to use current_user.get("role").
Lesson:
A frontend error is not always a frontend problem. In this case, the visible
error appeared in React, but the real causes were backend CORS configuration,
deployed API behaviour, and role-checking logic.
2026-07-11 · Portfolio / Frontend / Project Presentation
Updating Portfolio Featured Projects
Problem:
The portfolio homepage did not fully reflect my strongest and most current
projects after recent updates to the JWT Authentication Dashboard and backend API.
Fix:
I updated the featured project data, changed the homepage from three featured
projects to four, refreshed the tags, and added new screenshots for the JWT
Authentication Dashboard.
Lesson:
A portfolio should not only list projects. It should clearly show what each
project proves, such as authentication, backend API design, deployment,
CI/CD, accessibility, or full-stack integration.
2026-06-13 · Backend / Testing / Pytest
Fixing pytest import paths
Problem:
pytest could not find the app package, even though
app/__init__.py existed.
Fix:
Added a pytest.ini file with pythonpath = .
and testpaths = tests.
Lesson:
__init__.py makes a folder a Python package, but
pytest.ini tells pytest where to start looking from.
2026-06 · Frontend / Accessibility / UI
Making app controls easier to access
Problem:
Accessibility controls can be difficult to find if they are hidden
deep inside a settings page.
Fix:
Move important display controls, such as font size and readable font options,
into a small header menu.
Lesson:
Accessibility settings should be easy to reach from public and logged-in pages,
not only from profile settings.
2026-07 · Backend / Debugging
Fixing an Empty Alembic Migration
Problem:
Alembic created a migration file but this did not include:
op.create_table("tickets", ...)
Fix:
Using the correct command locations in the Project Root and Backend folder
to regenerate the migration file.
Lesson:
Alembic compares SQLAlchemy models against the current database state.
If the table already exists, Alembic may generate an empty migration.
2026-07 · Full-Stack / React / FastAPI
Fixing Bloom Routine Synchronisation
Problem:
Routines created by logged-in users appeared on the Routines page but did not
appear on Home, Progress, or after refresh. Several routine-related features
seemed broken despite the backend APIs already existing.
Fix:
Investigated the frontend data flow and discovered that Routines.jsx never
called the backend CRUD functions. Added authenticated backend persistence,
routine synchronisation events, loading states, and automatic Home page
refreshes after routine changes.
Lesson:
Multiple bugs can often share a single root cause. Following data from the
UI through the API and database is often more effective than fixing symptoms
individually.
2026-07-26 · Full-Stack / React / FastAPI
Fixing Dashboard Analytics After Introducting Pagination
Problem:
While expanding the Inventory Management System, I noticed the dashboard
statistics did not match the inventory stored in PostgreSQL. New products
were added, but the dashboard continued to display totals based on only ten
items.
Fix:
I reviewed the backend API and confirmed that the /items
endpoint intentionally limits results to ten records. I then tested the
/items/stats, /items/category-summary, and
/items/category-value endpoints and confirmed that they
calculated data across the full database. I updated the React frontend to
use these aggregation endpoints for dashboard statistics while keeping the
inventory list paginated.
Lesson:
Paginated operational data should not be used to calculate global dashboard
metrics. Tracing data from the React UI through the API and database helped
identify that the issue was caused by the frontend data flow rather than the
backend calculations.