Run locally
Follow these steps to run lukurauha shelf locally and open your first book.
Requirements
Section titled “Requirements”- Node.js 24 or later
- pnpm
Create a new project
Section titled “Create a new project”Use create-lukurauha-shelf to scaffold a minimal Astro + EmDash project.
-
Scaffold the project and move into its directory:
Terminal window pnpm create lukurauha-shelf my-shelfcd my-shelf -
Install dependencies and start the development server:
Terminal window pnpm installpnpm dev -
Open
http://localhost:4321/_emdash/api/setup/dev-bypass?redirect=/in your browser. This creates the development account, completes initial setup, signs you in, and redirects to/.
Upload a .md, .txt, or .html file or paste text to open page one. Returning to / shows your book cover on the shelf.
Add to an existing Astro + EmDash site
Section titled “Add to an existing Astro + EmDash site”If you already run Astro and EmDash, install @lukurauha/shelf directly.
-
Install the package:
Terminal window pnpm add @lukurauha/shelf -
Add
libraryPlugin()andlukurauhaShelf()toastro.config.mjs. PassbasePathif you mount the shelf under a sub-path:astro.config.mjs import { defineConfig } from "astro/config";import lukurauhaShelf, { libraryPlugin } from "@lukurauha/shelf";import emdash, { local } from "emdash/astro";import { sqlite } from "emdash/db";export default defineConfig({output: "server",integrations: [emdash({database: sqlite({ url: "file:./data.db" }),storage: local({ directory: "./uploads", baseUrl: "/_emdash/api/media/file" }),plugins: [libraryPlugin()],}),lukurauhaShelf({basePath: "/shelf",}),],}); -
To query user books through Astro 7’s Live Content Layer, register
shelfBooksinsrc/live.config.ts:src/live.config.ts import { shelfBooksLoader } from "@lukurauha/shelf/loader";import { defineLiveCollection } from "astro:content";import { emdashLoader } from "emdash/runtime";export const collections = {_emdash: defineLiveCollection({ loader: emdashLoader() }),shelfBooks: defineLiveCollection({ loader: shelfBooksLoader() }),};
Common commands
Section titled “Common commands”| Command | Purpose |
|---|---|
pnpm dev |
Start the Astro development server |
pnpm build |
Build the production Node.js standalone output |
pnpm start |
Run the built server (node ./dist/server/entry.mjs) |
pnpm check |
Run Astro type checks |
Continue to Self-hosting when you are ready to deploy.