While building electron apps, usually the backend is in separate folder (js files) and front end is in a separate folder (html files). In the backend, in order to use the database, we have to include the nedb package with the require statement as follows.
var Datastore = require('nedb'),db = new Datastore({ filename: 'data.db', autoload: true });
Keep in mind that the loading of the database file is an asynchronous task.