1
0
card/docs/DEVELOPMENT.md
2025-06-01 21:39:53 +09:00

124 lines
2.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 開発ガイド
## セットアップ
### 1. API (FastAPI)
```bash
cd api
# 仮想環境作成
python -m venv venv
source venv/bin/activate # macOS/Linux
# or
venv\Scripts\activate # Windows
# 依存関係インストール
pip install -r requirements.txt
# 環境変数設定
cp .env.example .env
# .envを編集
# 開発サーバー起動
uvicorn app.main:app --reload
```
APIは http://localhost:8000 で起動します。
APIドキュメントは http://localhost:8000/docs で確認できます。
### 2. Web (React + Vite)
```bash
cd web
# 依存関係インストール
npm install
# 開発サーバー起動
npm run dev
```
Webアプリは http://localhost:3000 で起動します。
## プロジェクト構造
```
ai.card/
├── api/ # FastAPI backend
│ ├── app/
│ │ ├── core/ # 設定、共通処理
│ │ ├── models/ # Pydanticモデル
│ │ ├── routes/ # APIエンドポイント
│ │ ├── services/ # ビジネスロジック
│ │ └── main.py # アプリケーションエントリ
│ └── requirements.txt
├── web/ # React frontend
│ ├── src/
│ │ ├── components/ # Reactコンポーネント
│ │ ├── services/ # API通信
│ │ ├── styles/ # CSS
│ │ ├── types/ # TypeScript型定義
│ │ └── App.tsx # メインコンポーネント
│ └── package.json
├── ios/ # iOS app (今後実装)
└── docs/ # ドキュメント
```
## 技術スタック
### Backend
- Python 3.9+
- FastAPI
- Pydantic
- SQLAlchemy (今後実装)
- atproto SDK
### Frontend
- React 18
- TypeScript
- Vite
- Framer Motion (アニメーション)
- Axios
## 開発のポイント
### 1. カードデータ
カードは0-15のIDを持ち、ai.jsonの定義に基づいています。
### 2. レアリティシステム
- 通常のガチャではキラカードが最高レア
- uniqueカードは隠し要素として実装
- 確率は設定ファイルで調整可能
### 3. atproto連携
- ユーザー認証はatproto OAuth今後実装
- カードデータはユーザーのPDSに保存今後実装
- 現在はローカルストレージのみ
### 4. アニメーション
- ガチャ演出はレアリティに応じて変化
- uniqueカードは特別な演出
- Framer Motionで実装
## 今後の実装予定
1. **データベース連携**
- SQLAlchemyでのモデル定義
- ユーザーごとのカード管理
2. **atproto統合**
- OAuth認証
- PDSへのデータ保存
- DID検証
3. **uniqueカード検証**
- グローバルレジストリ
- 重複チェック
- ai.verse連携
4. **iOS app**
- SwiftUIで実装
- 共通APIを使用