# @orama/plugin-astro

> An Astro integration for Orama

Latest version **3.1.18** (published 2025-12-19) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @orama/plugin-astro
pnpm add @orama/plugin-astro
yarn add @orama/plugin-astro
bun add @orama/plugin-astro
```

## Health

**Score 70/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score; popular repo.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.1.18 |
| Published | 2025-12-19 |
| First published | 2023-03-21 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >= 20.0.0 |
| Dependencies | 3 |
| Unpacked size | 16.9 KB |
| Known vulnerabilities | 0 (+19 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 10550 |
| Author | Andres Correa Casablanca |
| Maintainers | micheleriva, fra.giannino, allevo, matijagaspar, rjborba-askorama |
| Keywords | astro, astro-component, cms, orama, search |

## Links

- npm: https://www.npmjs.com/package/@orama/plugin-astro
- Repository: https://github.com/oramasearch/orama
- Homepage: https://github.com/oramasearch/orama#readme
- Issues: https://github.com/oramasearch/orama/issues
- npm.io page: https://npm.io/package/@orama/plugin-astro

## Dependencies (3)

- [astro](https://npm.io/package/astro.md) ^2.0.2
- [@orama/orama](https://npm.io/package/@orama/orama.md) 3.1.18
- [html-to-text](https://npm.io/package/html-to-text.md) ^9.0.3

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 3.1.18 (latest) — 2025-12-19
- 3.1.17 — 2025-12-14
- 3.1.16 — 2025-10-13
- 3.1.15 — 2025-10-10
- 3.1.14 — 2025-09-16
- 3.1.13 — 2025-09-04
- 3.1.12 — 2025-08-29
- 3.1.11 — 2025-07-12
- 3.1.10 — 2025-07-02
- 3.1.9 — 2025-06-23
- 3.1.7 — 2025-05-17
- 3.1.6 — 2025-04-15
- 3.1.5 — 2025-04-11
- 3.1.4 — 2025-03-28
- 3.1.3 — 2025-03-12
- … 97 more at https://npm.io/package/@orama/plugin-astro/versions

## README

# Orama's Astro Plugin

[![Tests](https://github.com/oramasearch/orama/actions/workflows/turbo.yml/badge.svg)](https://github.com/oramasearch/orama/actions/workflows/turbo.yml)

This package is a (still experimental) [Orama](https://oramasearch.com) integration for
[Astro](https://astro.build).

## Usage

### Configuring the Astro integration

```typescript
// In `astro.config.mjs`
import orama from '@orama/plugin-astro'

// https://astro.build/config
export default defineConfig({
  integrations: [
    orama({
      // We can generate more than one DB, with different configurations
      mydb: {
        // Required. Only pages matching this path regex will be indexed
        pathMatcher: /blog\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/.+$/,

        // Optional. 'english' by default
        language: 'spanish',

        // Optional. ['body'] by default. Use it to constraint what is used to
        // index a page.
        contentSelectors: ['h1', 'main']
      }
    })
  ]
})
```

When running the `astro build` command, a new DB file will be persisted in the
`dist/assets` directory. For the particular case of this example, it will be
saved in the file `dist/assets/oramaDB_mydb.json`.

### Using generated DBs in your pages

To use the generated DBs in your pages, you can include a script in your
`<head>` section, as the following one:

```html
<head>
  <!-- Other stuff -->
  <script>
    // Astro will do the job of bundling everything for you
    import { getOramaDB, search } from "@orama/plugin-astro/client"

    // We load the DB that we generated at build time, this is an asynchronous
    // operation, so we must either await, or rely on `.then` calls.
    const db = await getOramaDB('mydb')

    // Now we can search inside our DB. Of course, feel free to use it in more
    // interesting ways.
    console.log('Search Results')
    console.log(search(db, { term: 'mySearchTerm' }))
  </script>
</head>
```

**NOTE:** For now, this plugin only supports readonly DBs. This might change in
the future if there's demand for it.

---
_Source: https://npm.io/package/@orama/plugin-astro · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
