|
| 1 | +# Claude Code Memory Bank |
| 2 | + |
| 3 | +## Project Information |
| 4 | + |
| 5 | +- **Project**: Personal homepage/blog built with Next.js and Notion as CMS |
| 6 | +- **Tech Stack**: Next.js 15.5.4, TypeScript, @notionhq/client 5.1.0, notion-to-md, Tailwind CSS |
| 7 | +- **Testing**: Vitest with 71 tests |
| 8 | +- **Node Version**: 22.x |
| 9 | + |
| 10 | +## Recent Updates |
| 11 | + |
| 12 | +### @notion/client Migration (v4.0.2 → v5.1.0) - Completed |
| 13 | + |
| 14 | +**Date**: 2025-09-28 |
| 15 | + |
| 16 | +Successfully migrated from @notion/client v4.0.2 to v5.1.0 without breaking functionality. |
| 17 | + |
| 18 | +**Key Changes Made**: |
| 19 | + |
| 20 | +1. **API Method Change**: `notion.databases.query()` → `notion.dataSources.query()` |
| 21 | +2. **Parameter Change**: `database_id` → `data_source_id` |
| 22 | +3. **Import Path Fix**: `ImageBlockObjectResponse` now imported from main module |
| 23 | +4. **API Version**: Using default API version (2025-09-03) - older versions had compatibility issues |
| 24 | +5. **Test Updates**: Updated mocks to use `dataSources` instead of `databases` |
| 25 | + |
| 26 | +**Important Notes**: |
| 27 | + |
| 28 | +- Switched to use notion data source ids instead of Database IDs |
| 29 | + |
| 30 | +**Files Modified**: |
| 31 | + |
| 32 | +- `src/lib/notion.ts` - Core Notion API interactions |
| 33 | +- `scripts/cache-posts.ts` - Post caching script |
| 34 | +- `__tests__/lib/notion.test.ts` - Unit tests |
| 35 | + |
| 36 | +**Verification**: |
| 37 | + |
| 38 | +- ✅ All 71 tests pass |
| 39 | +- ✅ TypeScript compilation successful |
| 40 | +- ✅ Build completes without errors |
| 41 | +- ✅ Static generation works correctly |
| 42 | + |
| 43 | +## Commands to Remember |
| 44 | + |
| 45 | +### Development |
| 46 | + |
| 47 | +- `npm run dev` - Start development server |
| 48 | +- `npm run build` - Production build |
| 49 | +- `npm test` - Run all tests |
| 50 | +- `npm run typecheck` - TypeScript validation |
| 51 | +- `npm run lint` - ESLint |
| 52 | +- `npm run cache:posts` - Cache posts from Notion |
| 53 | + |
| 54 | +### Testing |
| 55 | + |
| 56 | +- `npm run test:watch` - Watch mode testing |
| 57 | +- `npm run test:coverage` - Coverage report |
| 58 | +- `npm run test:ui` - Vitest UI |
| 59 | + |
| 60 | +## Architecture Notes |
| 61 | + |
| 62 | +### Notion Integration |
| 63 | + |
| 64 | +- Uses Notion as headless CMS for blog posts and photos |
| 65 | +- Posts cached locally in `posts-cache.json` and `photos-cache.json` |
| 66 | +- Supports two sections: "All" (general posts) and "VBC" (Value-Based Care posts) |
| 67 | +- Image handling with local download and optimization |
| 68 | + |
| 69 | +### File Structure |
| 70 | + |
| 71 | +- `src/lib/notion.ts` - Main Notion API wrapper |
| 72 | +- `scripts/cache-posts.ts` - Caching script for posts and photos |
| 73 | +- `__tests__/` - Test files using Vitest |
| 74 | +- Posts cached as JSON files in project root |
| 75 | + |
| 76 | +### API Compatibility |
| 77 | + |
| 78 | +- Database queries work with both posts and photos databases |
0 commit comments