From d888c8d0d7ac6ee46ef78a2b3dda3cfdbe3f9c79 Mon Sep 17 00:00:00 2001 From: lovasoa Date: Wed, 1 May 2024 01:05:16 +0200 Subject: [PATCH] much better architecture diagram thanks @S-poony !!! --- README.md | 2 +- ...lpage high-level architecture graphviz.dot | 47 +++++++++++ docs/sqlpage logic.drawio | 81 ++++++++++++++----- docs/sqlpage logic.drawio.svg | 2 +- examples/official-site/index.sql | 6 +- 5 files changed, 112 insertions(+), 26 deletions(-) create mode 100644 docs/sqlpage high-level architecture graphviz.dot diff --git a/README.md b/README.md index b9275c3c..2b308679 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ select ## How it works -![architecture diagram](./docs/architecture.jpg) +![architecture diagram](./docs/sqlpage%20logic.drawio.svg) SQLPage is a [web server](https://en.wikipedia.org/wiki/Web_server) written in [rust](https://en.wikipedia.org/wiki/Rust_(programming_language)) diff --git a/docs/sqlpage high-level architecture graphviz.dot b/docs/sqlpage high-level architecture graphviz.dot new file mode 100644 index 00000000..0a730f19 --- /dev/null +++ b/docs/sqlpage high-level architecture graphviz.dot @@ -0,0 +1,47 @@ +digraph { + rankdir=LR; + node [shape=rectangle, style=rounded, fontname=helvetica]; + edge [arrowhead=normal, arrowtail=crow, dir=both]; + + subgraph cluster_browser { + label = "Web Browser"; + style = filled; + color = lightgrey; + node [style=filled, color=white]; + browser [label = "Web Browser|"]; + } + + subgraph cluster_sqlpage { + label = "SQLPage"; + style = filled; + color = lightblue; + node [style=filled, color=white]; + read_file [label = "Read File|todos.sql"]; + replace_param [label = "Replace Parameter|$todo_id with 1"]; + format_results [label = "Format Results|as HTML"]; + } + + subgraph cluster_database { + label = "Database"; + style = filled; + color = palegreen; + node [style=filled, color=white]; + execute_query [label = "Execute|Query"]; + return_results [label = "Return|Results"]; + } + + browser:f1 -> http_request [label = " HTTP GET Request\n/todos.sql?todo_id=1", lhead=cluster_browser]; + http_request -> read_file:f0 [lhead=cluster_sqlpage]; + read_file:f1 -> replace_param:f0; + replace_param:f1 -> sql_query [label = " SQL Query\nSELECT * FROM todos\nWHERE id = 1", lhead=cluster_sqlpage]; + sql_query -> execute_query:f0 [lhead=cluster_database]; + execute_query:f1 -> return_results:f0; + return_results:f1 -> result_stream [label = " Result Stream", lhead=cluster_database]; + result_stream -> format_results:f0 [lhead=cluster_sqlpage]; + format_results:f1 -> html_response [label = " HTML Response\nwith Formatted Results", ltail=cluster_sqlpage]; + html_response -> browser:f0 [label = " Display Results", lhead=cluster_browser]; + + // Additional Styles + edge [arrowhead=normal, arrowtail=none, dir=both, fontname=helvetica, fontsize=10]; + node [fontsize=12]; +} \ No newline at end of file diff --git a/docs/sqlpage logic.drawio b/docs/sqlpage logic.drawio index 7b6a5f96..3bf50d8c 100644 --- a/docs/sqlpage logic.drawio +++ b/docs/sqlpage logic.drawio @@ -1,16 +1,16 @@ - + - + - + - + - + @@ -23,66 +23,105 @@ - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/sqlpage logic.drawio.svg b/docs/sqlpage logic.drawio.svg index 5900afb1..0e5b0c94 100644 --- a/docs/sqlpage logic.drawio.svg +++ b/docs/sqlpage logic.drawio.svg @@ -1,4 +1,4 @@ -

GET /todo.sql?id=1

Host: example.com
Cookie: name=value

HTTP/1.1 200 OK

Server: SQLPage

<html><head><title>My SQLPage...

SELECT
  'list' AS component;


SELECT *
FROM todos
WHERE id = $id
list.handlebars

(pre-built component)
Website User
You write this
All of this is handled for you automatically
\ No newline at end of file +
 SQLPage
Page 1

My SQLPage Website

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Database
URL
Browser
Website User
/todos.sql? todo_id=1
get
HTTP Request
SQL query
SQL query result
SELECT
  'list' AS component;


SELECT *
FROM todos
WHERE id = $todo_id
SQL File
You only write this !
SQLPage User
list.handlebars



 Built-in template
query result formatted to HTML
HTML Response

HTTP/1.1 200 OK

Server: SQLPage

<html><head><title>My SQLPage...

Renders in streaming
\ No newline at end of file diff --git a/examples/official-site/index.sql b/examples/official-site/index.sql index b2498fb8..cb322703 100644 --- a/examples/official-site/index.sql +++ b/examples/official-site/index.sql @@ -5,7 +5,7 @@ select 'shell' as component, 'database' as icon, '/' as link, 'en-US' as language, - 'Official SQLPage website: write web applications in SQL !' as description, + 'Web development, simplified ! Create robust, beautiful web applications with just SQL queries. Build webapps on a low-code sql-only platform.' as description, 'blog' as menu_item, 'documentation' as menu_item, 19 as font_size, @@ -14,9 +14,9 @@ select 'shell' as component, SELECT 'hero' as component, 'SQLPage' as title, - 'Open-source *low-code* web application server. + 'Build **Web Apps** Effortlessly with **Only SQL Skills** -Create **full websites** writing only simple database queries.' as description_md, +Open-source *low-code* web application server' as description_md, 'sqlpage_introduction_video.webm' as video, 'your-first-sql-website/' as link, 'Build your first SQL website now !' as link_text;