TreeFrog Framework : High-speed C++ MVC Framework for Web Application

Overview

Small but Powerful and Efficient

CircleCI TravisCI License Release Docker image

TreeFrog Framework is a high-speed and full-stack web application framework based on C++ and Qt, which supports HTTP and WebSocket protocol. Web applications can run faster than that of lightweight programming language. In application development, it provides an O/R mapping system and template system on an MVC architecture, aims to achieve high productivity through the policy of convention over configuration.

Features

  • High performance - Highly optimized Application server engine of C++
  • O/R mapping - Conceals complex and troublesome database accesses
  • Template system - ERB-like template engine adopted
  • Supports for many DB - MySQL, PostgreSQL, ODBC, SQLite, Oracle, DB2, InterBase, MongoDB and Redis.
  • WebSocket support - Providing full-duplex communications channels
  • Generator - Generates scaffolds and Makefiles automatically
  • Supports various response types - JSON, XML and CBOR
  • Cross-platform - Windows, macOS, Linux, etc. Write once, compile anywhere.
  • OSS - New BSD License

Requirements

TreeFrog uses the qt qmake build system.

Web Site

http://www.treefrogframework.org/

Releases

https://github.com/treefrogframework/treefrog-framework/releases

Documents

Get additional information: http://treefrogframework.github.io/treefrog-framework/

API Reference

http://api-reference.treefrogframework.org/annotated.html

Forum

Discussion group for TreeFrog Framework: https://groups.google.com/forum/#!forum/treefrogframework

Docker Images

https://hub.docker.com/r/treefrogframework/treefrog/

  $ docker pull treefrogframework/treefrog

MongoDB communication

TreeFrog Framework uses the 10gen-supported C driver to communicate with the MongoDB server. The source code of the driver is included in this package. See the README also.

