<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/building-semantic-search-with-transformers-js-and-sentence-embeddings-ohtnpfpyj" -->

---
title: Building Semantic Search with Transformers.js and...
description: A hands-on guide to building a fully client-side semantic search engine using Transformers.js and sentence embeddings, with no server or API key required....
canonical: https://daily.dev/posts/building-semantic-search-with-transformers-js-and-sentence-embeddings-ohtnpfpyj
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Building Semantic Search with Transformers.js and Sentence Embeddings | daily.dev
og:description: A hands-on guide to building a fully client-side semantic search engine using Transformers.js and sentence embeddings, with no server or API key required....
og:url: https://daily.dev/posts/building-semantic-search-with-transformers-js-and-sentence-embeddings-ohtnpfpyj
og:image: https://api.daily.dev/og/posts/OhTnpfpYJ.png
og:image:alt: Building Semantic Search with Transformers.js and Sentence Embeddings
og:image:width: 1200
og:image:height: 630
og:locale: en
---

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

# Building Semantic Search with Transformers.js and Sentence Embeddings

**[Machine Learning Mastery](https://daily.dev/sources/mlm)** · 11 min read · 1 upvotes · 0 comments

## Summary

A hands-on guide to building a fully client-side semantic search engine using Transformers.js and sentence embeddings, with no server or API key required. Covers how sentence embeddings work, mean pooling and normalization, the feature-extraction pipeline, batching for performance, cosine similarity scoring, building a reusable SemanticSearch class, Web Worker offloading to avoid blocking the main thread, persisting the index in localStorage, and scaling to larger corpora with pgvector. Uses the all-MiniLM-L6-v2 model (384 dimensions) and includes a complete working HTML demo with a fictional e-commerce FAQ knowledge base.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://machinelearningmastery.com/building-semantic-search-with-transformers-js-and-sentence-embeddings>

## Similar posts on daily.dev

- [Multimodal Browser AI with Transformers.js for Images and Speech](https://daily.dev/posts/multimodal-browser-ai-with-transformers-js-for-images-and-speech-n61aoocbh) · Machine Learning Mastery · 1 upvotes · 0 comments
- [Medium](https://daily.dev/posts/medium-pbxb0r5mu) · Medium · 1 upvotes · 0 comments
- [Generating vector embeddings for semantic search locally](https://daily.dev/posts/generating-vector-embeddings-for-semantic-search-locally-n3vvxp2vp) · Phil Eaton · 0 upvotes · 0 comments

---

Tags: [#javascript](https://daily.dev/tags/javascript), [#vector-search](https://daily.dev/tags/vector-search)

[View this post on daily.dev](https://daily.dev/posts/building-semantic-search-with-transformers-js-and-sentence-embeddings-ohtnpfpyj)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Building Semantic Search with Transformers.js and Sentence Embeddings","url":"https://daily.dev/posts/building-semantic-search-with-transformers-js-and-sentence-embeddings-ohtnpfpyj","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/building-semantic-search-with-transformers-js-and-sentence-embeddings-ohtnpfpyj"},"datePublished":"2026-06-05T12:30:19.015Z","dateModified":"2026-06-05T12:30:47.660Z","description":"A hands-on guide to building a fully client-side semantic search engine using Transformers.js and sentence embeddings, with no server or API key required....","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ddc74a60dae2633b1ed782e302951b7f?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ddc74a60dae2633b1ed782e302951b7f?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Machine Learning Mastery","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Machine Learning Mastery","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/795781ffb32446c39eba040feb64f505","url":"https://daily.dev/sources/mlm"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/building-semantic-search-with-transformers-js-and-sentence-embeddings-ohtnpfpyj","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"javascript,vector-search","timeRequired":"PT11M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Machine Learning Mastery","item":"https://daily.dev/sources/mlm"},{"@type":"ListItem","position":3,"name":"Building Semantic Search with Transformers.js and Sentence Embeddings"}]}
```

