• This repository has been archived on 14/Dec/2020
  • Stars
    star
    190
  • Rank 203,739 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Demonstrates database-driven Electron using local SQLite with SQL.js.

Logo

How to Build an Electron App with a Local SQLite3 Database That's Portable.

This project demonstrates how to install and use a local SQLite3 database in Electron using SQL.js. SQL.js is a port of SQLite to JavaScript, by compiling the SQLite C code with Emscripten. Using only JavaScript means there are no C bindings or node-gyp compilations to deal with.

Updates

September 2020

January 2018

  • Updated SQL.js to 0.4.0
  • Updated Bootstrap to 4.0.0-beta.3. Form validation was revised to agree with current documentation. Improved responsive layout and UTF-8 support.
  • Dropped all non-functional UI features.

Quick Code Tour

  • The code entry point is in package.json under the key "main". The value is "main.js"
  • main.js calls model.initDb() from model.js which creates a new SQLite3 database from schema.sql. A callback creates a BrowserWindow and loads index.html.
  • index.html loads Bootstrap's CSS in the <head> tag and renderer.js after the closing <body> tag.
  • renderer.js loads Cheerio, jQuery, Bootstrap and it's dependency; Tether.
  • A composed HTML pattern is used to load the markup.
  • The application's database work is all done in model.js. Here you'll find functions to open and close the database as well as functions to select, insert, update, and delete records. Prepared statements are used throughout.
  • The application opens with a list of people. Click a red X to delete a person's record.

People

  • Click a pencil (shown above) to edit a person:

Edit

  • Click Add in the left rail to add a new person record:

Add

Uninstalling

Please note that running this application will install a tiny SQLite database in the folder returned by electron.app.getPath('userData'). To uninstall simply delete this folder.

Project Status

This project has been archived and is no longer being maintained by the author.

More Repositories

1

python-example

How to Build an Electron GUI for a Python Module
JavaScript
106
star
2

bootstrap-example

Demonstrates how to use Bootstrap and jQuery with Electron.
HTML
74
star
3

Adafruit-Feather-M0-Motion-Camera

A firmware application written in C++ using Arduino and Adafruit libraries. It sleeps in low power mode until, activated by the PIR motion sensor, it takes a picture. Images are posted to io.adafruit.com using the REST API.
C++
23
star
4

5mp_motion_camera

How to Build a Water-Resistant, Battery-Operated, Low-Power, Motion-Activated, 5 Mega-Pixel WiFi Camera
C++
6
star
5

composed-html-example

How to Compose Modular HTML Assets in an Electron Application Using Cheerio and jQuery
HTML
4
star
6

Local-Solar-Noon

Demonstrates how to calculate Local Solar Noon and the Equation of Time in JavaScript, Python 3, and C++.
C++
4
star
7

ESP8266-Monitor

A C++ firmware application using Arduino and Adafruit libraries. It monitors time, temperature, humidity, battery voltage, and current.
C++
3
star
8

ble_sensor_service

How to Capture Bluetooth Low Energy Broadcasts in a SQLite Database
C++
2
star
9

zephyr_ble_sensor

Bluetooth Low Energy Environmental Sensor for Adafruit nRF52840 Express and Adafruit BME680.
C
2
star
10

jpeg_catcher

How to Build a CGI That Does Image Processing for a 5 Mega-Pixel Motion-Activated WiFi Camera
C++
1
star
11

kinetic-javascript

An animated line inside a resizable box. The movement of the line is beautiful. The interaction between the line and the moving borders of the box is interesting. Visit the website to see it in action.
JavaScript
1
star
12

Atmel-SAMD21-Monitor

A C++ firmware application using Arduino and Adafruit libraries. It monitors time, temperature, humidity, battery voltage, and current.
C
1
star
13

camera_settings

How to Pass a Simple Struct from C++ to JavaScript and Back Again Using Google FlatBuffers
C++
1
star