Issues
  • Get real client IP address behind the reverse proxy

    Get real client IP address behind the reverse proxy

    I'm using the nginx server as a reverse proxy for Qt TreeFrog as described on this page:

    https://www.treefrogframework.org/en/user-guide/cooperation-with-the-reverse-proxy-server/

    The problem is that in this case the TActionController::clientAddress() and TWebSocketEndpoint::peerAddress() functions return the proxy address instead of the client's IP address.

    In nginx, you can add an X-Forwarded-For header containing the client's IP address:

    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    but unfortunately Qt TreeFrog does not have functionality similar to that of mod_remoteip Apache server:

    https://httpd.apache.org/docs/current/es/mod/mod_remoteip.html

    Would it be possible to add an option in the TreeFrog configuration to define the name of the HTTP header containing the client's original IP address (RemoteIPHeader) and the list of trusted proxy (RemoteIPTrustedProxy) ? The TActionController::clientAddress() function would return the client's IP address instead of the proxy IP address if the proxy is trusted.

    Thanks.

    opened by amiart 13
  • File session expire when browser sends multiple concurrent requests

    File session expire when browser sends multiple concurrent requests

    This happens when browser sends to treefrog multiple concurrent requests and each access session stored in file. One of the action threads try to write to file session, and another one reads session from the file at the same time.

    In treefrog.log there is ERROR: Failed to load a session from the file store, and then session id is regenerated.

    1

    In debugger QDataStream::status() returned QDataStream::ReadPastEnd

    2

    Please add QWriteLocker in TSessionFileStore::store() just before session in written, and QReadLocker in TSessionFileStore::find() - tried this and worked for me.

    Config: Windows 10 x64 Qt 5.9 +MSVC 2015 32bit TreeFrog 1.17.0

    application.ini: Session.StoreType=file Session.AutoIdRegeneration=false Session.LifeTime=0 Session.CookiePath=/ Session.GcProbability=100 Session.GcMaxLifeTime=1800

    opened by amiart 13
  • Fix parsing X-Forwarded-For header.

    Fix parsing X-Forwarded-For header.

    Fixes parsing of the header, and it is now possible to trust Unix domain socket proxy and proxy servers in a subnet.

    In nginx configuration (reverse proxy) add this line:

    proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
    

    In Treefrog configuration add these lines:

    EnableForwardedForHeader=true
    ParseForwardedForHeaderRecursively=false
    TrustedProxyServers="unix:; 192.168.0.10; 192.168.0.20"   # the value must be in quotes
    

    Fixes #285

    opened by amiart 11
  • Routing enhancements

    Routing enhancements

    Please review my changes carefully. Will recommend reviewing commit by commit, and using ?w=1 parameter to avoid seeing indentation changes as additions/removals.

    !!As I could not get master running correctly on my machine, I worked on top of 1.7.5. Will probably need some merging and conflict resolution, sorry!.

    My pull request:

    • fixes routing errors (a get or post route would accept any http verb, even invalid ones, not only the get and post). Same for match
    • added support for put, patch, delete routes and http verbs
    • when adding a rule both /rule and /rule/ was added to the routing list, removed that doubling and now appending the '/' when the incoming requests don't have it.
    • fixes a debug output message
    • now returning 404 instead of 400 in some cases when there is no actual route match.
      • Rails-like support for put, patch, delete. Browsers are incapable of sending anything other than get and post. Rails overcame this shortcoming by reserving the "method" parameter, and when present overriding the incoming verb with it.

    Todo: update documentation about support for put, patch, delete

    opened by axos88 10
  • Add OTHER_FILES erb/html/otm files in views/_src/_src.pro

    Add OTHER_FILES erb/html/otm files in views/_src/_src.pro

    Currently, in Qt creator, the views (erb/html/otm)files doesn't list in the project, so we need to go to these folders then open them. when coding, if we write controller and write views at the same time, change selected view files, it became so inconvenience.

    opened by hks2002 9
  • TSmtpMailer: Prevent STRIPTLS attacks

    TSmtpMailer: Prevent STRIPTLS attacks

    The STARTTLS in TSmtpMailer class is vulnerable to STRIPTLS attacks.

    According to Wikipedia: https://en.wikipedia.org/wiki/Opportunistic_TLS

    Because the initial handshake takes place in plain text, an attacker in control of the network can modify the server messages via a man-in-the-middle attack to make it appear that TLS is unavailable (called a STRIPTLS attack). Most SMTP clients will then send the email and possibly passwords in plain text, often with no notification to the user. ... STRIPTLS attacks can be blocked by configuring SMTP clients to require TLS for outgoing connections (for example, the Exim Message transfer agent can require TLS via the directive "hosts_require_tls")

    The solution is to add a new parameter in application.ini:

    ActionMailer.smtp.EnableSTARTTLS=true ActionMailer.smtp.RequireTLS=true # <-- new parameter (default false)

    arnd then check it in tsmtpmailer.cpp before line 170:

    if (requireTls && !tlsEnable) {
         tSystemError("STARTTLS not enabled");
         cmdQuit();
         return false;
    }
    
    if (requireTls && !tlsAvailable) {
        tSystemError("The mail server does not support TLS");
        cmdQuit();
        return false;
    }
    
    if (tlsEnable && tlsAvailable) {
        if (!cmdStartTls()) {
            cmdQuit();
            return false;
        }
    }
    
    opened by amiart 8
  • configure with --enable-mongo not available in macOS

    configure with --enable-mongo not available in macOS

    Following the guide: http://www.treefrogframework.org/en/user-guide/model/access-mongodb.html

    The --enable-mongo option its not available in treefrog in the macOS Mojave. I'm using the 1.23.0 version of treefrog.

    I used the --enable-shared-mongoc option instead, but after changing the .ini files to set the database to my localhost the command tspawn --show-collections in my project folder show me the error:

    DatabaseName: databaseName HostName: localhost MongoDB opened successfully Segmentation fault: 11

    How can I find more informations about the error?

    opened by rafiqueud 8
  • All helper header auto included in to each view source file.

    All helper header auto included in to each view source file.

    tmake auto include all helper header to all views source file. Even all validators, one validator is normally used for one form. maybe let developer manually include these helper headers as required is better.

    opened by hks2002 7
  • SELECT * FROM user problem in PostgreSQL

    SELECT * FROM user problem in PostgreSQL

    ORM generated SQL command like SELECT * FROM user won't fetch data from user table in PostgreSQL. It must be SELECT * FROM "user" (quoted table name).

    opened by whitglint 7
  • added support for ARM

    added support for ARM

    Adding support for ARM.

    Now it seems to be compiling on the Raspberry PI, and the basic tutorial is running fine. I've not got the knowledge yet where this code would actually be used, so it's not tested thouroughly.

    Why isn't perftools used as a git submodule btw? The support for ARM is already out there, but the source files here are outdated.

    opened by axos88 7
  • Feature: Show a list of running projects

    Feature: Show a list of running projects

    Suggestion command: treefrog -l

    When I type 'treefrog -l' command, I'll get something like this:

    2 projects running: * /home/account/project1 + url: http://localhost:8800/project1/index * /home/account/project2 + url: http://localhost:8801/project2/index

    Sorry my bad english!

    opened by tienvx 7
  • LZ4 build failed

    LZ4 build failed

    Hello,

    i'm trying to build the framework.

    This appears during build.bat script :


    1>------ Début de la regénération globale : Projet : liblz4, Configuration : Release x64 ------ 1>lz4.c 1>lz4frame.c 1>lz4hc.c 1>xxhash.c 1>liblz4.vcxproj -> C:\Program Files (x86)\TreeFrog\treefrog-framework-2.3.1\3rdparty\lz4\build\VS2017\bin\x64_Release\liblz4_static.lib c:\program files (x86)\treefrog\treefrog-framework-2.3.1\3rdparty\lz4\lib\lz4.c(489): warning C6385: Lecture de données non valides depuis 'v' : la taille lisible est '_Old_4`2' octets, mais '4' octets sont peut-être lus. 1>Nombre de paramètres non valide 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: La commande "xcopy /Y C:\Program Files (x86)\TreeFrog\treefrog-framework-2.3.1\3rdparty\lz4\build\VS2017\bin\x64_Release\liblz4_static.lib C:\Program Files (x86)\TreeFrog\treefrog-framework-2.3.1\3rdparty\lz4\build\VS2017\bin\x64_Release...... 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: :VCEnd" s'est arrêtée avec le code 4. 1>Génération du projet "liblz4.vcxproj" terminée -- ÉCHEC. ========== Regénération globale : 0 a réussi, 1 a échoué, 0 a été ignoré ==========

    1>------ Début de la génération : Projet : liblz4, Configuration : Release x64 ------ 1>liblz4.vcxproj -> C:\Program Files (x86)\TreeFrog\treefrog-framework-2.3.1\3rdparty\lz4\build\VS2017\bin\x64_Release\liblz4_static.lib 1>Nombre de paramètres non valide 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: La commande "xcopy /Y C:\Program Files (x86)\TreeFrog\treefrog-framework-2.3.1\3rdparty\lz4\build\VS2017\bin\x64_Release\liblz4_static.lib C:\Program Files (x86)\TreeFrog\treefrog-framework-2.3.1\3rdparty\lz4\build\VS2017\bin\x64_Release...... 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: :VCEnd" s'est arrêtée avec le code 4. 1>Génération du projet "liblz4.vcxproj" terminée -- ÉCHEC. ========== Génération : 0 a réussi, 1 a échoué, 0 à jour, 0 a été ignoré ==========

    Build failed. LZ4 not available.

    Compilation Error!!!


    This talk about nb of parameters not good

    Ty for your help.

    opened by Llugway 1
