tpmjs/packages/db
Ajax Davis f9ba1c094e feat: add README rendering and enhanced package metadata display
**Database Schema:**
- Add npmReadme, npmKeywords, npmAuthor, npmMaintainers fields to Tool model

**NPM Client:**
- Add fetchLatestPackageWithMetadata() function to fetch README and top-level metadata
- Export new PackageVersionWithReadme type

**Sync Workers:**
- Update keyword and changes sync to fetch and store README content
- Store author, maintainers, and keywords from package.json

**UI Components:**
- Create Markdown component using react-markdown with GitHub Flavored Markdown
- Add rehype-sanitize for security and remark-gfm for tables/strikethrough support

**Tool Detail Page:**
- Convert from createElement to JSX for better maintainability
- Display README in a dedicated card with proper markdown rendering
- Show NPM keywords, author, and maintainers in sidebar
- Add ThemeToggle to header
- Improve layout with better spacing and organization

This brings the tool detail pages much closer to NPM's package pages,
providing users with comprehensive information about each tool including
the full README documentation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 22:41:50 +10:00
..
prisma feat: add README rendering and enhanced package metadata display 2025-11-29 22:41:50 +10:00
src feat(db): create database package with Prisma schema for NPM registry 2025-11-28 02:07:39 +10:00
.env.example feat(db): create database package with Prisma schema for NPM registry 2025-11-28 02:07:39 +10:00
package.json fix(db): add build script to generate Prisma client for CI 2025-11-28 04:04:57 +10:00
README.md feat(db): create database package with Prisma schema for NPM registry 2025-11-28 02:07:39 +10:00
test-query.mjs fix(ci): skip lefthook install when .git directory missing 2025-11-29 13:51:05 +10:00
tsconfig.json feat(db): create database package with Prisma schema for NPM registry 2025-11-28 02:07:39 +10:00

@tpmjs/db

Database package for TPMJS NPM Registry. Provides Prisma ORM setup and database client for storing tool metadata.

Setup

1. Create Neon Database

  1. Go to https://neon.tech/
  2. Create a new project
  3. Copy the connection string

2. Configure Environment

cp .env.example .env
# Edit .env and add your DATABASE_URL

3. Run Migrations

pnpm db:migrate
pnpm db:seed

Usage

import { prisma } from '@tpmjs/db';

// Query tools
const tools = await prisma.tool.findMany({
  where: {
    category: 'web-scraping',
    isOfficial: true,
  },
  orderBy: {
    qualityScore: 'desc',
  },
  take: 10,
});

// Update sync checkpoint
await prisma.syncCheckpoint.update({
  where: { source: 'changes-feed' },
  data: {
    checkpoint: {
      sequence: '12345',
      lastProcessed: new Date().toISOString(),
    },
  },
});

Scripts

  • pnpm db:generate - Generate Prisma client
  • pnpm db:push - Push schema to database (for development)
  • pnpm db:migrate - Create and run migrations (for production)
  • pnpm db:studio - Open Prisma Studio GUI
  • pnpm db:seed - Seed initial data

Schema

Tool

Stores NPM packages with TPMJS metadata from their package.json.

SyncCheckpoint

Tracks progress of sync workers (changes feed, keyword search, metrics).

SyncLog

Audit trail of all sync operations.