
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.
A Django-inspired ORM for TypeScript with pluggable backends and offline-first support
A Django-inspired ORM for TypeScript with pluggable backends and offline-first support.
Linquery is a flexible Object-Relational Mapping library that brings Django ORM's elegance to the TypeScript ecosystem. It features:
import { Model, Manager, CharField, IntegerField, BooleanField } from 'linquery';
import { MemoryAdapter } from 'linquery/adapters';
// Create adapter
const adapter = new MemoryAdapter();
// Define your model
class Book extends Model {
declare id?: number;
declare title: string;
declare pages: number;
declare published: boolean;
static objects: Manager<Book>;
}
// Initialize the model with field definitions
Book.init({
title: new CharField({ maxLength: 200 }),
pages: new IntegerField({ min: 1 }),
published: new BooleanField({ default: false }),
});
// Set adapter and manager
(Book as any).setAdapter(adapter);
Book.objects = new Manager(Book, adapter);
// Create records
const book = await Book.objects.create({
title: 'TypeScript Handbook',
pages: 350,
published: true,
});
// Use Django-style queries
const books = await Book.objects
.filter({ pages__gte: 200 })
.filter({ published: true })
.order_by('-pages')
.toArray();
// Get single record
const firstBook = await Book.objects.get({ id: 1 });
console.log(firstBook.title);
const queryset = Book.objects
.filter({ title__startswith: 'The' })
.filter({ pages__gte: 100 })
.order_by('-pages', 'title')
.limit(10);
// Lazy evaluation - query only executes when needed
const results = await queryset.toArray();
✅ Implemented - ForeignKey and OneToOne relationships with lazy/eager loading.
import { ForeignKeyField, OneToOneField } from 'linquery';
class Author extends Model {
declare id?: number;
declare name: string;
static objects: Manager<Author>;
}
Author.init({
name: new CharField({ maxLength: 100 }),
});
class Post extends Model {
declare id?: number;
declare title: string;
declare author: Author;
static objects: Manager<Post>;
}
Post.init({
title: new CharField({ maxLength: 200 }),
author: new ForeignKeyField(Author, { onDelete: 'CASCADE' }),
});
// Lazy loading (fetches when accessed)
const post = await Post.objects.get({ id: 1 });
const author = await post.author; // Fetches author on demand
// Eager loading (prevents N+1 queries)
const posts = await Post.objects
.select_related('author')
.all()
.toArray();
// Now post.author is already loaded!
// Reverse relations
const authorPosts = await author.post_set.all().toArray();
✅ Implemented - Two complementary adapters for offline-first applications.
Perfect for mobile apps and PWAs that need instant UI responses with background data synchronization.
import { CachedAdapter, MemoryAdapter, GraphQLAdapter } from 'linquery';
// Create cached adapter with configurable strategies
const cachedAdapter = new CachedAdapter({
cache: new MemoryAdapter(), // Or DexieAdapter for IndexedDB
remote: new GraphQLAdapter({ endpoint: '/graphql' }),
readStrategy: 'cache-then-network', // Return cache, update in background
writeStrategy: 'network-first', // Try network first, queue if offline
enableOfflineQueue: true,
isOnline: () => navigator.onLine,
});
// Listen to cache events
cachedAdapter.signals.cacheHit.connect((sender, event) => {
console.log('Serving from cache:', event.model);
});
cachedAdapter.signals.cacheUpdated.connect((sender, event) => {
console.log('Cache updated from network:', event.model);
// Update UI with fresh data
});
// Works offline automatically
const post = await Post.objects.create({
title: 'Offline post',
content: 'Queued for sync when online'
});
Best for collaborative apps and multi-device synchronization.
import { SyncAdapter, MemoryAdapter, GraphQLAdapter } from 'linquery';
// Create sync adapter for bidirectional sync
const syncAdapter = new SyncAdapter({
local: new MemoryAdapter(),
remote: new GraphQLAdapter({ endpoint: '/graphql' }),
syncStrategy: 'last-write-wins', // or 'local-wins', 'remote-wins', 'custom'
autoSync: true,
syncInterval: 30000,
});
// Register models for sync
syncAdapter.registerModel(Post);
// Bidirectional sync
await syncAdapter.sync(); // Pull then push
// Monitor sync status
const stats = syncAdapter.getQueueStats();
console.log(`Pending: ${stats.pending}, Synced: ${stats.synced}`);
import { signal, SignalType } from 'linquery';
// Listen to model events
signal(SignalType.POST_SAVE).connect(
async (sender, instance, created) => {
console.log(`${sender.name} saved:`, instance);
},
{ sender: User }
);
// Custom signals for sync
signal(SignalType.SYNC_CONFLICT).connect(
async (sender, operation, conflict) => {
// Handle sync conflicts
}
);
┌─────────────────────────────────────┐
│ User Code │
└──────────────┬──────────────────────┘
│
┌──────────────▼──────────────────────┐
│ ORM Core Layer │
│ - Models & Fields │
│ - QuerySets │
│ - Relationships │
│ - Signals │
└──────────────┬──────────────────────┘
│
┌──────────────▼──────────────────────┐
│ Backend Adapter Interface │
└──────────────┬──────────────────────┘
│
┌──────────┼──────────┬──────────┐
│ │ │ │
┌───▼────┐┌───▼────┐┌────▼───┐┌────▼─────┐
│Memory ││GraphQL ││Cached ││Sync │
│Adapter ││Adapter ││Adapter ││Adapter │
└────────┘└────────┘└────────┘└──────────┘
as any usagenpm install linquery
# Optional: Install specific adapters
npm install @linquery/adapter-graphql
npm install @linquery/adapter-dexie
npm install @linquery/adapter-postgres
🚀 Alpha Release (v0.2.0) - Phase 1-5 Complete!
Core features fully implemented and production-ready:
See ROADMAP.md for complete features and timeline.
Linquery is inspired by Django ORM and follows these principles:
MIT
Contributions are welcome! Please read our contributing guidelines (coming soon).
Inspired by Django ORM and built for the TypeScript ecosystem.
FAQs
A Django-inspired ORM for TypeScript with pluggable backends and offline-first support
We found that linquery 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.