Releases(v2.3.1)
Your high performance web application C framework

facil.io is a C micro-framework for web applications. facil.io includes: A fast HTTP/1.1 and Websocket static file + application server. Support for c

Bo 1.6k Aug 2, 2022
Tntnet is a web application server for web applications written in C++.

Tntnet is a web application server for web applications written in C++.

Tommi Mäkitalo 71 Jul 28, 2022
Drogon: A C++14/17 based HTTP web application framework running on Linux/macOS/Unix/Windows

English | 简体中文 | 繁體中文 Overview Drogon is a C++14/17-based HTTP application framework. Drogon can be used to easily build various types of web applicat

An Tao 7.7k Aug 4, 2022
CppCMS - High Performance C++ Web Framework

CppCMS - High Performance C++ Web Framework What is CppCMS? CppCMS is a Free High Performance Web Development Framework (not a CMS) aimed at Rapid Web

Artyom Beilis 364 Jul 20, 2022
A high performance, middleware oriented C++14 http web framework please use matt-42/lithium instead

A high performance, middleware oriented C++14 http web framework please use matt-42/lithium instead

Matthieu Garrigues 1.7k Jul 22, 2022
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.

Cutelyst - The Qt Web Framework A Web Framework built on top of Qt, using the simple and elegant approach of Catalyst (Perl) framework. Qt's meta obje

