フィールドノート
プロジェクトから学んだ短い記録です。各ログでは、問題、修正方法、
学んだことをまとめています。
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は空のマイグレーションを生成することがあります。
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.