-
- Hello, human{" "}
-
-
- Write, ideate, and learn with all the wisdom of your bookmarks, notes, tweets and
- everything else, all in one place.
-
-
-
-
-
setEmail(e.target.value)}
- onKeyDown={handleKeyDown}
- placeholder="your@email.com"
- className="w-full h-12 rounded-xl bg-black/5 dark:bg-white/5 border-black/10 dark:border-white/10 text-black dark:text-white placeholder:text-black/50 dark:placeholder:text-white/50 focus:border-black/20 dark:focus:border-white/20 focus:ring-black/20 dark:focus:ring-white/20 px-4"
- />
- {error &&
{error}
}
- {success && (
-
Successfully joined waitlist!
- )}
-
-
-
-
- Ready for your Second brain?
-
-
+
+
+
+
+ All your knowledge in one place
+
+
+ Supermemory intelligently organizes and connects your saved content, making it easy to
+ find and use when you need it.
+
+
);
diff --git a/apps/web/app/routes/_index.tsx b/apps/web/app/routes/_index.tsx
index 6aa8d553..84373771 100644
--- a/apps/web/app/routes/_index.tsx
+++ b/apps/web/app/routes/_index.tsx
@@ -1,7 +1,7 @@
import { Suspense, lazy, memo, useCallback, useEffect, useState } from "react";
-import { useFetcher, useNavigate, useRouteError } from "@remix-run/react";
import { LoaderFunctionArgs, defer, json, redirect } from "@remix-run/cloudflare";
+import { useFetcher, useNavigate, useRouteError } from "@remix-run/react";
import { Await, useLoaderData } from "@remix-run/react";
import { getSignInUrl } from "@supermemory/authkit-remix-cloudflare";
@@ -39,9 +39,6 @@ export const loader = async ({ request, context }: LoaderFunctionArgs) => {
const success = searchParams.get("success");
const integration = searchParams.get("integration");
- if (!user) {
- return redirect("/signin");
- }
try {
const recommendedQuestionsPromise = proxy("/api/recommended-questions", {}, request, context)
@@ -58,7 +55,7 @@ export const loader = async ({ request, context }: LoaderFunctionArgs) => {
greeting,
recommendedQuestions: recommendedQuestionsPromise,
success,
- integration
+ integration,
});
} catch (error) {
console.error("Error in loader:", error);
@@ -100,12 +97,6 @@ const HomePage = memo(function HomePage() {
const [isModalOpen, setIsModalOpen] = useState(false);
const navigate = useNavigate();
- useEffect(() => {
- if (!user) {
- navigate("/signin");
- }
- }, [user]);
-
useEffect(() => {
if (success && integration && integration === "notion") {
setIsModalOpen(true);
@@ -131,6 +122,10 @@ const HomePage = memo(function HomePage() {
window.scrollTo({ top: document.body.scrollHeight, behavior: "smooth" });
}, []);
+ if (!user) {
+ return
;
+ }
+
return (
diff --git a/docs/api/search.md b/docs/api/search.md
new file mode 100644
index 00000000..2f3273fe
--- /dev/null
+++ b/docs/api/search.md
@@ -0,0 +1,164 @@
+# Search
+
+This endpoint provides semantic search capabilities across your saved memories using state-of-the-art embeddings. It returns relevant content ranked by similarity.
+
+```http
+POST /api/search
+```
+
+## Request Body
+
+```typescript
+{
+ // The search query to find relevant content
+ query: string,
+
+ // Maximum number of results to return (1-50, default: 10)
+ limit?: number,
+
+ // Minimum similarity threshold (0-1, default: 0)
+ threshold?: number
+}
+```
+
+### Field Descriptions
+
+| Field | Type | Required | Description |
+| ----------- | ------ | -------- | --------------------------------------------- |
+| `query` | string | Yes | Search query text (minimum 1 character) |
+| `limit` | number | No | Maximum number of results (1-50, default: 10) |
+| `threshold` | number | No | Minimum similarity score (0-1, default: 0) |
+
+## Response
+
+The endpoint returns an array of search results, sorted by relevance:
+
+```typescript
+{
+ results: Array<{
+ // Document identifiers
+ id: string;
+ uuid: string;
+
+ // Content fields
+ content: string; // Full document content
+ chunkContent: string; // Matching content chunk
+
+ // Metadata
+ createdAt: string; // ISO timestamp
+
+ // Relevance score (0-1)
+ similarity: number; // Rounded to 4 decimal places
+ }>;
+}
+```
+
+### Error Responses
+
+#### 400 Bad Request
+
+```json
+{
+ "error": "Search query cannot be empty"
+}
+```
+
+#### 401 Unauthorized
+
+```json
+{
+ "error": "Unauthorized"
+}
+```
+
+#### 500 Internal Server Error
+
+```json
+{
+ "error": "Search failed",
+ "details": "Error details (in development mode)"
+}
+```
+
+## Features
+
+### Semantic Search
+
+- Uses BAAI BGE base embeddings model
+- Computes cosine similarity between query and content
+- Returns similarity scores between 0 and 1
+- Supports partial matching and semantic understanding
+
+### Performance
+
+- Results limited to specified threshold
+- Efficient vector search using PostgreSQL
+- Chunked content for better matching
+- Optimized similarity calculations
+
+### Content Processing
+
+- Automatic query embedding
+- Smart content chunking
+- Relevance scoring
+- Result deduplication
+
+## Examples
+
+### Basic Search
+
+```json
+{
+ "query": "machine learning concepts"
+}
+```
+
+### Advanced Search with Filters
+
+```json
+{
+ "query": "python programming",
+ "limit": 20,
+ "threshold": 0.5
+}
+```
+
+### Response Example
+
+```json
+{
+ "results": [
+ {
+ "id": "doc-123",
+ "uuid": "abc-456",
+ "content": "Python is a versatile programming language...",
+ "chunkContent": "...particularly useful for machine learning...",
+ "createdAt": "2024-03-20T12:00:00Z",
+ "similarity": 0.8754
+ },
+ {
+ "id": "doc-124",
+ "uuid": "def-789",
+ "content": "Programming basics include...",
+ "chunkContent": "...Python syntax is straightforward...",
+ "createdAt": "2024-03-19T15:30:00Z",
+ "similarity": 0.7123
+ }
+ ]
+}
+```
+
+## Notes
+
+1. Authentication is required
+2. Results are sorted by similarity score (descending)
+3. Similarity scores are normalized between 0 and 1
+4. Content is automatically chunked for better matching
+5. Performance optimizations include:
+ - Vector indexing
+ - Similarity thresholding
+ - Result limiting
+ - Score normalization
+6. The API uses the BGE base embeddings model for semantic understanding
+7. Supports both exact and semantic matching
+8. Results include both full content and relevant chunks