> ## Documentation Index
> Fetch the complete documentation index at: https://larkuprag.larkup.de/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Build Your First RAG Server

> Generate, launch, and deploy a complete RAG backend.

The core power of LarkupRAG is turning your raw data into a deployable, high-performance RAG API in minutes. You can build your server using either our visual Web UI or the developer-focused CLI.

<Tabs>
  <Tab title="Web UI" icon="browser">
    <Steps>
      <Step title="Configure Vector Store & Embedding Model">
        Start by configuring your preferred **Vector Store** (e.g., LanceDB, Pinecone) and **Embedding Model** (e.g., OpenAI, Cohere) in the Configuration tab.

        <Frame>
          <img src="https://mintcdn.com/larkup-rag/R9FQSOVcQOv3DWx4/images/configuration-page.png?fit=max&auto=format&n=R9FQSOVcQOv3DWx4&q=85&s=ea0aadbe54d66f7fec0132b20aae9d69" alt="Configuration Page" width="2996" height="1436" data-path="images/configuration-page.png" />
        </Frame>
      </Step>

      <Step title="Ingest Your Documents">
        Navigate to the **Data** tab to upload files, paste raw text, or scrape websites. These sources will queue up as ingestion jobs.
      </Step>

      <Step title="Run Indexing">
        In the **Index** tab, click **Run Indexing Job**. This process will automatically chunk your text and generate vector embeddings to store in your chosen database.
      </Step>

      <Step title="Launch the Server">
        Finally, go to the **Server** tab and click **Launch Server**. LarkupRAG takes your entire configuration and generates a minimal, deployable Node.js server.

        <Frame>
          <img src="https://mintcdn.com/larkup-rag/R9FQSOVcQOv3DWx4/images/server-scalar-api.png?fit=max&auto=format&n=R9FQSOVcQOv3DWx4&q=85&s=321dea53ec422c0a8d498cdf4dfd3e04" alt="Server Launch Interface" width="2996" height="1436" data-path="images/server-scalar-api.png" />
        </Frame>
      </Step>
    </Steps>
  </Tab>

  <Tab title="CLI" icon="terminal">
    <Steps>
      <Step title="Initialize the Workspace">
        Create a new workspace project:

        ```bash theme={null}
        larkup-rag init my-rag-server
        ```
      </Step>

      <Step title="Configure Providers (Optional)">
        By default, the CLI uses a local LanceDB instance. If you want to configure external stores or OpenAI embeddings, run:

        ```bash theme={null}
        larkup-rag config
        ```
      </Step>

      <Step title="Add Documents">
        Add multiple files or URLs to your workspace:

        ```bash theme={null}
        larkup-rag add-doc --file ./docs/manual.pdf
        larkup-rag add-doc --url https://example.com/docs
        ```
      </Step>

      <Step title="Index Data">
        Run the indexing job to chunk and embed your data:

        ```bash theme={null}
        larkup-rag index
        ```
      </Step>

      <Step title="Launch the Server">
        Spin up the backend in the foreground:

        ```bash theme={null}
        larkup-rag serve
        ```
      </Step>
    </Steps>
  </Tab>
</Tabs>

## The Generated Server

When you launch your server, LarkupRAG creates an optimized backend output directory . It contains everything you need and absolutely nothing you don't:

* **Zero Bloat**: Only dependencies for your specific Vector Store are bundled.
* **No Build Step**: Runs directly as a Node ESM backend (`node server.mjs`).

## SDK Usage

Because Larkup RAG exposes an OpenAI-compatible API, you can easily connect to it using your favorite AI tools and SDKs.

<Tabs>
  <Tab title="Vercel AI SDK">
    Use the `ai` and `@ai-sdk/openai` packages to connect to your local RAG server.

    ```typescript theme={null}
    import { createOpenAI } from '@ai-sdk/openai';
    import { generateText } from 'ai';

    const larkup = createOpenAI({
      baseURL: 'http://localhost:8080/v1',
      apiKey: 'not-needed-for-local',
    });

    const { text } = await generateText({
      model: larkup('rag-model'), // The model name doesn't matter for local RAG
      prompt: 'What is LarkupRAG?',
    });

    console.log(text);
    ```
  </Tab>

  <Tab title="LangChain (Python)">
    Use `langchain-openai` to connect via Python.

    ```python theme={null}
    from langchain_openai import ChatOpenAI

    llm = ChatOpenAI(
        openai_api_base="http://localhost:8080/v1",
        openai_api_key="not-needed-for-local",
        model_name="rag-model"
    )

    response = llm.invoke("What is LarkupRAG?")
    print(response.content)
    ```
  </Tab>
</Tabs>

## Next Steps

Your server is now live at `http://localhost:8080`.

* [**Deploy your server**](/developer/deploy) to Vercel, Docker, or a VPS.
* [**Build a frontend chatbot**](/guide/instant-chatbot) using your new API.
