Skip to content

Run locally

Follow these steps to run lukurauha shelf locally and open your first book.

  • Node.js 24 or later
  • pnpm

Use create-lukurauha-shelf to scaffold a minimal Astro + EmDash project.

  1. Scaffold the project and move into its directory:

    Terminal window
    pnpm create lukurauha-shelf my-shelf
    cd my-shelf
  2. Install dependencies and start the development server:

    Terminal window
    pnpm install
    pnpm dev
  3. 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.

If you already run Astro and EmDash, install @lukurauha/shelf directly.

  1. Install the package:

    Terminal window
    pnpm add @lukurauha/shelf
  2. Add libraryPlugin() and lukurauhaShelf() to astro.config.mjs. Pass basePath if 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",
    }),
    ],
    });
  3. To query user books through Astro 7’s Live Content Layer, register shelfBooks in src/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() }),
    };
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.