Configuration
Learn how to configure Query-2jz for your specific needs and environment.
Database Configuration
Configure your database connection and settings.
SQLite (Development)
Perfect for development and small applications
{
"database": {
"type": "sqlite",
"connection": "./database.sqlite",
"pool": {
"min": 1,
"max": 5
}
}
}PostgreSQL (Production)
Recommended for production applications
{
"database": {
"type": "postgresql",
"connection": "postgresql://user:pass@localhost:5432/db",
"pool": {
"min": 2,
"max": 20,
"idleTimeoutMillis": 30000,
"connectionTimeoutMillis": 2000
},
"ssl": {
"rejectUnauthorized": false
},
"timezone": "UTC"
}
}MySQL
Great for web applications
{
"database": {
"type": "mysql",
"connection": {
"host": "localhost",
"port": 3306,
"user": "root",
"password": "password",
"database": "myapp",
"charset": "utf8mb4"
},
"pool": {
"min": 2,
"max": 10
}
}
}MongoDB
Perfect for document-based applications
{
"database": {
"type": "mongodb",
"connection": "mongodb://localhost:27017/myapp",
"options": {
"useNewUrlParser": true,
"useUnifiedTopology": true,
"maxPoolSize": 10,
"serverSelectionTimeoutMS": 5000,
"socketTimeoutMS": 45000
}
}
}Environment Variables
Use environment variables for sensitive configuration data.
# .env
DATABASE_URL=postgresql://user:pass@localhost:5432/db
REDIS_URL=redis://localhost:6379
JWT_SECRET=your-secret-key
NODE_ENV=production
# query-2jz.config.js
module.exports = {
database: {
type: 'postgresql',
connection: process.env.DATABASE_URL
},
cache: {
type: 'redis',
connection: process.env.REDIS_URL
},
security: {
auth: {
secret: process.env.JWT_SECRET
}
}
}Configuration Validation
Query-2jz automatically validates your configuration and provides helpful error messages.
Validation Features
- • Database connection validation
- • Model schema validation
- • Required field checking
- • Type compatibility validation
- • Security configuration validation
Error Handling
- • Clear error messages
- • Configuration suggestions
- • Environment-specific warnings
- • Performance recommendations
- • Security best practices