Clojure in production: what do we use in real-world services?

Andrey Fadeev
11 Aug 202319:02

Summary

TLDRIn this informative video, Andre shares valuable insights on essential Clojure libraries for production environments, drawing from his extensive experience as a developer. He discusses the advantages of using deps.edn for dependency management and recommends libraries for component management, HTTP server setup, database interaction, and schema validation. Emphasizing a cautious approach to library selection, he highlights the importance of understanding the functionality of tools like Component, HoneySQL, and clj-http. This guide serves as a practical resource for beginners embarking on their Clojure journey, helping them navigate the library ecosystem effectively.

Takeaways

  • 😀 Andre recommends starting with a combination of libraries instead of relying solely on web frameworks when beginning with Clojure.
  • 📦 For managing project dependencies, Andre suggests using **deps.edn** for new projects due to its rising popularity over **Leiningen**.
  • ⚙️ To manage application components, avoid using **Mount**, which can lead to poor code practices; instead, opt for **Component** or **Integrant**.
  • 🔧 The **Env** library is recommended for configuration management, offering a good balance of features and simplicity.
  • 🌐 **Jetty** is suggested as a base for HTTP servers, with routing libraries like **Ring** and **Pedestal** also being viable options.
  • 🚫 Andre cautions against using **HTTP Kit** due to its limitations with monitoring tools and distributed tracing.
  • 📞 For making HTTP requests, **clj-http** is favored for its comprehensive feature set, while the built-in Java HTTP client is suitable for Java 11 users.
  • 🗄️ **next.jdbc** is the standard library for JDBC interactions, and **HikariCP** is recommended for efficient connection pooling.
  • 📜 For SQL queries, Andre compares **HoneySQL** and **HugSQL**, both widely used for building SQL in Clojure.
  • ✅ In terms of schema and validation, options like **Schema**, **Clojure Spec**, and **Malli** are available, each with its own advantages.
  • 🛠️ **Claypool** is highlighted for parallel task execution, while **cljfmt** and **clj-conda** are essential tools for maintaining code quality.
  • 🎉 **Babashka** is recommended for scripting in Clojure, especially for CI pipelines, offering a modern alternative to traditional scripting.

Q & A

  • What is the primary purpose of the video?

    -The video aims to discuss the libraries used in production with Clojure, providing guidance for beginners on which libraries to choose for their projects.

  • What are the two options for project setup mentioned by Andre?

    -Andre discusses using 'Leiningen' and 'deps.edn' for managing projects, recommending 'deps.edn' for new projects due to its rising popularity.

  • What does Andre recommend for managing components in larger applications?

    -For larger applications, Andre recommends using libraries like 'Component' or 'Integrant' to manage the start and stop logic of different parts of the system.

  • Why does Andre not recommend the 'Configurator' library?

    -Andre finds the 'Configurator' library adds unnecessary features and complexity, suggesting that for simpler configurations, using Clojure's built-in 'get' function is sufficient.

  • Which HTTP server library does Andre primarily use?

    -Andre primarily uses 'Jetty' as the base for HTTP servers, along with libraries such as 'Ring' and 'Pedestal' for additional functionality.

  • What are the advantages of using 'clj-http' for HTTP requests?

    -'clj-http' utilizes Apache's HTTP client, providing numerous features and reliability, making it a popular choice for making HTTP requests in production.

  • What are the two libraries Andre mentions for writing SQL queries?

    -Andre discusses 'HoneySQL' and 'HugSQL' as two libraries for writing SQL queries, each with different approaches to managing SQL in Clojure.

  • What schema validation libraries does Andre recommend?

    -Andre recommends three libraries for schema validation: 'Schema' for its ease of use, 'Clojure Spec' for being part of Clojure, and 'Malli' for positive user feedback.

  • What caution does Andre provide regarding the use of 'Chorus'?

    -Andre advises careful consideration before using 'Chorus' because it can lead to over-engineering if not necessary.

  • Which tools does Andre suggest for maintaining code quality?

    -Andre suggests using 'clj-fmt' for consistent code formatting and 'clj-conda' as a linter to maintain code quality across projects.

Outlines

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Mindmap

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Keywords

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Highlights

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Transcripts

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now
Rate This

5.0 / 5 (0 votes)

Related Tags
Clojure LibrariesProduction ToolsSoftware DevelopmentBeginner FriendlyCoding InsightsDependency ManagementConfiguration OptionsComponent ManagementDatabase InteractionHTTP Services