DEV Community

Simone Mosciatti
Simone Mosciatti

Posted on • Originally published at

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 Doing so allow the browser to make HTTP requests against the 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=">=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.

Discussion (0)