A small test project to try out SurrealDB with Typescript. In the DB we will have a User table with a few entries. We will have a frontend in which we use the sdk in order to authenticate and read the user entries.
With SurrealDB installed Let's start out with a on-disk test database with a single root user.
surreal start --user root --pass root rocksdb:/home/david/typescript_surrealdb_test/ts_test.db
In our TypeScript project let's install the surrealdb sdk.
npm i surrealdb
Using the TypeScript sdk we create a schemaless table 'user' with two fields: first_name and last_name. Also we create two test entries for that table. We then try to fetch and display these entries in our frontend.
Running our vite development server
npm run dev
Loading our page in the browser returns the stringified entries from our User table. Now this is not just painless but even quite enjoyable :)