
Security News
Meet Socket at Black Hat Europe and BSides London 2025
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.
@mdream/llms-db
Advanced tools
A CLI tool for managing a database of open-source project documentation converted to llms.txt format.
A CLI tool for managing a database of open-source project documentation converted to llms.txt format.
pnpm install @mdream/llms-db
mdream-db run https://docs.example.com
# With options
mdream-db run https://docs.example.com --name "Example Docs" --description "Documentation for Example project"
# Force local mode (ignore production env vars)
mdream-db run https://docs.example.com --local
mdream-db recrawl "Example Docs"
# or by ID
mdream-db recrawl 1
mdream-db list
mdream-db generate
# or specify output path
mdream-db generate ./my-llms.txt
mdream-db remove "Example Docs"
run command--name <name>: Custom name for the entry (defaults to domain)--description <desc>: Description of the site--depth <number>: Crawl depth (default: 3)--max-pages <number>: Maximum pages to crawl--exclude <pattern>: Exclude URL patterns (can be used multiple times)--output <dir>: Output directory for crawled files--local: Force local mode (ignore production environment variables)recrawl commandThe package uses a repository pattern with multiple storage backends:
LlmsRepository defines the contract for database operationsDrizzleLlmsRepository provides SQLite/LibSQL implementationLlmsStorageRepository provides file-based storage using unstoragedrizzle-kit for schema evolutionThe tool creates a database with the following tables:
llms_entries: Main entries with metadatacrawled_pages: Individual pages crawled for each entryartifacts: Generated files (llms.txt, archives, etc.)Uses unstorage for file-based key-value storage:
entries/: Main entries stored as JSON filespages/: Individual pages for each entryartifacts/: Generated files metadatameta/: Metadata for lookups and countersimport { createRepository } from '@mdream/llms-db'
// Local SQLite database
const repository = createRepository({ dbPath: './my-database.db' })
// Production LibSQL database (using environment variables)
// Automatically initializes R2 storage if credentials are available
const prodRepository = createRepository({
production: true,
authToken: process.env.TURSO_AUTH_TOKEN
})
// Production LibSQL database (with explicit configuration)
const prodRepositoryExplicit = createRepository({
production: true,
authToken: 'your_auth_token_here'
})
// Create a new entry
const entry = await repository.createEntry({
name: 'example-docs',
url: 'https://docs.example.com',
description: 'Example documentation'
})
// Update status
await repository.updateEntryStatus(entry.id, 'completed')
// Upload artifact to R2 (production only)
const archiveData = Buffer.from('archive content')
const r2Url = await repository.uploadArtifactToR2('my-project', 'archive.tar.gz', archiveData)
// Add artifact with automatic R2 upload (production only)
const llmsData = Buffer.from('llms.txt content')
await repository.addArtifactWithR2Upload(
entry.id,
'llms.txt',
'llms.txt',
llmsData,
llmsData.length
)
// Generate llms.txt
const llmsTxt = await repository.generateLlmsTxt()
console.log(llmsTxt)
repository.close()
import { createStorageRepository } from '@mdream/llms-db'
const repository = createStorageRepository({
dbPath: './my-storage'
})
// Same API as drizzle repository
const entry = await repository.createEntry({
name: 'example-docs',
url: 'https://docs.example.com',
description: 'Example documentation'
})
repository.close()
.mdream/llms.db (SQLite).mdream/llms-storage/ (unstorage).mdream/crawls/<entry-name>/.mdream/archives/<entry-name>.tar.gzlibsql://mdream-production-harlan-zw.aws-ap-northeast-1.turso.ioTURSO_AUTH_TOKEN environment variableNODE_ENV=production: Automatically use production LibSQL databaseTURSO_DATABASE_URL: LibSQL database URL (e.g., libsql://your-database.turso.io)TURSO_AUTH_TOKEN: Required for production database accessR2_ACCESS_KEY_ID: Your R2 access key IDR2_SECRET_ACCESS_KEY: Your R2 secret access keyR2_ACCOUNT_ID: Your Cloudflare account IDR2_BUCKET_NAME: Your R2 bucket nameR2_ENDPOINT: Your R2 endpoint URLR2_PUBLIC_URL: Your R2 public URLCopy the example environment file:
cp .env.example .env
Edit .env and add your configuration:
# Database Configuration
TURSO_DATABASE_URL=libsql://your-database.turso.io
TURSO_AUTH_TOKEN=your_actual_token_here
# R2 Storage Configuration (Production)
R2_ACCESS_KEY_ID=your_access_key_id
R2_SECRET_ACCESS_KEY=your_secret_access_key
R2_ACCOUNT_ID=your_account_id
R2_BUCKET_NAME=your_bucket_name
R2_ENDPOINT=https://your-account-id.r2.cloudflarestorage.com
R2_PUBLIC_URL=https://your-public-url.r2.dev
Run commands with native Node.js dotenv support:
# Database operations
node --env-file=.env ./dist/cli.mjs
# Drizzle commands
pnpm db:generate # Uses --env-file automatically
pnpm db:migrate # Uses --env-file automatically
pnpm db:studio # Uses --env-file automatically
This package uses Node.js native dotenv support (available since Node.js 20.6.0) via the --env-file flag instead of the dotenv package. This provides better performance and reduces dependencies.
The package includes built-in support for Cloudflare R2 object storage for artifact management:
When running in production mode (NODE_ENV=production or production: true), the drizzle repository automatically:
addArtifactWithR2Upload(), artifacts are automatically uploaded to R2// Production repository automatically uses R2 if configured
const repository = createRepository({ production: true })
// This will upload to R2 in production, local storage in development
const archiveData = Buffer.from('archive content')
await repository.addArtifactWithR2Upload(
entryId,
'archive',
'project.tar.gz',
archiveData,
archiveData.length
)
import { createR2Client } from '@mdream/llms-db'
const r2Client = createR2Client({
accessKeyId: process.env.R2_ACCESS_KEY_ID,
secretAccessKey: process.env.R2_SECRET_ACCESS_KEY,
accountId: process.env.R2_ACCOUNT_ID,
bucketName: process.env.R2_BUCKET_NAME,
endpoint: process.env.R2_ENDPOINT,
publicUrl: process.env.R2_PUBLIC_URL,
})
// Upload an artifact
const publicUrl = await r2Client.uploadArtifact('my-project', 'docs.tar.gz', archiveBuffer)
// Download an artifact
const data = await r2Client.downloadArtifact('my-project', 'docs.tar.gz')
// Get public URL
const url = r2Client.getPublicUrl('my-project', 'docs.tar.gz')
Add these to your .env file:
# Cloudflare R2 Configuration
R2_ACCESS_KEY_ID=your_access_key_id
R2_SECRET_ACCESS_KEY=your_secret_access_key
R2_ACCOUNT_ID=your_account_id
R2_BUCKET_NAME=your_bucket_name
R2_ENDPOINT=https://your-account-id.r2.cloudflarestorage.com
R2_PUBLIC_URL=https://your-public-url.r2.dev
FAQs
A CLI tool for managing a database of open-source project documentation converted to llms.txt format.
The npm package @mdream/llms-db receives a total of 1 weekly downloads. As such, @mdream/llms-db popularity was classified as not popular.
We found that @mdream/llms-db demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.