SQLpage

A short video explaining the concept of sqlpage

SQLPage is an SQL-only webapp builder. It is meant for data scientists, analysts, and business intelligence teams to build powerful data-centric applications quickly, without worrying about any of the traditional web programming languages and concepts.

With SQLPage, you write simple .sql files containing queries to your database to select, group, update, insert, and delete your data, and you get good-looking clean webpages displaying your data as text, lists, grids, plots, and forms.

Examples

CodeResult
```sql SELECT 'list' as component, 'Popular websites' as title; SELECT name as title, url as link, CASE type WHEN 1 THEN 'green' ELSE 'red' END as color, description, icon, active FROM website; ``` ![SQLPage list component](./docs/demo-list.png)
```sql SELECT 'chart' as component, 'Syracuse' as title, 'area' as type; SELECT month AS x, SUM(revenue) AS y FROM income GROUP BY month; ``` ![SQLPage list component](./docs/demo-graph.png)
```sql SELECT 'form' as component, 'User' as title, 'Create new user' as validate; SELECT name, type, placeholder, required, description, min, max FROM user_form; ``` ![SQLPage list component](./docs/demo-form.png)

Supported databases

How it works

SQLPage is a web server written in rust and distributed as a single executable file. When it receives a request to a URL ending in .sql, it finds the corresponding SQL file, runs it on the database, passing it information from the web request as SQL statement parameters. When the database starts returning rows for the query, SQLPage maps each piece of information in the row to a parameter in one of its pre-defined components' templates, and streams the result back to the user's browser.

Get started

Environment variables

| variable | default | description | |----------------|------------------------------|----------------------------------------------------------| | LISTEN_ON | 0.0.0.0:8080 | Interface and port on which the web server should listen | | DATABASE_URL | sqlite://sqlpage.db?mode=rwc | Database connection URL |

Serverless

You can run SQLpage serverless by compiling it to an AWS Lambda function. An easy way to do so is using the provided docker image:

bash docker build -t sqlpage-lambda-builder . -f lambda.Dockerfile --target builder docker run sqlpage-lambda-builder cat deploy.zip > deploy.zip

You can then use deploy.zip as the source for an AWS Lambda, selecting Custom runtime on Amazon Linux 2 as a runtime.

Technologies and libraries used