Using NodeJS to create an offline desktop application

Does the integration of node.js make it possible, or closer to being possible, to create a standalone desktop application - ie an application which uses SQLite for example and doesn’t need a web server (local or remote)? Or if a server would still be required, could one be created with a node.js module (ie transparently, without the user having to install a server with W/MAMP etc.)?

1 Like

That would be work for a DB engine like pouchDB(which is in the works I believe).

1 Like

What about serverless functions? Have you ever considered that?
In the end SC is a big API that reads JSON and returns JSON.

Just an innocent question of course. I understand people are still deciding if they should use GIT or not :smiley:

1 Like

I wasn’t thinking necessarily of a local database which synced to an online version (great though this would be in some situations).

Wouldn’t this require a remote connection, albeit not a server?

There are desktop applications which use SQLite (like Wappler). I was wondering if node.js would make it possible to create such applications. Neither SQLite nor PHP need a server to run.

PouchDB does local or remote. It’s also based on JS and works very well with Electron.

Actually, that post had nothing to do with your question. It was meant for Wappler team :slight_smile:

1 Like

Thanks. Do you know if PouchDB is comparable performance-wise to MySQL, not with very large databases, but perhaps with some tables containing 2-300k records? Perhaps it’s not possible to say without more details.

Two different implementations. PouchDB is a NoSQL document based database.
You would need to read about the differences in performance between NoSQL and SQL databases. Or between RDBMS and DBMS. Too much info to condense in a post :slight_smile:

Thanks. I have no experience with NoSQL databases, so some research would certainly be needed.

I’m still interested in whether there is/will be a way to use SQLite locally and without a server (using node.js).

Sqlite is file based. It’s main purpose is to live locally. There is no way of accessing it remotely without implementing some sort of middleware.

And yes, nodejs has filesystem access so it can talk to sqlite.

BTW, you can’t really say nodejs without a server because nodejs is partially a server itself.
Falling deeper down the rabbit hole Wappler’s implementation is based on ExpressJS which is a server framework for Nodejs.

image

1 Like

Actually this would be indeed possible with the new NodeJS integration :slight_smile:
Just as we do in Wappler you can run the lite nodejs server inside your desktop app!

So you will have a full blown desktop app with all the client and server side functionality all in one!

The enduser will never notice any difference as the local web server will be auto started and stopped together with the app and will be hidden as it is just for internal use.

And indeed a great choice with this will be SQLite integration as local database. So that you have everything you need to build an offline desktop app!

We already support SQLite out of the box in NodeJS - so you can already connect and manage it.

So all the ingredients are in there - we just have to combine it with Electron for packaging so you have it all in one :slight_smile:

4 Likes

Thanks George. This sounds very interesing and yet another avenue to explore (and an increasing need for more than 24 hours in a day).

So, apart from the packaging, it’s already possible? Does this require installing NodeJS packages?

We already install everything you need. All the Node packages. You can always add additional ones if needed. It is all managed easily from the new toolbar below

1 Like

image

2 Likes

Hi @TomD, hope all is well with you.
Have you succeeded in doing that.
If yes, any clue or How to do tutorial.
Thanks.

No, I’m afraid I haven’t looked into this any further.

1 Like

Thanks for quick reply.