Skip to content

Share code between database application and SvelteKit application - #271

Merged
ScriptRaccoon merged 17 commits into
mainfrom
shared-code
Jul 11, 2026
Merged

Share code between database application and SvelteKit application#271
ScriptRaccoon merged 17 commits into
mainfrom
shared-code

Conversation

@ScriptRaccoon

@ScriptRaccoon ScriptRaccoon commented Jul 8, 2026

Copy link
Copy Markdown
Owner

The repository basically contains two applications: the database application1 (seed files, seed script, deduction script, etc.) and the SvelteKit application (user interface). The database application lives in /databases, while the SvelteKit application lives in /src. Both have long relied on similar functions and configuration objects, but until now this code was duplicated rather than shared.

This PR resolves this by adding a new /shared folder at the root. Both the database application and the SvelteKit application now import common functions and configuration objects from there. As a notable example, deduction helpers have been extracted that can be used in three places: the deduction script, the redundancy check, and the consistency worker (for the search page).

Also, the database query wrappers in the Svelte application have been removed, since the db.prepare function by better-sqlite3 already supports generics, no additional error handling is required, and even additional features like .pluck() and .raw() are available. As a result, both the database application and the SvelteKit application now use the same pattern to access the database.

1At the moment, the database application is simply a folder rather than a standalone package. A more systematic solution would be to turn the repository into a monorepo. I experimented with that a while ago, but it introduced enough complexity that I decided against it.

@ScriptRaccoon
ScriptRaccoon force-pushed the shared-code branch 6 times, most recently from fe9b977 to 29029ad Compare July 9, 2026 20:06
@ScriptRaccoon
ScriptRaccoon marked this pull request as ready for review July 10, 2026 14:01
@ScriptRaccoon
ScriptRaccoon merged commit 4d7b605 into main Jul 11, 2026
2 checks passed
@ScriptRaccoon
ScriptRaccoon deleted the shared-code branch July 11, 2026 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant