README
A high-performance, type-safe ORM for Crystal applications.
Build fast, reliable database applications with compile-time safety and exceptional performance.
What Makes CQL Special?
CQL brings compile-time safety and performance optimization to Crystal applications. Unlike traditional ORMs that check for errors at runtime, CQL validates your queries, relationships, and data access patterns before your code executes.
# Type-safe queries that catch errors at compile time
users = User.where(active: true) # Type checked
.order(created_at: :desc) # Validates column exists
.limit(10) # Validates parameter type
.all
# This would fail at COMPILE TIME, not runtime:
# User.where(nonexistent: true) # Compile error!
# User.where(age: "invalid") # Type mismatch caught early!Key Features & Benefits
Performance Optimized
Zero-allocation queries through Crystal's compile-time optimizations
Connection pooling built-in for high-concurrency applications
Query caching with multiple cache backends (Memory, Redis)
N+1 query detection and performance monitoring tools
Type Safety at Compile Time
Catch bugs early - invalid queries fail at compile time
Full IDE support with autocompletion and refactoring
Relationship safety - no more runtime association errors
Query validation - SQL structure validated before deployment
Developer Experience
ActiveRecord-style API - familiar patterns for Rails developers
Automatic schema management - migrations with rollback support
Rich query DSL - expressive and readable database queries
Built-in validations - data integrity without boilerplate
Production Ready
PostgreSQL, MySQL, SQLite support through Crystal DB drivers
Transaction management with rollback safety
Performance monitoring and query analysis tools
Multiple design patterns - Active Record, Repository, Data Mapper support
Quick Start
Get up and running in under 5 minutes:
Try CQL Interactively
Explore CQL features with our interactive examples runner:
Choose from organized categories:
Basic Examples - Simple caching and core concepts
Advanced Caching - Enterprise-grade caching patterns
Configuration - Environment setup and best practices
Migrations - Database schema evolution
Performance - Monitoring and optimization
Framework Integration - Web framework examples
Complete Blog App - Full-featured application demo
1. Add to Your Project
2. Define Your Schema
3. Create Your First Model
4. Start Building
Database Support
Supported databases with their Crystal DB drivers:
PostgreSQL
pg
postgres://user:pass@localhost/mydb
MySQL
mysql
mysql://user:pass@localhost/mydb
SQLite
sqlite3
sqlite3://./database.db
Advanced Features
Relationships Made Simple
Powerful Query DSL
Automatic Schema Management
Built-in Validations
Why Choose CQL?
For High-Performance Applications
APIs serving high request volumes
Real-time applications requiring low latency
Data-intensive processing applications
Microservices architecture
For Enterprise Development
Large team collaboration with type safety
Long-term maintenance requirements
Complex business logic with data integrity
Compliance and audit requirements
For Modern Development
Type-safe development practices
DevOps and CI/CD pipeline integration
Container-based deployment strategies
Cloud-native architecture patterns
Complete Documentation
Getting Started
New to CQL?
Migrating?
Interactive Examples (crystal examples/run_examples.cr)
Core Features
Foundation
Active Record
Advanced
Quick Reference
I want to...
Go to...
Set up a new project
Build complex queries
Handle database changes
Deploy to production
Ready to Get Started?
Try Interactive Examples → • Start with Installation →
Built with Crystal's performance and safety in mind.
All examples are tested with the latest CQL version.
Documentation • Examples • FAQ • Issues
Last updated
Was this helpful?