Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

An Electron application using Angular 8+, Electron 6+, Sqlite3 4+, Bootstrap 4+ and WebPack 4+

License

Notifications You must be signed in to change notification settings

laosandy/electron-angular-sqlite-bootstrap-webpack

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deprecated

This repo is no longer maintained and has been archived. I have created a new starter using angular-cli: https://github.com/pamtbaau/electron-angular-cli-sqlite-bootstrap.

Until a few releases ago, angular-cli could not be used in combination with custom webpack configurations. Things have changed for the good...

Sample application using Angular 8+, Electron 6+, SQLite3 4+, Bootstrap 4+ and Webpack 4+

For a similar application using Angular CLI see starter electron-angular-cli-sqlite-bootstrap

It took me quite some time to figure out how to use SQLite database in an Electron application. Because of the difficulties I've encountered, I've been using sql.js and Lovefield as alternatives.

  • sql.js is SQLite compiled to javascript and therefore easy to integrated.
    The disadvantage is that it loads the entire database in memory at startup and needs to be written back to disk when the app finishes.
  • lovefield is also build in Javascript, but stores the data in the browser's IndexedDb. It does not use SQL, but its own api.
    My main issues with lovefield are that I needed more complex sql statements and needed to be able to store the database anywhere on disk.

None of the above was satisfactory, so I continued the search to bundle SQLite and finally found a way to access SQLite from Electron/node and overcome bundling issues with webpack.

This repository is a stripped down Electron application using Angular 5, SQLite, Bootstrap 4 and WebPack.

Note Since I develop solely on Windows 10, I have not tested the application on any unix version.

Prerequisites (Windows 10)

Both Visual C++ Build Tools and Python 2.7 are required for node-gyp to rebuild native SQLite library for node.
For installation instructions see node-gyp.

Quickstart

  1. git clone https://github.com/pamtbaau/angular7-electron3-sqlite3-bootstrap4-webpack4.git
  2. npm install
  3. npm run build:once
  4. npm start
    • Enter new database name in file dialog.

Karma tests

  • npm run test

Building installable exe

  • npm run package

Notes

  • Application can switch between a fixed database location or allow the end-user to select a location at first startup.
    See src/app/model/Settings.hasFixedDbLocation
  • When allowing the user to choose location/name of database, a settings.json (points to database location) is located in c:/users/yourname/AppData/Roaming/$productName}-dev
    When running packaged executable, settings.json is located in c:/users/yourname/AppData/Roaming/$productName}. This way development will not override production data.
  • TheDb provides a Promise-ified wrapper around bare sqlite3 API.

About

An Electron application using Angular 8+, Electron 6+, Sqlite3 4+, Bootstrap 4+ and WebPack 4+

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 66.8%
  • JavaScript 21.9%
  • HTML 8.1%
  • CSS 2.8%
  • TSQL 0.4%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.