Skip to content

Candid-Engineering/books-db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

books-db

This is currently a learning app for Candid Engineering (@rkofman && @SilverMaiden) to practice svelte + desktop development. The goal is to have a simple application for tracking one's physical book library.

Current tech stack:

  • Svelte + SvelteKit + Typescript
  • Vitest (.js unit testing)
  • Bulma (CSS framework)
  • Tauri (WebView frontend + Rust backend)

And some are open questions:

Recommended IDE Setup

Project Setup

Pre-requisites

Before getting started, make sure the following is set up on your machine:

Install

It is recommended to use a node version manager such as nodenv to install the required version of node. See .node-version for the current required version.

We also specify a specific version of pnpm in the packageManager field of package.json. Make sure to have it installed.

To install javascript packages, we use the pnpm package manager:

pnpm install

Testing

Unit tests

The default test command is:

pnpm test

This will run the javascript unit tests (files ending in .spec within /src-ui) as well as the rust tests (test modules within /src-tauri).

Watching for changes

A common way to have a quick development cycle is to keep a window open running tests in watch mode. This will re-run the tests any time relevant files change.

For javascript, that's available via:

pnpm js:test

Our rust code is not yet set-up for watch; but should be easy to add as an exercise left to the reader.

Integration tests

Integration tests are only available on Windows at this time. Before running them, you must download the version of MS Edge Driver that corresponds to your MS Edge browser.

(keeping the driver up to date over time is an exercise left to the reader)

Once that's installed, make sure to add it to your PATH_.

Then install tauri-driver:

cargo install tauri-driver

Once that's done, you should be able to run end to end tests:

pnpm e2e:test

Developing

As an easy way to get started, run a SvelteKit development server (no Electron/Tauri features):

pnpm run svelte:dev

To run the full app including Tauri and native Rust code:

pnpm run dev

Building

(This section may need to be filled out if there are any gotchas or required secrets to include when building)

pnpm run build

Migrations

  1. Update src-ui/lib/db/schema.ts
  2. Run cargo xtask ben:migration [migration_name]
  3. pnpm dev will start the app and apply any migrations since the latest fully applied one.
  • Note: Currently only new migrations will be applied (measured by timestamp). If a migration was skipped, it will remain skipped.

About

Use a barcode scanner to keep track of books.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •