# Project export: Yaad

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: Cal Hacks 11.0
- Tagline: Yaad is a voice-enabled memory log that enables elderly individuals with degenerative cognitive disabilities, to log and recall memories or thoughts that they have both in the short and long term.
- Devpost: https://devpost.com/software/yaad
- GitHub: https://github.com/Arush223/yaad
- Demo: https://yaadai.vercel.app/
- Team: 3 GitHub contributor(s) — Aarush (47 commits), Siddhant Bhardwaj (30 commits), ps1526 (4 commits)

## Devpost submission (written by the team)

### Inspiration

Inspired by our personal experiences with older relatives and grandparents, we were struck by the surprising absence of voice-automated tools designed to support their daily lives. In response, we created Yaad—the Hindi word for "remember"—as a means to unlock and preserve memories through intuitive recitation and retrieval. We believe this approach not only enhances accessibility but also offers a dignified way to maintain personal connections, and we hope you will share in our vision.

### What it does

Yaad takes in input for two different functions: storing memories and retrieving memories. The user can select what they want to do and speak to the interface and get tasks and memories retrieved for them based on relevance.

### How we built it

Yaad was built using Deepgram, LangChain, Groq, OpenAI, React.js, and TypeScript

### Challenges we ran into

Due to the scope of our project, our most difficult issues were with merging the backend logic with our frontend UI.

### Accomplishments we're proud of

This is the first time that team Yaad has worked together on a Hackathon project, and it was definitely a great experience with our complimentary skills in Full-Stack, Backed, and UI/UX development.

### What we learned

In this project, we learned so much involving expressing information in new and creative ways, from generating vector embeddings in Pinecone DB to interpreting and displaying those embeddings through RAG modeling.

### What's next

We want to expand our feature set to image classification and interpretation, as well as increase the amount of accessibility features to improve our target audience's quality of life.

## README (from the GitHub repository)

# Yaad

**Built for the 2024 CalHacks Competition**

## Mission

Our mission is to create a "living memory" database that preserves and recalls cherished memories for individuals with degenerative cognitive conditions, such as Alzheimer's and dementia. By integrating AI and advanced vector-mapping technology, we offer a meaningful way to record, transcribe, and store memories, making them easily accessible through conversational prompts. Our goal is to enable users to relive their past experiences and create moments of joy, familiarity, and comfort. We aim to foster a deeper sense of connection and provide a dignified, supportive tool that nurtures memory and personal identity.

## About

**Yaad** is an innovative web application designed to preserve and revisit the cherished memories of individuals, particularly those with degenerative cognitive conditions like Alzheimer's and dementia. Our app allows users to record, transcribe, and store their memories securely while using AI to retrieve specific experiences based on prompts. With this unique blend of technology and empathy, Yaad aims to foster moments of connection, comfort, and joy through personalized memory recall.

## Technologies We Use

### Next.js
Our app is built using **Next.js**, a powerful React-based framework that enhances performance and enables seamless server-side rendering. This ensures a smooth user experience, with rapid page loading and efficient memory recall, no matter where users are located.

### Clerk for Authentication
We use **Clerk** to manage user authentication securely. It provides a user-friendly login and sign-up process, supporting features like passwordless login and multi-factor authentication, ensuring that user data and memories are kept safe and accessible only to authorized individuals.

### Pinecone for Database and Vector Embeddings
At the core of our memory retrieval system is **Pinecone**, a high-performance vector database solution. Pinecone allows us to store vector embeddings of recorded memories, enabling our AI to quickly and accurately retrieve related memories based on specific prompts. This advanced search capability makes it easier to find and relive memories that may have faded over time.

### Tailwind CSS for User Interface
We’ve designed the Living Memory interface with **Tailwind CSS**, a utility-first CSS framework. Tailwind enables rapid, responsive UI development, ensuring that our app is visually appealing, accessible, and easy to navigate for users of all ages and tech familiarity levels.

## Team Yaad
- **Aarush Jagtap** – Full Stack Engineer
- **Pranav Singh** – Back End Engineer
- **Siddhant Bhardwaj** – UI/UX Engineer


## Detected evidence (automated analysis)

Indexed codebase: 35 recognized source files, 79 KB.
- CSS (language) — detected in the code
- LangChain (technology) — detected in the code
- Next.js (technology) — detected in the code
- OpenAI (technology) — detected in the code
- React (technology) — detected in the code
- Tailwind CSS (technology) — detected in the code
- TypeScript (language) — detected in the code
- JavaScript (language) — claimed on Devpost, not found in the code

## Codebase structure (from repository index)

### Files (42 of 42)

```
.eslintrc.json
.gitignore
components.json
next.config.mjs
package.json
postcss.config.mjs
README.md
src/app/about/layout.tsx
src/app/about/page.tsx
src/app/api/retrieve/route.ts
src/app/api/speak/route.ts
src/app/api/speakandstore/route.ts
src/app/api/transcribe/route.ts
src/app/auth/sign-in/[[...rest]]/page.tsx
src/app/auth/sign-up/[[...rest]]/page.tsx
src/app/contact/layout.tsx
src/app/contact/page.tsx
src/app/globals.css
src/app/layout.tsx
src/app/page.tsx
src/app/privacy/layout.tsx
src/app/privacy/page.tsx
src/app/team/layout.tsx
src/app/team/page.tsx
src/app/terms/layout.tsx
src/app/terms/page.tsx
src/app/yaad/layout.tsx
src/app/yaad/page.tsx
src/components/Footer.tsx
src/components/Navbar.tsx
src/components/TextToSpeech.tsx
src/components/TranscriptionComponent.tsx
src/components/ui/alert.tsx
src/components/ui/button.tsx
src/components/ui/card.tsx
src/components/ui/separator.tsx
src/components/ui/slider.tsx
src/lib/utils.ts
src/middleware.ts
src/utils/apiHelpers.ts
tailwind.config.ts
tsconfig.json
```

### Dependencies

- package.json: @clerk/nextjs@^5.7.5, @clerk/themes@^2.1.37, @deepgram/sdk@^3.8.1, @langchain/pinecone@^0.1.1, @pinecone-database/pinecone@^3.0.3, @radix-ui/react-separator@^1.1.0, @radix-ui/react-slider@^1.2.1, @radix-ui/react-slot@^1.1.0, @singlestore/client@^0.0.41, @types/node@^20, @types/react@^18, @types/react-dom@^18, class-variance-authority@^0.7.0, clsx@^2.1.1, cross-fetch@^4.0.0, dotenv@^16.4.5, emailjs-com@^3.2.0, eslint@^8, eslint-config-next@14.2.15, framer-motion@^11.11.9, fs@^0.0.1-security, groq-sdk@^0.7.0, langchain@^0.3.2, lucide-react@^0.453.0, mysql2@^3.11.3, next@14.2.15, node-fetch@^2.7.0, openai@^4.68.1, postcss@^8, react@^18.3.1, react-dom@^18.3.1, react-usestateref@^1.0.9, tailwind-merge@^2.5.4, tailwindcss@^3.4.1, tailwindcss-animate@^1.0.7, typescript@^5

### Recent commits (newest first)

- Merge branch 'master' of https://github.com/Arush223/yaad
- backend updates
- Update README.md
- Merge branch 'master' of https://github.com/Arush223/yaad
- demo
- Merge branch 'master' of https://github.com/Arush223/yaad
- aribitrary push
- file fixes
- ts fixes
- eslint fixes
- api fixes
- backend commit v3
- Merge branch 'master' of https://github.com/Arush223/yaad
- updated api
- Merge branch 'master' of https://github.com/Arush223/yaad
- Too tired to remember my changes, not too crazy
- Merge branch 'master' of https://github.com/Arush223/yaad
- api fixes needed
- api fixes needed
- Merge branch 'master' of https://github.com/Arush223/yaad

## Key source files (fetched from GitHub, selected and truncated for size)

### package.json

```
{
  "name": "yaad",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@clerk/nextjs": "^5.7.5",
    "@clerk/themes": "^2.1.37",
    "@deepgram/sdk": "^3.8.1",
    "@langchain/pinecone": "^0.1.1",
    "@pinecone-database/pinecone": "^3.0.3",
    "@radix-ui/react-separator": "^1.1.0",
    "@radix-ui/react-slider": "^1.2.1",
    "@radix-ui/react-slot": "^1.1.0",
    "@singlestore/client": "^0.0.41",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.1.1",
    "cross-fetch": "^4.0.0",
    "dotenv": "^16.4.5",
    "emailjs-com": "^3.2.0",
    "framer-motion": "^11.11.9",
    "fs": "^0.0.1-security",
    "groq-sdk": "^0.7.0",
    "langchain": "^0.3.2",
    "lucide-react": "^0.453.0",
    "mysql2": "^3.11.3",
    "next": "14.2.15",
    "node-fetch": "^2.7.0",
    "openai": "^4.68.1",
    "react": "^18.3.1",
    "react-dom": "^18.3.1",
    "react-usestateref": "^1.0.9",
    "tailwind-merge": "^2.5.4",
    "tailwindcss-animate": "^1.0.7"
  },
  "devDependencies": {
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "eslint": "^8",
    "eslint-config-next": "14.2.15",
    "postcss": "^8",
    "tailwindcss": "^3.4.1",
    "typescript": "^5"
  }
}

```

### src/app/layout.tsx

```typescript
import { ClerkProvider,} from '@clerk/nextjs'
import './globals.css'
import { neobrutalism } from '@clerk/themes'

export const metadata = {
  title: 'Yaad',
  description: 'Your Living Memory',
  icons: {
    icon: "/favicon.ico",

  }
}

export default function RootLayout({ children }: { children: React.ReactNode}) {
  return (
    <ClerkProvider publishableKey={process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY} appearance={{
      layout: {
      unsafe_disableDevelopmentModeWarnings: true,
      },
      baseTheme: neobrutalism,
      variables: { 
      colorPrimary: '#4A90E2', 
      colorBackground: '#d1af8a', 
      colorText: '#333333',       
      }      
    }}>
       {/* uses the jmh typewriter font */}
    <html lang="en">
      <body>{children}</body>
    </html>
    </ClerkProvider>
  );
}
```

### src/app/page.tsx

```typescript
/* eslint-disable react/no-unescaped-entities */
'use client'
import React, { useState, useEffect } from 'react';
import Image from 'next/image';
import { useRouter } from 'next/navigation';
import Navbar from '@/components/Navbar';
import Footer from '@/components/Footer';
import { SignedIn, SignedOut } from '@clerk/nextjs';

const TypewriterText: React.FC<{ text: string; delay?: number; onComplete?: () => void }> = ({ text, delay = 100, onComplete }) => {
  const [displayText, setDisplayText] = useState('');
  const [index, setIndex] = useState(0);

  useEffect(() => {
    if (index < text.length) {
      const timer = setTimeout(() => {
        setDisplayText((prevText) => prevText + text[index]);
        setIndex((prevIndex) => prevIndex + 1);
      }, delay);
      return () => clearTimeout(timer);
    } else if (onComplete) {
      onComplete();
    }
  }, [index, text, delay, onComplete]);

  return (
    <span className="typewriter">
      {displayText}
      <span className="cursor">|</span>
    </span>
  );
};

const Page: React.FC = () => {
  const router = useRouter();
  const [showGetStarted, setShowGetStarted] = useState(false);

  const handleTitleComplete = () => {
    setShowGetStarted(true);
  };

  return (
    <div className="min-h-screen flex flex-col">
      <div className="flex-grow relative">
        <Image
          src="/paper.png"
          alt="Paper Background"
          fill
          style={{ objectFit: 'cover' }}
          quality={100}
          priority
        />
        <div className="absolute inset-0 flex flex-col">
          <Navbar />
          <div className="flex-grow flex flex-col items-center justify-center px-4 py-8">
        <h1 className="text-xl sm:text-2xl md:text-3xl lg:text-4xl xl:text-5xl font-bold text-gray-800 mb-2 sm:mb-4 text-center max-w-xs sm:max-w-sm md:max-w-md lg:max-w-lg xl:max-w-xl mx-auto">
          <TypewriterText text="Welcome to Yaad" onComplete={handleTitleComplete} />
        </h1>
        {showGetStarted && (
          <div className="mt-2 mb-4 text-base sm:text-lg md:text-xl lg:text-2xl font-semibold text-blue-600">
            <TypewriterText text="Get Started" delay={150} />
          </div>
        )}
        <div className="relative transition-transform duration-300 ease-in-out transform hover:scale-105 cursor-pointer mt-4">
          <SignedIn>
            <div onClick={() => router.push('/yaad')} className="relative group">
          <Image
            src="/typewriter.svg"
            alt="Typewriter"
            width={200}
            height={200}
            className="w-32 h-32 sm:w-40 sm:h-40 md:w-48 md:h-48 lg:w-56 lg:h-56 xl:w-64 xl:h-64"
            priority
          />
          <div className="absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-300">
            <span className="text-blue-600 font-semibold text-sm sm:text-base md:text-lg ">Go to Yaad</span>
          </div>
            </div>
          </SignedIn>
          <SignedOut>
            <div onClick={() => router.push('/auth/sign-up')} className="relative group">
          <Image
            src="/typewriter.svg"
            alt="Typewriter"
            width={200}
            height={200}
            className="w-32 h-32 sm:w-40 sm:h-40 md:w-48 md:h-48 lg:w-56 lg:h-56 xl:w-64 xl:h-64"
            priority
          />
          <div className="absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-300">
            <span className="text-blue-600 font-semibold text-sm sm:text-base md:text-lg">Sign Up</span>
          </div>
            </div>
          </SignedOut>
        </div>
          </div>
        </div>
      </div>
      <Footer className='text-white bg-black'/>
    </div>
  );
};

export default Page;

```

