marekvospel / surmsg

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I run this app?

ankified opened this issue · comments

I've tried pnpm run dev but when I try to register an user and password nothing happens and the console returns the error below:
image

Sorry if this is a silly question (I'm teaching myself as a hobby), but what should do to run the app? Also, are there any tutorial about how to use SurrealDb with SvelteKit?

Hi, I haven't included much documentation, as I only meant this project as a quick and simple app to try out SurrealDB.
You've used the correct command to start the frontend, but you'll need the SurrealDB on https://localhost:8000 (or update the url in src/lib/surreal.ts)
Also make sure you initialize the database (This app is using schemaful tables) (You can find the init script in migrations folder - replace the TYPE record() with TYPE record(user) on the last lane. You can use https://surrealist.app/)
Also make sure you use the correct namespaces (the app expects the DEV ns and DEV db)

I'm not aware of any tutorials (at least not as specific as usage with Svelte)
The only thing I can recommend is to read through the official surrealdb documentation and write some sort of abstraction around the surreal live queries (by creating custom svelte stores) Feel free to take inspiration from what I wrote https://github.com/marekvospel/surmsg/blob/main/src/lib/surreal.ts#L29 (prototype only)

Thanks for your help!
I've been trying to figure out a way to start SurrealDB simultaneously when I start the app with pnpm dev, so I don't need to use Surrealist.
I could make it work by modifying the package.json file like this:

"scripts": {
		"dev": "concurrently --names surreal,vite \"pnpm run dev:surreal\" \"pnpm run dev:vite\"",
		"dev:surreal": "surreal start --user root --pass root --bind 0.0.0.0:8000 file://<path>",
		"dev:vite": "vite dev",
		"build": "vite build",
		"preview": "vite preview",
		"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
		"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
	},
...

It was taken from the Stickies app (https://github.com/surrealdb/examples/blob/main/notes-app/package.json)