initial commit

This commit is contained in:
Madison Grubb
2026-02-10 23:32:26 -05:00
commit b7046dc0e6
133 changed files with 26080 additions and 0 deletions

15
server/plugins/db.init.js Normal file
View File

@@ -0,0 +1,15 @@
import { getDb, closeDb } from '../utils/db.js'
import { migrateFeedsToDevices } from '../utils/migrateFeedsToDevices.js'
/**
* Initialize DB (and run bootstrap if no users) at server startup
* so credentials are printed in the terminal before any request.
* Close DB on server shutdown to avoid native sqlite3 crashes in worker teardown.
*/
// eslint-disable-next-line no-undef
export default defineNitroPlugin((nitroApp) => {
void getDb().then(() => migrateFeedsToDevices())
nitroApp.hooks.hook('close', () => {
closeDb()
})
})