DEV Community

Simone Mosciatti
Simone Mosciatti

Posted on • Originally published at redbeardlab.com

1

Use SimpleSQL from Github pages

SimpleSQL is an HTTP API that allow complete control over a SQLite database.

Underneath SimpleSQL is based on RediSQL to manage all the different databases, connections, backups, replication, etc.

One of the most compelling use case is to SimpleSQL to create completely static webpages that can operate against one database. This would allow to create very powerful webapp that don’t need a server backend. All the interaction with the backend can happen directly on the client code.

A common way to host a simple web app, is to use Github pages, which offer a free space for open source projects.

In order to use SimpleSQL you need to allow the browser to make CORS requests against simplesql.redbeardlab.com. Doing so allow the browser to make HTTP requests against the simplesql.redbeardlab.com domain.

Fortunately github pages already allow it, so no step is necessary for the CORS.

SimpleSQL provide also a JS SDK, which makes writing application simpler.

In order to use the SDK is sufficient to import it adding the following line in the head section of your html pages.

<script type="text/javascript" src="https://unpkg.com/@redbeardlab/simplesql@>=1.0.8"></script>

Once imported the SDK it will be possible to invoke all the SimpleSQL functions, like: SimpleSQL.newDatabase() to create a new database, or SimpleSQL.command(db, "select 1;") to execute a command against one database, all this from client code.

An example, hosted on Github pages, is available here with the source being here.

The documentation for the SDK is on github.

While the raw HTTP API are documented on swagger.

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

The best way to debug slow web pages cover image

The best way to debug slow web pages

Tools like Page Speed Insights and Google Lighthouse are great for providing advice for front end performance issues. But what these tools can’t do, is evaluate performance across your entire stack of distributed services and applications.

Watch video

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay