Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
title: 3 solutions to the 3 layer problem
date: '2023-08-10'
icon: adjustments-question
summary: What is the 3 layer problem, and how SQLPage solves it?
---

# 3 solutions to the 3 layer problem

> Some interesting questions emerged from the article [Repeating yourself thrice doesn't turn you into a 3X developer](https://yrashk.medium.com/repeating-yourself-thrice-doesnt-turn-you-into-a-3x-developer-a778495229c0).
> This short follow-up article aims to answer them and clarify some points.

Hello all,

I am Ophir Lojkine, the main contributor of the open-source application server **SQLPage**.

The previous article focused on the conventional model of splitting applications into three distinct tiers:

1. a graphical interface (_front-end_),
2. an application server (_back-end_),
3. and a database.

In many projects, this results in three distinct implementations of the application’s data model:

1. First, in SQL, in the form of tables, views, and relationships in the database,
2. Then, in _server side_ languages such as Java, Python, or PHP, to create an API managing access to the data, and to implement the business logic of the application,
3. Finally, in JavaScript or TypeScript to implement data manipulation in the user interface.

![Traditional tiers model](blog/three-layers.svg)

---

The topic of interest here is the duplication of the data model between the different layers,
and the communication overhead between them.
We are not talking about how the code is structured within each layer.
It can follow a Model-View-Controller pattern or not, it doesn't matter.

This three-layer model has several advantages:
specialization of the programmers,
parallelization of work,
scalability,
separation of concerns,
and an optimal exploitation of the capacities of the infrastructure on which each layer is deployed:
web browser, server application and database.

Nevertheless, in large-scale projects,
there is often a certain redundancy of the code between the different layers,
as well as a non-negligible share of code dedicated to communication between them.
For small teams and solo developers, this becomes a major drawback.

## 3 solutions

Fortunately, there are several approaches to solving this problem:

1. For **UI-centric applications** without complicated data processing needs,
you can almost completely abandon server-side development and **directly expose the data to the frontend**.
Open-source tools available in this space include Supabase, PocketBase or Hasura.
2. For **applications with a predominant business logic**, traditional _web frameworks_
solve this problem by centralizing frontend and database control in the backend code.
A common solution involves using an ORM and templating system instead of a dedicated javascript application.
Popular solutions include Django, Ruby on Rails, or Symphony.
3. For simpler applications, it is possible to **avoid both backend and frontend development**
by adopting a _database-first_ approach.
This alternative, although less widespread, allows taking advantage of under-exploited modern capacities of relational databases.
The purpose of the original article was to introduce this lesser known approach.
* **SQLPage** is representative of this last category,
which allows designing a complete web application _in SQL_.
This leads to a loss of control over the precise visual appearance of the application,
which will get a “standardized” look and feel.
On the other hand, this translates into significant gains in terms of development speed,
simplicity and performance.
This solution is not intended to compete with traditional _frameworks_,
but rather integrate earlier in the life cycle of a project.
It thus makes it possible to quickly develop a data structure adapted to the application,
and to iterate over it while benefiting from continuous visual feedback on the final result.
Then, when the application grows, it’s easy to add a classic frontend and backend on top of the existing database,
without having to start from scratch.

Whichever approach is chosen in the end,
a solid understanding of the conventional three-tier architecture,
as well as a clear perspective on the challenges it creates and the possible solutions,
facilitates decision-making and the evolution of the project with the best suited technologies.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
INSERT INTO blog_posts (title, description, icon, created_at, content)
VALUES (
'I’m sorry I forked you',
'SQLPage forked the sqlx database drivers library. Here is why.',
'git-fork',
'2023-08-13',
'
---
title: I’m sorry I forked you
date: '2023-08-13'
icon: git-fork
summary: SQLPage forked the sqlx database drivers library. Here is why.
---

# I’m sorry I forked you

I’ve been immersed in open source coding since my teenage years, and now, I can’t fathom a world without it.
Expand All @@ -13,7 +13,7 @@ Each company adds its proprietary touch to this vast open source landscape,
but they are ultimately just forming a unique blend atop a colossal iceberg of shared resources.
In the software world, open source truly is the driving force behind innovation.

## Unconventional Financial Currents in Software
## Unconventional Financial Currents in Software

The software industry operates on a financial current that defies conventional norms.
Unlike other sectors where key players like oil companies rake in the riches by supplying essentials to other businesses,
Expand Down Expand Up @@ -45,7 +45,7 @@ and the introduction of a new API, making it non trivial to migrate from the pre
## SQLPage

As the principal caretaker of the [SQLPage web application server](/), which relies on sqlx,
I faced a pivotal juncture. The path ahead diverged into two distinct trails:
I faced a pivotal juncture. The path ahead diverged into two distinct trails:
1. a challenging migration to sqlx v0.7, making a cross on MSSQL support;
2. persisting with v0.6, a realm housing outdated and potentially vulnerable dependencies.

Expand Down Expand Up @@ -94,4 +94,3 @@ The main contributor to sqlx reacted to this post, and they wanted to clarify tw
(unlike SQLPage, which is free to use even in conjunction with proprietary software, under the *MIT* license).
Companies that want to use these future sqlx drivers in proprietary software will have to pay for a commercial license.
That change in the decision has been announced in 2022, and I should have been aware of it when I wrote this post. My bad.
');
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
---
title: Introduction video
date: '2024-05-14'
icon: brand-youtube
summary: A 30-minute live presentation of SQLPage, its raison d'être, and how to use it.
---

INSERT INTO blog_posts (title, description, icon, created_at, content)
VALUES
(
'Introduction video',
'A 30-minute live presentation of SQLPage, its raison d''être, and how to use it.',
'brand-youtube',
'2024-05-14',
'
# Introduction video

## Canadians love SQLPage
Expand All @@ -16,15 +14,14 @@ by Anton Avramov, an avid SQLPage user and community member, who gave a live dem

## The video

The user group kindly invited me (Ophir, the initial creator and main contributor to SQLPage)
The user group kindly invited me (Ophir, the initial creator and main contributor to SQLPage)
to record a video introduction to SQLPage, which I did.

The video is a 5 minute introduction to the philosophy behind SQLPage,
followed by a 25 minute live demonstration of how to create
[this todo list application](https://github.com/sqlpage/SQLPage/tree/main/examples/todo%20application)
from scratch.

Watch it on youtube:
Watch it on youtube:

[![video cover](https://i.ytimg.com/vi/9NJgH_-zXjY/maxresdefault.jpg)](https://www.youtube.com/watch?v=9NJgH_-zXjY)
');
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
---
title: New SQLPage, and a talk at PGConf.eu
date: '2024-01-29'
icon: brand-youtube
summary: SQLPage v0.18.0 is out, and there is detailed introduction to SQLPage on youtube
---

INSERT INTO blog_posts (title, description, icon, created_at, content)
VALUES
(
'New SQLPage, and a talk at PGConf.eu',
'SQLPage v0.18.0 is out, and there is detailed introduction to SQLPage on youtube',
'brand-youtube',
'2024-01-29',
'
[SQLPage](https://sql-page.com) is a small web server that renders your SQL queries as beautiful interactive websites. This release has seen significant new features and fixes from new contributors, which is great and show the health of the project ! If you feel something is missing or isn''t working quite right, all your contributions are always welcome.
[SQLPage](https://sql-page.com) is a small web server that renders your SQL queries as beautiful interactive websites. This release has seen significant new features and fixes from new contributors, which is great and show the health of the project ! If you feel something is missing or isn't working quite right, all your contributions are always welcome.

On a side note, I [gave a talk about SQLPage last December at PGConf.eu](https://www.youtube.com/watch?v=mXdgmSdaXkg).
It is a great detailed introduction to SQLPage, and I recommend it if you want to learn more about the project.

1. **New `tracking` component for beautiful and compact status reports:** This feature adds a new way to display status reports, making them more visually appealing and concise.
1. **New `tracking` component for beautiful and compact status reports:** This feature adds a new way to display status reports, making them more visually appealing and concise.
1. ![screenshot](https://github.com/sqlpage/SQLPage/assets/552629/3e792953-3870-469d-a01d-898316b2ab32)


3. **New `divider` component to add a horizontal line between other components:** This simple yet useful addition allows for better separation of elements on your pages.
1. ![image](https://github.com/sqlpage/SQLPage/assets/552629/09a2cc77-3b37-401f-ab3e-441637a2c022)

5. **New `breadcrumb` component to display a breadcrumb navigation bar:** This component helps users navigate through your website''s hierarchical structure, providing a clear path back to the homepage.
5. **New `breadcrumb` component to display a breadcrumb navigation bar:** This component helps users navigate through your website's hierarchical structure, providing a clear path back to the homepage.
1. ![image](https://github.com/sqlpage/SQLPage/assets/552629/cbf2174a-1d75-499e-9d6b-e111136dbbbc)

8. **Multi-column layouts with `embed` attribute in `card` component:** This feature enables you to create more complex and dynamic layouts within cards.
1. ![image](https://github.com/sqlpage/SQLPage/assets/552629/3f4435f0-d89b-424e-8b8a-39385a61d5ad)


6. **Customizable y-axis step size in `chart` component with `ystep` attribute:** This feature gives you more control over the chart''s appearance, especially for situations with multiple series.
6. **Customizable y-axis step size in `chart` component with `ystep` attribute:** This feature gives you more control over the chart's appearance, especially for situations with multiple series.

7. **Updated default graph colors for better distinction:** This enhancement ensures clarity and easy identification of different data series.

10. **ID and class attributes for all components for easier styling and referencing:** This improvement simplifies custom CSS customization and inter-page element linking.
Expand All @@ -39,6 +37,3 @@ It is a great detailed introduction to SQLPage, and I recommend it if you want t
13. **Unicode support for built-in SQLite database:** This enables case-insensitive string comparisons and lower/upper case transformations.

5. **Improved `card` component with smaller margin below footer text:** This fix ensures consistent and visually balanced card layouts.

'
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Repeating yourself thrice won't make you a 3X developer
date: '2023-08-01'
icon: box-multiple-3
summary: A dive into the traditional 3-tier architecture and the DRY principle, and how tools like SQLPage
helps you avoid repeating yourself.
external_url: https://yrashk.medium.com/repeating-yourself-thrice-doesnt-turn-you-into-a-3x-developer-a778495229c0
---
Loading
Loading