---
title: "Building Vector Search and Personal Knowledge Graphs on Mobile with libSQL and React Native"
description: "Kin, a local-first personal AI app, stores its agent memory as a vector-searchable knowledge graph on the user's device using libSQL through the OP-SQLite React Native binding, enabled with a package.json flag."
url: "https://swe.quest/articles/building-vector-search-and-personal-knowledge-graphs-on-mobile-with-libsql-and-9cac5c5150db9825"
canonical: "https://turso.tech/blog/building-vector-search-and-personal-knowledge-graphs-on-mobile-with-libsql-and-react-native"
source: "Turso"
published: "2024-10-02"
difficulty: "medium"
kind: "How-to"
reading_minutes: 10
tags: ["vector-search","sqlite","mobile","local-first","react"]
---

# Building Vector Search and Personal Knowledge Graphs on Mobile with libSQL and React Native

A post on [Turso](https://swe.quest/sources/turso.md), published 2024-10-02, 10 min read, How-to. Original: [https://turso.tech/blog/building-vector-search-and-personal-knowledge-graphs-on-mobile-with-libsql-and-react-native](https://turso.tech/blog/building-vector-search-and-personal-knowledge-graphs-on-mobile-with-libsql-and-react-native)

## Summary

Kin, a local-first personal AI app, stores its agent memory as a vector-searchable knowledge graph on the user's device using libSQL through the OP-SQLite React Native binding, enabled with a package.json flag. Nodes and edges live in relational tables with F32\_BLOB embedding columns. Edges are indexed with libsql\_vector\_idx, using compress\_neighbors and max\_neighbors to save space, and queried via vector\_top\_k joined on rowid, with distance computed by vector\_distance\_cos. Practical gotchas include serializing Float32Array vectors into dynamic SQL because OP-SQLite lacks typed-array parameters, and iOS/Android build clashes when other packages such as expo-updates or expo-sqlite compile their own SQLite.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Vector search](https://swe.quest/tags/vector-search.md) (Data & databases)
- [SQLite](https://swe.quest/tags/sqlite.md) (Data & databases)
- [Mobile](https://swe.quest/tags/mobile.md) (Web & mobile)
- [Local-first & sync](https://swe.quest/tags/local-first.md) (Architecture & design)
- [React](https://swe.quest/tags/react.md) (Web & mobile)

## Prerequisites

- React Native basics ([easy posts on React](https://swe.quest/tags/react.md?difficulty=easy))
- SQLite ([easy posts on SQLite](https://swe.quest/tags/sqlite.md?difficulty=easy))
- vector embeddings ([easy posts on RAG & retrieval](https://swe.quest/tags/rag.md?difficulty=easy))

## Keywords

libSQL, OP-SQLite, React Native, Kin, Expo, cr-sqlite

## Related posts

- [Personal Knowledge Graphs in AI RAG-powered Applications with libSQL](https://swe.quest/articles/personal-knowledge-graphs-in-ai-rag-powered-applications-with-libsql-0896de56d7bc65a9.md): Turso · 2024-09-30 · Medium · 6 min read · Vector search, SQLite, RAG & retrieval, Local-first & sync, Mobile
  Kin, a local-first mobile personal AI, stores its personal knowledge graph in libSQL so that relational data, graph edges and vector embeddings live in one embeddable single-file database instead of syncing a separate store like faiss.
- [SQLite Retrieval Augmented Generation and Vector Search](https://swe.quest/articles/sqlite-retrieval-augmented-generation-and-vector-search-f6665825b9a1cb47.md): Turso · 2024-06-21 · Medium · 5 min read · Vector search, SQLite, RAG & retrieval
  Retrieval-augmented generation fixes stale or hallucinated LLM answers by retrieving relevant data, typically via embeddings and vector similarity search, and injecting it into the prompt. libSQL adds native vector search to SQLite: embeddings are stored in an F32\_BLOB column (SQLite treats column types as hints), inserted with a vector() function, and queried with vector\_distance\_cos() plus ORDER BY/LIMIT for exact top-k results.
- [In-Browser Semantic AI Search with PGlite and Transformers.js](https://swe.quest/articles/in-browser-semantic-ai-search-with-pglite-and-transformers-js-f90228d6e99e01b6.md): Supabase · 2024-08-29 · Medium · 7 min read · Vector search, PostgreSQL, Browsers, JavaScript, React
  A fully local, in-browser semantic search can be built by combining PGlite (Postgres compiled to run in the browser, persisted to IndexedDB) with the pgvector extension and Transformers.js running the Supabase/gte-small embedding model.
- [You Don't Need A Separate Vector Database](https://swe.quest/articles/you-don-t-need-a-separate-vector-database-3c832a16be076ef3.md): Turso · 2024-11-04 · Easy · 4 min read · Vector search, SQLite, Databases, RAG & retrieval
  Vector search belongs in your primary database rather than a separate system like Pinecone, because syncing embeddings across multiple stores adds cost and operational complexity.
- [Turso brings Native Vector Search to SQLite](https://swe.quest/articles/turso-brings-native-vector-search-to-sqlite-524b5f374ac6abee.md): Turso · 2024-06-05 · Medium · 5 min read · Vector search, SQLite, Multi-tenancy
  libSQL, the SQLite fork behind Turso, now has native vector similarity search exposed as a column type (F32\_BLOB) instead of an extension like sqlite-vss.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
