Cutelyst the Qt/C++ Web Framework just got it’s first version released!

Three months ago Custelyst was started,

it was somehow a proof of concept to see if I could build something that could be used in the real world, but the more I progressed on getting all the pieces together the happier with the overall result I got. And the initial result is here today!

I have made a few benchmarks comparing some simple pages delivery using Django (python) and Perl Catalyst, and overall the time to first byte was around 3 times faster than both, comparing RAM usage it was like 2MB vs 50MB from the Perl version and 20MB of the Python one, the CPU time was also much smaller if compared to both which probably means it could handle more requests, but this isn’t a completely fair benchmark (as always) because there are several other things to measure…

Below I’ll try to clarify some doubts raised from my last post and what makes this new Web Framework unique:

But there is already QDjango and Tufao…

I didn’t know about these ones when I first started Cutelyst, but after taking a look at them, both misses a templating system (or integration with one), I also didn’t like the way one would register actions to be dispatched, IMO the way it’s done in Cutelyst is easier and nicer. And they doesn’t count with WSGI integration, they have their own HTTP parser/server. I also didn’t like looking at code 😛

Why not DJango or any other well established framework out there?….

Apart from QDjango and Tufao there are no other (AFAIK) Qt based frameworks, there are indeed some C++ ones that I knew before but I didn’t like the way of doing things there, in fact when I started with Perl Catalyst I really liked how it was written. So in short I don’t know well enough other languages and I have no plans wasting my time learning other languages, I’d rather try to master at least one (although I know I’m far from it).

What’s in this release?

  • Glad you asked (duh!)
  • Production ready integration with uWSGI, meaning Cutelyst has a uWSGI plugin that will load your application (which will also be a plugin), and thus thanks to uWSGI it will have out of the box support for FastCGI, HTTP(s), uWSGI (protocol) and probably some other.
  • ClearSilver templates integration, this templating system is written in C and it’s amazingly fast, but it’s also incredible limited to what you can do in the view.
  • Grantlee (Django) templates integration, it’s used in KDE PIM to allow for easy templating of HTML, it’s slower than ClearSilver but offers much more fexibilities on your views, and since it’s also written in Qt the introspection comes for free.
  • Complete Path dispatcher, which means if you Port a Perl Catalyst Application that was using Path actions it will work as expected. This dispatcher matches an url to a Q_INVOKABLE method depending on it’s signature, The Catalyst Chained dispatcher is not implemented yet.
  • Session plugin, easy to use way of persisting data across requests, right now it’s done with a QSettings file, but integration with Redis and MongoDB are planned.
  • Authentication plugin, allowing you to authenticate your users using different Realms/stores, currently a StoreMinimal is implemented which can be used mostly for testing purposes (ie on the code you add your users)
  • StaticSimple plugin, allows for serving static content reducing the complexity of serving static content while developing your app.

If you are concerned about API/ABI stability I don’t promise it just right now it’s almost stable, probably 0.2 or 0.3 versions will have a promised stable API.

And yes, I have just put it on production http://serial.igloobox.com.br is running it right now (but the site is user restricted).

My plans now is to setup cutelyst.org with docs and examples, as well as writing a web blog, bug tracker and wiki based on it.

Have fun!

Download

Cutelyst the Qt/C++ Web Framework just got it’s first version released!

