Need help with local-sqlite-example?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

161 Stars 44 Forks MIT License 14 Commits 0 Opened issues


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

Services available


Need anything else?

Contributors list

# 215,294
13 commits


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.


September 2020 - Added

enableRemoteModule: true
in main.js to address a breaking change in Electron 10 wherein the remote module is now disabled by default. Thank you to Barbarosse
for reporting the issue.

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:



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

Project Status

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

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.