This repo is a starter kit that sets up front-end and back-end of a simple react and node app. This app's backend after auth connects with surrealdb and adds random users data to surrealdb as many times as we start the server . Front-end after successful auth connects with surrealdb fetches the data from the surrealdb and displays in the UI. Just like a simple publish-subscribe model. It uses database auth mode in surrealist app.
-
install surreal from the official page's documentation
-
start the surreal server using command : surreal.exe start memory -A --auth --user root --pass root
-
clone the repository and setup back-end and front-end seperately .
-
get into the front-end folder and type npm install & same for backend this will install all the dependencies .
-
now type npm run dev in the front-end and node app.js in the backend and the terminals will look something like this :
front-end terminal:
back-end terminal:
-
In the browser now go to http://localhost:5173/ where the vite is serving the front-end's webpage the ui will look something like this :
- This as a base point we can implement client - server model & so on with surreal db as database .
- With this base we can also change auth modes or tweak auth modes as per the need .
- Some console logs & methods are commented to ensure one can quickly comment out and check some other surrealdb methods and better debug the issues while connecting to surrealdb .
- Feel free to raise the issue and contribute :)