
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 GraphQL alternative with faster performance and simpler use
Query-2jz is a modern data query and manipulation system that provides the benefits of GraphQL with significant performance improvements and a simpler developer experience. Built with TypeScript and designed for edge computing.
npm install query-2jz
# or
yarn add query-2jz
# or
pnpm add query-2jz
npm install -g query-2jz-cli
query-2jz init my-project
cd my-project
npm install
Edit query-2jz.config.js:
module.exports = {
database: {
type: 'sqlite',
connection: './database.sqlite'
},
cache: {
type: 'memory',
ttl: 300
},
realtime: {
enabled: true,
transport: 'websocket'
},
models: [
{
name: 'User',
fields: {
id: { type: 'id' },
name: { type: 'string', required: true },
email: { type: 'string', required: true, unique: true },
createdAt: { type: 'date' },
updatedAt: { type: 'date' }
},
relations: {
posts: {
type: 'oneToMany',
model: 'Post',
foreignKey: 'authorId'
}
},
indexes: ['email']
},
{
name: 'Post',
fields: {
id: { type: 'id' },
title: { type: 'string', required: true },
content: { type: 'string' },
published: { type: 'boolean', default: false },
authorId: { type: 'string', required: true },
createdAt: { type: 'date' },
updatedAt: { type: 'date' }
},
relations: {
author: {
type: 'oneToOne',
model: 'User',
foreignKey: 'authorId'
}
}
}
]
};
query-2jz dev
query-2jz generate-types
Instead of writing resolvers, you declare what data you need:
// Query users with their posts
const query = {
select: {
id: true,
name: true,
email: true,
posts: {
select: {
id: true,
title: true,
published: true
},
where: {
published: true
}
}
},
where: {
email: { contains: '@example.com' }
},
orderBy: {
createdAt: 'desc'
},
limit: 10
};
const result = await query2jz.query(query, 'User');
Make any query live with a simple flag:
const subscription = query2jz.subscribe(query, 'User', (data) => {
console.log('Users updated:', data);
});
// Unsubscribe when done
subscription.unsubscribe();
Mutations support optimistic updates out of the box:
const mutation = {
operation: 'create',
data: {
name: 'John Doe',
email: 'john@example.com'
},
optimistic: true
};
const result = await query2jz.mutate(mutation, 'User');
query2jz.query(query, modelName)Execute a query against a model.
Parameters:
query (Query2jzQuery): The query objectmodelName (string): Name of the model to queryReturns: Promise
Query Structure:
interface Query2jzQuery {
select: Record<string, any>; // Fields to select
where?: Record<string, any>; // Filter conditions
orderBy?: Record<string, 'asc' | 'desc'>; // Sort order
limit?: number; // Limit results
offset?: number; // Skip results
live?: boolean; // Enable real-time updates
}
query2jz.mutate(mutation, modelName)Execute a mutation against a model.
Parameters:
mutation (Query2jzMutation): The mutation objectmodelName (string): Name of the model to mutateReturns: Promise
Mutation Structure:
interface Query2jzMutation {
operation: 'create' | 'update' | 'delete';
data: Record<string, any>;
where?: Record<string, any>; // For update/delete operations
optimistic?: boolean; // Enable optimistic updates
}
query2jz.subscribe(query, modelName, callback)Subscribe to real-time updates for a query.
Parameters:
query (Query2jzQuery): The query to subscribe tomodelName (string): Name of the modelcallback (function): Callback function for updatesReturns: string (subscription ID)
query2jz.unsubscribe(subscriptionId)Unsubscribe from real-time updates.
Parameters:
subscriptionId (string): The subscription IDquery2jz.generateTypes(outputDir?)Generate TypeScript types from your models.
Parameters:
outputDir (string, optional): Output directory for generated typesQuery-2jz supports multiple database types:
database: {
type: 'sqlite',
connection: './database.sqlite'
}
database: {
type: 'postgresql',
connection: {
host: 'localhost',
port: 5432,
database: 'mydb',
user: 'user',
password: 'password'
}
}
database: {
type: 'mysql',
connection: {
host: 'localhost',
port: 3306,
database: 'mydb',
user: 'user',
password: 'password'
}
}
database: {
type: 'mongodb',
connection: 'mongodb://localhost:27017/mydb'
}
Query-2jz is designed to run on edge functions with minimal cold starts:
// Enable edge mode
edge: {
enabled: true,
coldStartTimeout: 5000 // 5 seconds
}
query-2jz deploy --platform vercel
query-2jz deploy --platform cloudflare
module.exports = {
// Database configuration
database: {
type: 'postgresql',
connection: {
host: process.env.DB_HOST,
port: process.env.DB_PORT,
database: process.env.DB_NAME,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD
}
},
// Caching configuration
cache: {
type: 'redis',
connection: process.env.REDIS_URL,
ttl: 300 // 5 minutes
},
// Real-time configuration
realtime: {
enabled: true,
transport: 'websocket' // or 'sse'
},
// Edge configuration
edge: {
enabled: process.env.NODE_ENV === 'production',
coldStartTimeout: 5000
},
// Model definitions
models: [
// ... your models
]
};
Query-2jz is designed for high performance:
Compared to GraphQL implementations:
We welcome contributions! Please see our Contributing Guide for details.
git clone https://github.com/AchrefHASNI/Qyrn.git
cd Qyrn
npm install
npm run dev
MIT License - see LICENSE file for details.
Made with ❤️ by Achref Hasni
FAQs
Query-2jz: A GraphQL alternative with faster performance and simpler use
We found that query-2jz 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.