Cutelyst 779 Jul 30, 2022
Crow is very fast and easy to use C++ micro web framework (inspired by Python Flask)

Crow is C++ microframework for web. (inspired by Python Flask) #include "crow.h" int main() { crow::SimpleApp app; CROW_ROUTE(app, "/")([]()

Jaeseung Ha 6.9k Aug 2, 2022
QDjango, a Qt-based C++ web framework

QDjango - a Qt-based C++ web framework Copyright (c) 2010-2015 Jeremy Lainé About QDjango is a web framework written in C++ and built on top of the Qt

Jeremy Lainé 245 Aug 5, 2022
This is a proof-of-concept of a modern C web-framework that compiles to WASM and is used for building user interfaces.

DanCing Web ?? ?? (DCW) Getting Started Dancing Web is now distributed with the Tarantella Package Manager — a tool I've made to simplify setup of pro

Danilo Chiarlone 3 Sep 11, 2021
C++ application development framework, to help developers create and deploy applications quickly and simply

ULib - C++ library Travis CI: Coverity Scan: ULib is a highly optimized class framework for writing C++ applications. I wrote this framework as my too

stefano casazza 950 Jul 27, 2022
The application framework for developer module of EdgeGallery platform

crane-framework crane-framework将可复用的计算和软件功能抽象成插件,APP开发者面向使用插件进行MEC APP开发。这样屏蔽了和MEC平台交互的细节,实现MCE APP和MEC平台的松耦合。而且插件框架基础能力可裁剪,按需提供最小的APP系统。 特性介绍 为了方便开发者

EdgeGallery 21 Aug 30, 2021
Embedded C/C++ web server

CivetWeb The official home of CivetWeb is https://github.com/civetweb/civetweb Continuous integration for Linux and macOS (Travis CI): Continuous inte

null 2.1k Jul 30, 2022
C library to create simple HTTP servers and Web Applications.

Onion http server library Travis status Coverity status Onion is a C library to create simple HTTP servers and Web Applications. master the developmen

David Moreno Montero 1.9k Jul 28, 2022
A C++11 RESTful web server library

Served Overview Served is a C++ library for building high performance RESTful web servers. Served builds upon Boost.ASIO to provide a simple API for d

Meltwater 692 Jul 24, 2022
cserv is an event-driven and non-blocking web server

cserv is an event-driven and non-blocking web server. It ideally has one worker process per cpu or processor core, and each one is capable of handling thousands of incoming network connections per worker. There is no need to create new threads or processes for each connection.

null 41 Jul 2, 2022
Experimental, scalable, high performance HTTP server

Lwan Web Server Lwan is a high-performance & scalable web server. The project web site contains more details. Build status OS Arch Release Debug Stati

Leandro A. F. Pereira 5.6k Aug 3, 2022
A high-performance REST Toolkit written in C++

Pistache Pistache is a modern and elegant HTTP and REST framework for C++. It is entirely written in pure-C++14 and provides a clear and pleasant API.

null 2.7k Aug 3, 2022
Cetus is a high performance, stable, protocol aware proxy for MySQL Group Replication.

Introduction Cetus is a high performance, stable, protocol aware proxy for MySQL Group Replication. Getting started 1. Prerequisites cmake gcc glib2-d

null 36 Jun 12, 2022