Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Clojure
  3. Specql

Specql

MITClojure

A Clojure library that introspects PostgreSQL databases at compile time to generate clojure.spec definitions and automate CRUD queries.

Visit WebsiteGitHubGitHub
135 stars10 forks0 contributors

What is Specql?

Specql is a Clojure library that automates PostgreSQL CRUD queries by introspecting database schemas at compile time. It generates clojure.spec definitions for tables and columns, enabling type-safe queries with minimal boilerplate. The library simplifies common database operations while integrating seamlessly with Clojure's spec system for data validation.

Target Audience

Clojure developers building applications with PostgreSQL who want type-safe database interactions and reduced query boilerplate. It's particularly useful for teams leveraging clojure.spec for data validation and seeking compile-time database schema integration.

Value Proposition

Developers choose Specql for its automatic spec generation and type-safe querying, which eliminates manual schema definition and reduces runtime errors. Its focus on common CRUD operations while deferring complex queries to SQL provides a pragmatic balance between automation and flexibility.

Overview

Automatic PostgreSQL CRUD queries

Use Cases

Best For

  • Reducing boilerplate code for PostgreSQL CRUD operations in Clojure
  • Ensuring type safety in database queries using clojure.spec
  • Automating schema introspection and spec generation at compile time
  • Working with PostgreSQL composite types and user-defined records
  • Integrating database views and materialized views into Clojure applications
  • Simplifying data validation and integrity in Clojure-PostgreSQL projects

Not Ideal For

  • Projects requiring complex SQL queries with multiple joins and advanced reporting
  • Teams using databases other than PostgreSQL or needing cross-database compatibility
  • Applications with highly dynamic schemas that change frequently without recompilation
  • Environments where compile-time database access is impractical or restricted

Pros & Cons

Pros

Automatic Spec Generation

Introspects PostgreSQL schemas at compile time to create clojure.spec definitions for tables and columns, eliminating manual boilerplate as shown in the usage example.

Type-Safe Queries

Uses namespaced keywords for columns, ensuring query correctness and leveraging Clojure's spec system for validation, reducing runtime errors.

Composite Type Support

Unpacks PostgreSQL user-defined types and arrays into nested Clojure maps, handling complex data structures seamlessly, as highlighted in the key features.

View Integration

Works with database views and materialized views just like tables, allowing complex queries to be abstracted and used via specql, as mentioned in the philosophy section.

Cons

PostgreSQL-Only

Limited to PostgreSQL databases with no support for other SQL systems, reducing flexibility for multi-database projects.

Compile-Time Schema Dependency

Requires a live database connection at compile time for introspection, which can complicate build processes and CI/CD pipelines, though caching is available.

Alpha Stability Concerns

Marked as 'work in progress' with frequent alpha releases and breaking changes in the version history, indicating potential instability for production use.

Frequently Asked Questions

Quick Stats

Stars135
Forks10
Contributors0
Open Issues10
Last commit1 year ago
CreatedSince 2017

Tags

#clojure-spec#query-builder#crud#database#library#postgresql#clojure#jdbc#type-safe#sql

Built With

C
Clojure
P
PostgreSQL

Links & Resources

Website

Included in

Clojure2.8k
Auto-fetched 18 hours ago

Related Projects

honeysqlhoneysql

Turn Clojure data structures into SQL

Stars1,905
Forks174
Last commit1 day ago
KormaKorma

Tasty SQL for Clojure.

Stars1,470
Forks217
Last commit5 years ago
ToucanToucan

A classy high-level Clojure library for defining application models and retrieving them from a DB

Stars573
Forks48
Last commit2 years ago
WalkableWalkable

A Clojure(script) SQL library for building APIs: Datomic® (GraphQL-ish) pull syntax, data driven configuration, dynamic filtering with relations in mind

Stars452
Forks15
Last commit4 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub