frappe / books

Free Accounting Software
https://frappe.io/books
GNU Affero General Public License v3.0
2.86k stars 660 forks source link

Remote Server #695

Open erik-gross-hardt opened 1 year ago

erik-gross-hardt commented 1 year ago

Remote Server

Hello Frappe-Books Team,

I'm writing to submit a pull request for the remote connection feature I've been working on. I wanted to emphasize that this implementation is very basic (and unconventional) but I have had a great experience using it so far. I have begun working on a remote connection feature, which aims to simplify the way users can share there books by establishing a connection to a remote server. Although the feature is already fully functional, I would like to highlight that security measures have not been incorporated at all yet. Consequently, this pull request is intended for review and discussion.

How it works

I have implemented a custom Knex database client that extends the standard better-sqlite3 client. My client intercepts the communication just before establishing a native SQLite connection, redirecting the SQL queries that would normally hit the SQLite database directly, and instead sending the queries to a server. This server then establishes the necessary communication with the SQLite file and responds with the query results.

Here is a quick illustration:

image

Things I had to change

The Server

The server implementation can be found here frappe-books-server I have also build a docker-image

That's it for now, I hope there may be some value to this. As said I had a great experience using it so far, while working with in a team. I am sure there is a better way to implement server connectivity but I doubt that there will be a simpler one.

Thank you, Erik

promexio commented 1 year ago

Erik, Sounds beautiful. Is it already in the current version? How can I enable this?

--Gabriel

erik-gross-hardt commented 1 year ago

To "enable" this you will have to build the frappe client from source. Just clone my repo and yarn build it. Follow the instructions here to setup a server instance.

solancer commented 1 year ago

This is brilliant, @erik-gross-hardt Thankyou for working on this

18alantom commented 1 year ago

@erik-gross-hardt thanks for raising this PR. It's an unconventional but pretty smart way of adding remote server support.

Since this is mostly a proof of concept, here're a couple of details off the top of my head:

Nevertheless, I think the crux of your idea—i.e. using a custom Knex client to send queries— still stands, and will mostly be the way remove server support is incorporated into Frappe Books.