Use Javascript driver from frontend only 'framework' svelte.js

Svelte.js is a front-end only web 'framework'. https://svelte.dev/tutorial/basics
I would like to use it to connect to Neo4j.

I feel that this must be possible using one of our browser-based bolt access methods, i.e.:

I have not managed to make an connection to my local Neo4j Desktop database. I would love to see the simplest working example.

What have you tried? What was the result?

Hi @mojo2go,

I'm not very svelte, but here's an example that can send arbitrary cypher and display the raw results.

Some notes:

  • the username/password is pulled using dotenv then added to the app using rollup/plugin-replace (probably that is not safe/advised)
  • Neo4j Desktop has to be already running before the app page loads
  • the Neo4j driver connection string assumes the default port. you can check the "manage" screen of a running database to see what port 'bolt' is using

Let me know if this helps.

Best,
ABK

1 Like

Andreas,
Thanks for getting me to the starting line with this. I had the best luck when I downloaded the code as a ZIP file from your repository, and then

npm install
npm run dev

on that. I provided my login and password for Neo4j. Now I can run read and write queries.

I will work with this and provide feedback with what I learn.

Joe