19 thoughts on “Cutelyst the Qt/C++ Web Framework just got it’s first version released!

  1. plaristote says:

    Fuuuu- ! I was doing exactly that in C++/Boost using the new http-netlib (https://github.com/Plaristote/crails) ! Now my work is completely irrelevant ! I knew I should’ve went for Qt instead ! At least we’d have stuff to share (though maybe we still do ? I’ll have to take a look) !

    One of the things that directed me to Boost is that MongoDB already uses it, and having both Qt and Boost as dependencies somehow puts me off. What are you planning for database integrations ?

    I’m more of a Ruby on Rails developer, and your description doesn’t talk to me much (I guess lots of stuff would only speak to people who know Catalyst). But I seem to see that you don’t handle cache ? Any plans for doing that ?

    And on database integration, are you going to implement fields and relations in a similar fashion than Rails ?

    1. dantti says:

      Regarding DB you have Qt SQL with many drivers, and if you want an ORM you have QxORM and ODB, I haven’t used them but the latter seems to be a better option. So I don’t want to reinvent the whell 😛

      How do you mean by handling cache?

      And on the last question I think you can just use any of the Qt ORM, or another one as long you can export the data in a way the views can handle.

      In Cutelyst there is not a single way of doing things, actually there are lot’s of ways to do the same, what you get is pretty much a way to deal with the requests and some helper functions to easy the development of common tasks. And yes if you feel there is something in CRails that could be added to it just poke me 🙂

      1. plaristote says:

        I was curious about the nosql database. One thing that quickly sent me away from Qt when I started Crails is that there seem to be very little support for nosql databases in Qt. Plus the MongoDB driver uses Boost… and having both Boost and Qt in a single framework feels wrong. Then again, there probably are drivers that aren’t based on Boost, but I have yet to find them.

        The ORMs provide good interfaces, but no facilities to make models out of it (to the best of my knowledge). Things such as simply writing:
        has rootname => (isa => ‘Str’, is => ‘rw’, required => 0);
        or
        field :rootname, type: String
        In your model to get a corresponding field in a SQL table that your framework automatically generated (from a migration, or simply from deducing it from the code).

        It’s a pretty cool feature and my co-workers used to tell me that such a thing wasn’t doable in C++. At its start, Crails was merely me trying (and succedding ^^) to prove them wrong.
        But the truth is, I never saw anyone do something of the like, and I’m curious to see if there are other ways to implement something like that (maybe without some of the messy macros I had to write). Or if existing libraries already provide such features.

        About the cache, I was a quite vague indeed. I was thinking of solutions such as memcached/dalli, something my latest employer used in his Ruby applications: a way to get a transparent cache for the most heavy database queries.
        Now that I think about it though, it seems like something the ORM should implement, rather than Cutelyst.

      2. dantti says:

        Afaik there is none nosql support in Qt, one would need to write classes for them, but I have to disagree about Qt and Boost, I know lots of people that use them both in some big projects.
        BTW a quick look on mongoDB: you have C++ and pure C drivers so if you go with C you don’t have boost 🙂

        About the ORM I’ll tell you something that I have in mind for another thing, there is something in Perl called FormFu, it’s not the best thing in the world but it helps getting stuff done, so I sort of missed it for validating forms, and then I thought if I could use QML with it, then I would be much better served. I don’t know yet how to do that in QML (for GUI-less stuff), but surely you could also have this awesomeness of QML for an ORM too.

        Maybe if you wish you could create an ORM on top of QML and instead of continuing CRails you use it with Cutelyst would be an awesome match 😀

    1. dantti says:

      Sure, I want to port MojoMojo to Cutelyst and setup a wiki.cutelyst.org with more information. I also have to setup the website, it’s just that I have loads of things to do, have to fix packagekit-qt, port my company website to Cutelyst and so on, about Catalyst::Plugin::Prototype I have never used it nor I have much idea what it does/ how it works, but if useful it can be ported too 🙂
      Yes, I know about Wt, but for some reason I don’t much like the way it works, I really enjoyed doing apps in Catalyst but debugging a language you aren’t very familiar with isn’t cool 😛

      1. infoctopus says:

        I studied Wt and generally I like it (4 out of 5 stars in my very humble opinion). I have questions, e.g. why it has no indices in DB for fields participating in a search query (for surrogate primary keys case). But generally it looks ok. As long as a developer knows javascript well in order to minimize server requests, and css for a nice look. Wt’s footprint is tiny, so it’s well demanded in embedded systems.

        So, a C++ developer could want to totally avoid javascript coding, and also HTML/CSS/JavaScript browser compatibility issues handling

      2. dantti says:

        Sorry, I have no idea of what are you talking about DB 😛 is that about Wt? If so I don’t know it.

        Regarding Cutelyst it’s not intended at all to remove the need for writting CSS/HTML/JS whatever, it just let’s you handle HTTP requests with Qt classes and using some nice dispatcher classes.

      3. infoctopus says:

        yes, the DB stuff was about Wt. Nice dispatcher classes would be definitely great. Especially if people would understand why and how they’re better than competitors listed in your post and also treefrog framework from comments. And also this one: CPPSP http://xa.us.to/cppsp/index.cppsp – it demonstrates very good benchmark results

    1. dantti says:

      This week I have put the API docs on http://cutelyst.org, also if you download the source there is a “server” example application, I’m about to write a web blog in cutelyst so that I can put more content and examples about it.

Leave a comment