
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Query databases with natural language using an LLM
npx nttp setup
npx nttp query "show me 5 users"
npm install nttp
Interactive (recommended):
npx nttp setup
Non-interactive (for agents/CI):
npx nttp setup --non-interactive \
--database-type=pg \
--database-url=postgresql://user:pass@localhost:5432/db \
--llm-provider=anthropic \
--llm-api-key=sk-ant-...
CLI:
npx nttp query "show active users"
npx nttp query "count pending orders"
npx nttp query "top 10 products by price"
Code:
import { NTTP } from 'nttp';
const nttp = await NTTP.fromEnv();
const result = await nttp.query("show active users");
console.log(result.data);
await nttp.close();
3-layer caching system optimizes cost and performance:
L1: EXACT Hash match $0 <1ms (in-memory) or ~5ms (Redis)
L2: SEMANTIC Embedding match $0.0001 80ms
L3: LLM Claude/GPT $0.01 2-3s
Most queries hit L1 or L2. Only novel queries reach the LLM.
SELECT * FROM users WHERE status = 'active'npx nttp docs [topic]// Simple
await nttp.query("show users");
await nttp.query("list products");
// Filtered
await nttp.query("active users from California");
await nttp.query("products under $50");
// Aggregations
await nttp.query("count pending orders");
await nttp.query("total revenue by category");
// Complex
await nttp.query("top 10 products by revenue");
await nttp.query("users who joined this year");
.env)# Database
DATABASE_TYPE=pg
DATABASE_URL=postgresql://user:pass@localhost:5432/mydb
# LLM
LLM_PROVIDER=anthropic
LLM_MODEL=claude-sonnet-4-5-20250929
ANTHROPIC_API_KEY=sk-ant-...
# Cache (optional but recommended)
REDIS_URL=redis://localhost:6379
OPENAI_API_KEY=sk-... # For L2 semantic cache
const nttp = new NTTP({
database: {
client: 'pg',
connection: 'postgresql://user:pass@localhost:5432/mydb'
},
llm: {
provider: 'anthropic',
model: 'claude-sonnet-4-5-20250929',
apiKey: process.env.ANTHROPIC_API_KEY
},
cache: {
redis: { url: 'redis://localhost:6379' },
l2: { enabled: true, provider: 'openai', apiKey: process.env.OPENAI_API_KEY }
}
});
await nttp.init();
See Configuration Guide for all options.
Cost Savings: With caching, 90%+ cost reduction after warm-up.
See Model Selection Guide for detailed comparison.
# Setup wizard
npx nttp setup
# Query database
npx nttp query "your question"
npx nttp query "show users" --format json
# Documentation
npx nttp docs # Show all docs
npx nttp docs redis # Search for "redis"
npx nttp docs "semantic cache" # Multi-word search
import { NTTP } from 'nttp';
// Initialize from environment variables
const nttp = await NTTP.fromEnv();
// Execute query
const result = await nttp.query("show active users");
console.log(result.data); // Query results
console.log(result.cacheHit); // true/false
console.log(result.meta); // Cache metadata
// Explain query (without executing)
const explanation = await nttp.explain("show users");
console.log(explanation.sql); // Generated SQL
// Database inspection
const tables = await nttp.getTables();
const schema = await nttp.getTableSchema('users');
// Cache management
const stats = await nttp.getCacheStats();
await nttp.pinSchema(schemaId);
// Clean up
await nttp.close();
See API Reference for complete documentation.
import { IntentParseError, SQLGenerationError, SQLExecutionError } from 'nttp';
try {
const result = await nttp.query("your query");
} catch (error) {
if (error instanceof IntentParseError) {
console.error('Could not understand query');
console.log('Suggestions:', error.suggestions);
} else if (error instanceof SQLGenerationError) {
console.error('Could not generate SQL');
} else if (error instanceof SQLExecutionError) {
console.error('Query execution failed');
}
}
All errors include helpful suggestions. See Troubleshooting Guide.
Full TypeScript support with exported types:
import type {
NTTPConfig,
QueryResult,
Intent,
SchemaDefinition,
CacheStats
} from 'nttp';
MIT
FAQs
natural text to query - Query databases with natural language
We found that nttp 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.