### src/app/about/layout.tsx

```typescript
import React from "react";

const Layout = ({ children }: { children: React.ReactNode }) => {
    return (
        <div className="flex flex-col h-screen text-black-00000">
            <main className="flex-grow overflow-y-auto">
                {children}
            </main>
        </div>
    );
};

export default Layout;

```

### src/app/yaad/layout.tsx

```typescript
import React from "react";

const Layout = ({ children }: { children: React.ReactNode }) => {
    return (
        <div className="flex flex-col h-screen bg-black text-gray-800">
            <main className="flex-grow overflow-y-auto">
                {children}
            </main>
        </div>
    );
};

export default Layout;

```

### src/app/contact/layout.tsx

```typescript
import React from "react";

const Layout = ({ children }: { children: React.ReactNode }) => {
    return (
        <div className="flex flex-col h-screen bg-white text-black-00000">
            <main className="flex-grow overflow-y-auto">
                {children}
            </main>
        </div>
    );
};

export default Layout;

```

### src/app/privacy/layout.tsx

```typescript
import React from "react";

const Layout = ({ children }: { children: React.ReactNode }) => {
    return (
        <div className="flex flex-col h-screen bg-white text-black-00000">
            <main className="flex-grow overflow-y-auto">
                {children}
            </main>
        </div>
    );
};

export default Layout;

```

### src/app/team/layout.tsx

```typescript
import React from "react";

const Layout = ({ children }: { children: React.ReactNode }) => {
    return (
        <div className="flex flex-col h-screen bg-white text-black-00000">
            <main className="flex-grow overflow-y-auto">
                {children}
            </main>
        </div>
    );
};

export default Layout;

```

### src/app/terms/layout.tsx

```typescript
import React from "react";

const Layout = ({ children }: { children: React.ReactNode }) => {
    return (
        <div className="flex flex-col h-screen bg-white text-black-00000">
            <main className="flex-grow overflow-y-auto">
                {children}
            </main>
        </div>
    );
};

export default Layout;

```

### src/app/privacy/page.tsx

```typescript
import React from 'react'
import Navbar from '@/components/Navbar'
import Footer from '@/components/Footer'

const PrivacyPolicyPage: React.FC = () => {
  return (
    <div 
      className="min-h-screen flex flex-col bg-cover bg-center bg-no-repeat"
      style={{ backgroundImage: "url('/paper.png')" }}
    >
      <Navbar />

      <main className="flex-grow container mx-auto px-4 py-20">
        <div className="max-w-2xl mx-auto bg-white p-8 rounded-2xl shadow-md">
          <h1 className="text-3xl font-bold mb-6 text-center">Privacy Policy</h1>
          
          <p className="mb-4"><strong>Effective Date:</strong> October 2024</p>
          <p className="mb-6">At Yaad, we respect your privacy and are committed to protecting the personal information you provide to us. This privacy policy outlines how we collect, use, and safeguard your data when you interact with our application.</p>
          
          <h2 className="text-2xl font-semibold mt-8 mb-4">1. Information We Collect</h2>
          <ul className="list-disc list-inside mb-6">
            <li><strong>Personal Information:</strong> When you sign up or contact us, we may collect your name and email address.</li>
            <li><strong>Usage Data:</strong> We may collect anonymous usage data, such as your interaction with the app, pages viewed, and time spent on the platform.</li>
          </ul>

          <h2 className="text-2xl font-semibold mt-8 mb-4">2. How We Use Your Information</h2>
          <ul className="list-disc list-inside mb-6">
            <li>Provide and improve our service.</li>
            <li>Respond to inquiries and support requests.</li>
            <li>Monitor app usage to improve user experience.</li>
          </ul>

          <h2 className="text-2xl font-semibold mt-8 mb-4">3. Data Security</h2>
          <p className="mb-6">We take reasonable steps to protect your data and ensure its confidentiality. However, no system is completely secure, and we cannot guarantee the absolute security of your data.</p>

          <h2 className="text-2xl font-semibold mt-8 mb-4">4. Contact Us</h2>
          <p className="mb-6">If you have any questions or concerns about these terms, feel free to contact us at our <a href="/contact" className="text-blue-700 underline"/>contact page.</p>

          <p className="mt-8 text-sm text-gray-600">This privacy policy may be updated from time to time, and we encourage you to review it periodically.</p>
        </div>
      </main>

      <Footer className = "text-white bg-black"/>
    </div>
  )
}

export default PrivacyPolicyPage

```

[24 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]