Files
metabuilder/codegen/docs/reference/INDEX.md
johndoe6345789 a51130a127 feat: Add external low-code and postgres repositories
- codegen: Low-code React app with JSON-driven component system
- packagerepo: Schema-driven package repository with backend/frontend
- postgres: Next.js app with Drizzle ORM and PostgreSQL

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 16:48:52 +00:00

370 lines
10 KiB
Markdown

# 🎯 Phase 4 Refactoring - Index
## 📚 Documentation Navigation
Welcome to the Phase 4 refactoring documentation! This index will help you find what you need quickly.
## 🚀 Start Here
### New to the Refactoring?
1. **[QUICK_REFERENCE.md](../guides/QUICK_REFERENCE.md)** - Fast overview with code examples
2. **[ARCHITECTURE_VISUAL_GUIDE.md](../architecture/ARCHITECTURE_VISUAL_GUIDE.md)** - Visual diagrams and flows
3. **[PHASE4_IMPLEMENTATION_COMPLETE.md](../history/PHASE4_IMPLEMENTATION_COMPLETE.md)** - Complete summary
### Ready to Code?
1. **[COMPLETE_HOOK_LIBRARY.md](../api/COMPLETE_HOOK_LIBRARY.md)** - Hook API reference
2. **[JSON_ORCHESTRATION_COMPLETE.md](../architecture/JSON_ORCHESTRATION_COMPLETE.md)** - JSON page guide
3. **[MIGRATION_GUIDE.md](../guides/MIGRATION_GUIDE.md)** - Step-by-step migration from old to new
## 📖 Documentation Files
### Core Documentation
#### 1. **QUICK_REFERENCE.md** (6.5KB)
**Purpose:** Fast lookup guide
**Contents:**
- Hook cheat sheet
- JSON schema cheat sheet
- Common patterns
- Quick examples
- File organization
**Best for:** Daily development, quick lookups
---
#### 2. **COMPLETE_HOOK_LIBRARY.md** (8.5KB)
**Purpose:** Complete hook API documentation
**Contents:**
- All 12+ hooks documented
- Usage examples for each hook
- Composition patterns
- Best practices
- Testing guidelines
**Best for:** Learning hooks, API reference
---
#### 3. **JSON_ORCHESTRATION_COMPLETE.md** (14.8KB)
**Purpose:** Complete JSON orchestration guide
**Contents:**
- Architecture overview
- Schema specifications
- Complete examples
- Advanced patterns
- Migration strategy
- Debugging tips
**Best for:** Building JSON-driven pages
---
#### 4. **PHASE4_IMPLEMENTATION_COMPLETE.md** (11.2KB)
**Purpose:** Implementation summary and overview
**Contents:**
- What was delivered
- Architecture principles
- Success metrics
- Next steps
- File reference
**Best for:** Understanding the big picture
---
#### 5. **ARCHITECTURE_VISUAL_GUIDE.md** (12.9KB)
**Purpose:** Visual architecture documentation
**Contents:**
- System architecture diagrams
- Data flow diagrams
- Component lifecycle
- Code organization
- Migration visualization
**Best for:** Understanding system design
---
#### 6. **MIGRATION_GUIDE.md** (11.8KB)
**Purpose:** Step-by-step migration instructions
**Contents:**
- Three migration paths (hooks, split, JSON)
- Hook extraction guide
- Component splitting guide
- JSON conversion guide
- Decision matrix
- Common issues and solutions
**Best for:** Migrating existing components
---
## 🗂️ Code Organization
### Hook Library
```
src/hooks/
├── data/ # 6 hooks (~300 LOC)
│ ├── use-array.ts
│ ├── use-crud.ts
│ ├── use-search.ts
│ ├── use-debounce.ts
│ ├── use-sort.ts
│ └── use-pagination.ts
├── ui/ # 4 hooks (~120 LOC)
│ ├── use-dialog.ts
│ ├── use-tabs.ts
│ ├── use-selection.ts
│ └── use-clipboard.ts
└── forms/ # 2 hooks (~130 LOC)
├── use-form.ts
└── use-form-field.ts
```
### Orchestration Engine
```
src/config/orchestration/
├── schema.ts # TypeScript/Zod schemas
├── action-executor.ts # Action execution
├── data-source-manager.ts # Data management
├── component-registry.ts # Component lookup
├── PageRenderer.tsx # Main renderer
└── index.ts # Exports
```
### Example Pages
```
src/config/pages/
├── dashboard.json # Dashboard example
└── simple-form.json # Form example
```
## 🎓 Learning Path
### Beginner (New to the system)
1. Read **QUICK_REFERENCE.md** (15 min)
2. Browse **ARCHITECTURE_VISUAL_GUIDE.md** (10 min)
3. Try a simple hook from examples (30 min)
**Total:** ~1 hour
---
### Intermediate (Ready to build)
1. Read **COMPLETE_HOOK_LIBRARY.md** (30 min)
2. Read **JSON_ORCHESTRATION_COMPLETE.md** (45 min)
3. Build a small feature with hooks (2 hours)
4. Create a JSON page (1 hour)
**Total:** ~4 hours
---
### Advanced (Migration & patterns)
1. Read **PHASE4_IMPLEMENTATION_COMPLETE.md** (20 min)
2. Read **MIGRATION_GUIDE.md** (30 min)
3. Study existing hook implementations (1 hour)
4. Migrate a component (2-4 hours)
5. Create custom composed hooks (2-4 hours)
**Total:** ~8 hours
---
## 🔍 Finding Information
### "How do I...?"
#### Data Management
- **Store an array?** → `useArray` in [COMPLETE_HOOK_LIBRARY.md](../api/COMPLETE_HOOK_LIBRARY.md#usearray)
- **Search items?** → `useSearch` in [COMPLETE_HOOK_LIBRARY.md](../api/COMPLETE_HOOK_LIBRARY.md#usesearch)
- **Sort items?** → `useSort` in [COMPLETE_HOOK_LIBRARY.md](../api/COMPLETE_HOOK_LIBRARY.md#usesort)
- **Paginate items?** → `usePagination` in [COMPLETE_HOOK_LIBRARY.md](../api/COMPLETE_HOOK_LIBRARY.md#usepagination)
- **CRUD operations?** → `useCRUD` in [COMPLETE_HOOK_LIBRARY.md](../api/COMPLETE_HOOK_LIBRARY.md#usecrud)
#### UI State
- **Modal/dialog?** → `useDialog` in [QUICK_REFERENCE.md](../guides/QUICK_REFERENCE.md#ui-hooks)
- **Tabs?** → `useTabs` in [QUICK_REFERENCE.md](../guides/QUICK_REFERENCE.md#ui-hooks)
- **Multi-select?** → `useSelection` in [COMPLETE_HOOK_LIBRARY.md](../api/COMPLETE_HOOK_LIBRARY.md#useselection)
- **Copy to clipboard?** → `useClipboard` in [QUICK_REFERENCE.md](../guides/QUICK_REFERENCE.md#ui-hooks)
#### Forms
- **Full form?** → `useForm` in [COMPLETE_HOOK_LIBRARY.md](../api/COMPLETE_HOOK_LIBRARY.md#useform)
- **Single field?** → `useFormField` in [COMPLETE_HOOK_LIBRARY.md](../api/COMPLETE_HOOK_LIBRARY.md#useformfield)
#### JSON Pages
- **Create a page?** → [JSON_ORCHESTRATION_COMPLETE.md](../architecture/JSON_ORCHESTRATION_COMPLETE.md#complete-examples)
- **Define data sources?** → [JSON_ORCHESTRATION_COMPLETE.md](../architecture/JSON_ORCHESTRATION_COMPLETE.md#2-data-sources)
- **Add actions?** → [JSON_ORCHESTRATION_COMPLETE.md](../architecture/JSON_ORCHESTRATION_COMPLETE.md#3-actions)
- **Build component tree?** → [JSON_ORCHESTRATION_COMPLETE.md](../architecture/JSON_ORCHESTRATION_COMPLETE.md#4-components)
#### Architecture
- **System design?** → [ARCHITECTURE_VISUAL_GUIDE.md](../architecture/ARCHITECTURE_VISUAL_GUIDE.md)
- **Data flow?** → [ARCHITECTURE_VISUAL_GUIDE.md](../architecture/ARCHITECTURE_VISUAL_GUIDE.md#data-flow-diagram)
- **Migration path?** → [MIGRATION_GUIDE.md](../guides/MIGRATION_GUIDE.md)
- **How to migrate?** → [MIGRATION_GUIDE.md](../guides/MIGRATION_GUIDE.md#-migration-strategy)
---
## 📋 Quick Start Checklist
### Using Hooks
- [ ] Read hook documentation
- [ ] Import the hook you need
- [ ] Use in your component
- [ ] Test the functionality
### Creating JSON Pages
- [ ] Read JSON orchestration guide
- [ ] Create JSON schema file
- [ ] Define data sources
- [ ] Build component tree
- [ ] Add actions
- [ ] Test with PageRenderer
### Migrating Components
- [ ] Identify large component
- [ ] Extract business logic to hooks
- [ ] Split into smaller components
- [ ] Create JSON schema (if applicable)
- [ ] Test thoroughly
- [ ] Remove old code
---
## 🎯 Key Concepts Summary
### Hooks
- **Purpose:** Extract and reuse business logic
- **Size:** All under 150 LOC
- **Location:** `/src/hooks/`
- **Examples:** useArray, useCRUD, useSearch, useDialog, useForm
### JSON Orchestration
- **Purpose:** Define pages without code
- **Format:** JSON schema files
- **Location:** `/src/config/pages/`
- **Benefits:** Rapid prototyping, easy testing, no rebuilds
### Component Size
- **Target:** Under 150 LOC
- **Strategy:** Extract logic to hooks
- **Focus:** Presentation only
- **Benefits:** Readable, maintainable, testable
---
## 📊 Statistics
### Code Written
- **12+ custom hooks** (~550 LOC)
- **5 orchestration files** (~325 LOC)
- **2 example JSON pages** (~120 LOC)
- **5 documentation files** (~54KB)
### Metrics
- ✅ All hooks < 150 LOC
- ✅ All orchestration files < 85 LOC
- ✅ Full type safety (TypeScript + Zod)
- ✅ Zero breaking changes
- ✅ Backward compatible
---
## 🆘 Getting Help
### Documentation Issues
1. Check this index
2. Search within specific docs
3. Review code examples
4. Check `/src/config/pages/` for examples
### Code Issues
1. Review hook implementations in `/src/hooks/`
2. Check component registry
3. Validate JSON schemas with Zod
4. Enable debug mode on PageRenderer
### Questions
1. What are you trying to do?
2. Which doc is most relevant?
3. Have you checked the examples?
4. Need a custom solution?
---
## 🔗 Related Files
### Implementation
- `/src/hooks/` - Hook implementations
- `/src/config/orchestration/` - Engine code
- `/src/config/pages/` - Example pages
### Documentation (This Section)
- `QUICK_REFERENCE.md` - Fast lookup
- `COMPLETE_HOOK_LIBRARY.md` - Hook API
- `JSON_ORCHESTRATION_COMPLETE.md` - JSON guide
- `PHASE4_IMPLEMENTATION_COMPLETE.md` - Summary
- `ARCHITECTURE_VISUAL_GUIDE.md` - Diagrams
### Legacy Documentation
- `REFACTOR_PHASE4_COMPLETE.md` - Original plan
- `HOOK_LIBRARY_DOCS.md` - Early hook docs
- `JSON_ORCHESTRATION_GUIDE.md` - Early JSON docs
---
## ✨ What's Next?
### Immediate Actions
1. ✅ Hook library created
2. ✅ Orchestration engine built
3. ✅ Documentation written
4. ✅ Examples provided
### Your Next Steps
1. 📖 Read QUICK_REFERENCE.md
2. 🔨 Try using a hook
3. 📄 Create a JSON page
4. 🔄 Migrate a component
### Future Enhancements
- Visual JSON schema editor
- More hook utilities
- Advanced patterns
- Performance profiling
- Analytics integration
---
**Last Updated:** Phase 4 Implementation
**Status:** ✅ Complete
**Version:** 4.0.0
**Breaking Changes:** None
**Migration:** Optional (gradual)
---
## 📚 Full Documentation Tree
```
Documentation/
├── INDEX.md (this file) # Navigation hub
├── QUICK_REFERENCE.md # Fast lookup guide
├── COMPLETE_HOOK_LIBRARY.md # Hook API reference
├── JSON_ORCHESTRATION_COMPLETE.md # JSON orchestration guide
├── MIGRATION_GUIDE.md # Migration instructions
├── PHASE4_IMPLEMENTATION_COMPLETE.md # Summary
└── ARCHITECTURE_VISUAL_GUIDE.md # Visual diagrams
Code/
├── src/hooks/ # Hook implementations
├── src/config/orchestration/ # Engine code
└── src/config/pages/ # Example JSON pages
```
---
**Happy Coding! 🚀**