|
| 1 | +--- |
| 2 | +title: "The Library of Ravens" |
| 3 | +description: "A simple library management application. Built with RavenDB, Aspire, Azure Storage Queues, and Azure Functions. " |
| 4 | +challengesSolutionsTags: [cloud-tax, gen-ai-data-enrichment, integration-patterns, semantic-search] |
| 5 | +featureTags: [azure-storage-queues-etl, document-refresh, include, vector-search] |
| 6 | +techStackTags: [csharp, aspire, azure-storage-queues, azure-functions] |
| 7 | +category: "Ecommerce" |
| 8 | +license: "MIT License" |
| 9 | +image: "/img/samples/library-of-ravens/cover.webp" |
| 10 | +gallery: |
| 11 | + - src: "/img/samples/library-of-ravens/01.webp" |
| 12 | + alt: "The Library of Ravens - Main Interface" |
| 13 | + - src: "/img/samples/library-of-ravens/02.webp" |
| 14 | + alt: "The Library of Ravens - Author Profile" |
| 15 | +--- |
| 16 | + |
| 17 | +import { ActionsCard, RelatedResource, FeatureAccordion, SampleMetadataColumn, SampleLayout } from '@site/src/components/Samples'; |
| 18 | +import Gallery from '@site/src/components/Common/Gallery'; |
| 19 | + |
| 20 | +export const sampleDetails = ( |
| 21 | + <SampleMetadataColumn |
| 22 | + actionsCard={ |
| 23 | + <ActionsCard |
| 24 | + githubUser="ravendb" |
| 25 | + githubRepo="samples-library" |
| 26 | + demoUrl="https://demo.ravendb.net" |
| 27 | + /> |
| 28 | + } |
| 29 | + relatedResources={ |
| 30 | + <> |
| 31 | + <RelatedResource |
| 32 | + type="documentation" |
| 33 | + documentationType="docs" |
| 34 | + subtitle="Vector Search Overview" |
| 35 | + articleKey="ai-integration/vector-search/overview" |
| 36 | + /> |
| 37 | + <RelatedResource |
| 38 | + type="documentation" |
| 39 | + documentationType="docs" |
| 40 | + subtitle="Azure Storage Queues ETL" |
| 41 | + articleKey="server/ongoing-tasks/etl/queue-etl/azure-queue" |
| 42 | + /> |
| 43 | + </> |
| 44 | + } |
| 45 | + /> |
| 46 | +); |
| 47 | + |
| 48 | +<SampleLayout details={sampleDetails} gallery={<Gallery images={frontMatter.gallery} />}> |
| 49 | + |
| 50 | +## Overview |
| 51 | + |
| 52 | +The Library of Ravens **solves the "architecture bloat"** of managing separate databases by **consolidating full-text and vector search into a single database**. Instead of wrestling with data synchronization across multiple platforms, you get a unified search experience that keeps your infrastructure lean and your development cycle fast. |
| 53 | + |
| 54 | +The app demonstrates **robust integration patterns using Azure Storage Queues**. By leveraging RavenDB’s change tracking and ETL services, the system ensures that critical library updates are never lost, providing architectural resilience. |
| 55 | + |
| 56 | +Finally, the app **addresses the "cloud tax" of high egress fees** by utilizing ETags and native HTTP caching driven by RavenDB’s metadata. This approach significantly reduces the volume of data sent over the wire, slashing public cloud billing while providing a snappier, more responsive experience for the end user through efficient data reuse. |
| 57 | + |
| 58 | +Built with [RavenDB](https://ravendb.net/), [Aspire](https://aspire.dev/), [Azure Storage Queues](https://github.com/ravendb/samples-library/blob/main/azure.microsoft.com/en-us/products/storage/queues), and [Azure Functions](https://azure.microsoft.com/en-us/products/functions). |
| 59 | + |
| 60 | + |
| 61 | +## Features used |
| 62 | + |
| 63 | +<FeatureAccordion |
| 64 | + title="Include" |
| 65 | + description="RavenDB's Include feature fetches related documents, solving N+1 issues." |
| 66 | + icon="link" |
| 67 | +> |
| 68 | + RavenDB's Include feature allows loading related documents in a single request, eliminating the N+1 query problem. In the Library application, when loading a book, we simultaneously fetch the author and category documents without additional roundtrips to the database. |
| 69 | + |
| 70 | + Implementation example: |
| 71 | + |
| 72 | + ```csharp |
| 73 | + // Load a book with its related author in one request |
| 74 | + using var session = store.OpenAsyncSession(); |
| 75 | + |
| 76 | + var book = await session |
| 77 | + .Include<Book>(b => b.AuthorId) |
| 78 | + .Include<Book>(b => b.CategoryId) |
| 79 | + .LoadAsync<Book>("books/1-A"); |
| 80 | + |
| 81 | + // These are already loaded - no additional DB calls |
| 82 | + var author = await session.LoadAsync<Author>(book.AuthorId); |
| 83 | + var category = await session.LoadAsync<Category>(book.CategoryId); |
| 84 | + |
| 85 | + // Example: Loading multiple books with their authors |
| 86 | + var books = await session.Query<Book>() |
| 87 | + .Include(b => b.AuthorId) |
| 88 | + .Where(b => b.IsAvailable) |
| 89 | + .ToListAsync(); |
| 90 | + ``` |
| 91 | +</FeatureAccordion> |
| 92 | + |
| 93 | +<FeatureAccordion |
| 94 | + title="Vector Search" |
| 95 | + description="Semantic search powered by AI embeddings for intelligent content discovery." |
| 96 | + icon="vector-search" |
| 97 | +> |
| 98 | + Vector search enables semantic similarity matching, allowing users to find books based on meaning rather than just keywords. |
| 99 | +</FeatureAccordion> |
| 100 | + |
| 101 | +<FeatureAccordion |
| 102 | + title="Azure Storage Queues ETL" |
| 103 | + description="Reliable data integration with Azure Storage Queues." |
| 104 | + icon="azure-queue-storage-etl" |
| 105 | +> |
| 106 | + ETL to Azure Storage Queues ensures that all library updates are reliably propagated to downstream systems. |
| 107 | +</FeatureAccordion> |
| 108 | + |
| 109 | +<FeatureAccordion |
| 110 | + title="Document Refresh" |
| 111 | + description="Automatic document updates based on external data sources." |
| 112 | + icon="document-refresh" |
| 113 | +> |
| 114 | + Document Refresh keeps book metadata up-to-date by automatically fetching the latest information from external APIs. |
| 115 | +</FeatureAccordion> |
| 116 | + |
| 117 | +## Technologies |
| 118 | + |
| 119 | +The following technologies were used to build this application: |
| 120 | + |
| 121 | +- [RavenDB](https://ravendb.net/) |
| 122 | +- [.NET 10](https://dotnet.microsoft.com/en-us/download/dotnet/10.0) |
| 123 | +- [Aspire](https://aspire.dev/) |
| 124 | +- [Azure Functions](https://azure.microsoft.com/en-us/products/functions) |
| 125 | +- [Azure Storage Queues](https://azure.microsoft.com/products/storage/queues) |
| 126 | +- [SvelteKit](https://svelte.dev/) |
| 127 | + |
| 128 | +## Run locally |
| 129 | + |
| 130 | +If you want to run the application locally, please follow the steps: |
| 131 | + |
| 132 | +1. Check out the GIT repository |
| 133 | +2. Install prerequisites: |
| 134 | + 1. [.NET 10](https://dotnet.microsoft.com/en-us/download/dotnet/10.0) |
| 135 | + 2. [Aspire.dev](https://aspire.dev/get-started/install-cli/) |
| 136 | + 3. [nodejs](https://nodejs.org/) |
| 137 | +3. Request a [dev license](https://ravendb.net/license/request/dev-ai-agent-inside) and set it under `RAVEN_LICENSE` env variable |
| 138 | +4. Get the app running by opening `/src/RavenDB.Samples.Library.sln` and starting the `Aspire` `AppHost` project |
| 139 | + |
| 140 | +## Community & Support |
| 141 | + |
| 142 | +If you spot a bug, have an idea or a question, please let us know by raising an issue or creating a pull request. |
| 143 | + |
| 144 | +We do use a [Discord server](https://discord.gg/ravendb). If you have any doubts, don't hesitate to reach out! |
| 145 | + |
| 146 | +## Contributing |
| 147 | + |
| 148 | +We encourage you to contribute! Please read our [CONTRIBUTING](https://github.com/ravendb/samples-library/blob/main/CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests. |
| 149 | + |
| 150 | +## License |
| 151 | + |
| 152 | +This project is licensed with the [MIT license](https://github.com/ravendb/samples-library/blob/main/LICENSE). |
| 153 | + |
| 154 | +</SampleLayout> |
0 commit comments