Web Development Backend Using Clojure / ClojureScript

I am familiar with the development of desktop applications in Clojure (written multithreaded interactive visualization system). However, I'm pretty new to web development using Clojure.

I plan to use Clojure on the server to handle the logic; and ClojureScript for working on the client side. However, I do not know what to use for my database server. Should I use something like Monogodb? or hadoop? Or....?

An application is a very simple application; basic forum. The total number of concurrent users will be <100 at a given time. For me, the ability to easily backup / reconcile data is important - it is very important for me that I can easily make daily backups (and not lose all the data.)

Thanks!

+6
source share
3 answers

You can use many databases; if the database has an API for Java, you should be good to go. MySQL , MongoDB , Postgres , Hadoop ... and more.

For a good overview of the web page in Clojure, check out the brehaut section of this article .

For quick and quick launch with Clojure and ClojureScript, try ClojureScriptOne .

There are many ways to write what you want to write; If you are already familiar with Clojure, this should not be too complicated.

+5
source

I haven't used it myself, but Datomic ( http://datomic.com/ ) is great for anyone coming from Clojure.

+5
source

Datomic is a terrific database and I highly recommend it. It has many functions that distinguish it from other database systems:

  • Like Clojure's data structures, it is persistent, which means that by default adding new facts to the database does not remove old facts, which allows you to query the state of the database at a previous point in time, extends the audit capabilities and helps in debugging.,
  • The basic Entity Attribute Value (EAV / triple) data model (at least partially inspired by RDF and the semantic network) is extremely flexible, allowing you to express arbitrary graph structures and easily deal with polymorphism.
  • The query language is a kind of Datalog, a kind of query language based on pattern matching, which is strictly more expressive than SQL, and the like in that it can perform recursive queries, which makes it especially suitable for working with graphic data / queries.
  • In addition to the Datalog queries, there are pull api that allow you to retrieve data from the database more simply using GraphQL as an expression that defines the shape of the document, the structure you want to pull from the database. These queries can even be used from a sentence :find a Datalog query.
  • You can use the Clojure functions from your queries.
  • The indexing system is very smart and more or less automatic, which contrasts sharply with the work usually done to tune the performance of SQL databases.
  • Transactions pass through an API / function call other than requests, which means that the number one security risk identified by OWASP (SQL injection) is literally impossible in Datomic.
  • The Transactor / read-replica design makes it easy to scale read / query operations while maintaining pressure on Transactor.
  • This is damn fun.

One of the things you should pay attention to is that by using the EAV data model and data queries / data queries, Datomic gets structural flexibility closer to the NoSQL database flexibility, while remaining fundamentally relational and even more expressive in their relational queries. than SQL.

This is amazing, and you should definitely give him a chance. It will melt your brain a little. In a good way.

It is also worth noting that its popularity was inspired by a number of successful open source projects, so the main approach will not go anywhere in the near future:

  • DataScript: partial in-memory implementation of clj / cljs
  • Datahike: A fork of DataScript that requests disk indexes, which means you don't need to store everything in memory for the request
  • Mentat: Mozilla project is trying to make Datomic-like for Mozilla project
0
source

Source: https://habr.com/ru/post/913180/


All Articles