Vely logo Empower C
install     tutorials     examples     documentation     license     about

11.0.11 released on Jul 25, 2022

Welcome to Vely



Vely is an embedded programming language with C as a host language. It is also a thin C-based application development framework.

Vely works by precompiling Vely statements into C, creating native executables. These statements cover web, database, strings, files, flow and execution, encoding/encryption, time, error handling, daemon-izing code, and other common tasks (see documentation).

Vely empowers C with rich features, simplicity and enhanced safety. It is general-purpose and well-suited for web applications.

Use Vely to rapidly develop high-performance and low-footprint native applications without interpreters or byte-code schemes. More on why Vely.

Run hello world in minutes.

Vely is about the performance of C, writing far less and simpler code, and a gentle learning curve. An example of that (query database, save to file, display web page):
void list_employees() {
    out-header default
    @<html><body>

    char *header = make_header(); // write any C code
    p-out header

    // Create report in outmsg string and fill it with database query result
    write-string define outmsg
        // Get data from the database
        run-query#get_emp@db="select name, salary from employees order by name" output name, salary
            @Name: <<query-result#get_emp, name>>
            @<br/>
            @Salary: <<query-result#get_emp, salary>>
            @<br/><br/>
        end-query
    end-write-string

    // Write report to a file and then to the client
    write-file "employees" from outmsg status define st
    if (st<0) {
        @Error in writing file (<<pf-out "%lld", st>>)
        exit-request
    } else {
        p-out outmsg
    }
    @</body></html>
}

Highlighted with Vely's syntax_highlighting using 2html.

Using Vely


From the same Vely code, you can create both web application servers (daemons) and console applications (command_line programs).

Easily use databases (MariaDB, PostgreSQL, SQLite) and write back-end for web applications with a FastCGI server. Run the same code on command line.

It comes with automatic memory management and garbage collection.

You can use Vely for web applications, command-line programs, as middleware, database applications, services software, data integration, Internet Of Things (IOT)  and elsewhere. It is well-suited for cloud applications due to low resource requirements and because it is easy to containerize_applications.

Read more about vely_architecture, how_vely_works and about Vely's quality_control.

Introduction to coding


Each Vely statement generates some C code, maybe a one-liner, maybe quite a few. It works similar to a declarative statement, for example SQL comes to mind. Some clauses in a Vely statement are to input data, others are to output, yet others are directives on what to do. They can be in any order. The generated code will take the input, do the job, and fill in the output.

Vely generates a simple request dispatcher that takes the "req" input parameter, which is really the name of the source Vely file. So if it's "req=mycode", then the function "void mycode()" will execute and it must always be defined in source file mycode.v. This makes it easy to always find the code, and quickly grasp what application does.

Unlike C Makefile, you don't have to write a Makefile. Whatever .v files you have in your source code directory will be automatically picked up and made into an application. This makes source code more organized because it discourages junk code laying around.

The generated code can and will change. It tries to do the best job of doing what is instructed to do. So if you say:
web-call "http://website.com" response resp response-code rc status len post files "file1"="uploadtest", "file23"="fileup4"

then it will generate the C code to effectively POST a form to website.com that sends two local files to that server, and will get you the response code and status back. You can do this by using cURL library, but it will take quite a bit of C coding to do this. And there are many different combinations and things you can do, and the code gets generated to do it quickly and efficiently each time.

The same goes for exec-program, run-query, send-file, encrypt-data, etc. All these things you can program yourself in C, but these statements are flexible and will quickly and safely do what you need. It's more like "what I want to do" rather than "how I want to do it". Though, you can always examine the generated C code to see exactly how it's done.

To get started with the basics, the Hello World tutorial is good to go. If you want to start literally in minutes, try 123_hello_world, as it can't get any simpler. It's designed to give you an application in minutes. You'll get a command_line executable, and you will be running your own application server that can take input from Apache or Nginx via FastCGI. The example though uses FastCGI command line client so you don't have to do anything beyond what's already included in Vely package.

Author


Sergio Mijatovic (vely@vely.dev)

Official website


https://vely.dev

Bugs, enhancements, feedback


See bugs_enhancements_feedback.


Copyright (c) 2022 DaSoftver LLC. Vely is a trademark of Dasoftver LLC. The software and information herein are provided "AS IS" and without any warranties or guarantees of any kind. This web page is licensed under CC-BY-SA-4.0.