main da934aeb9612 cached
77 files
126.5 KB
34.2k tokens
39 symbols
1 requests
Download .txt
Repository: get-convex/turbo-expo-nextjs-clerk-convex-monorepo
Branch: main
Commit: da934aeb9612
Files: 77
Total size: 126.5 KB

Directory structure:
gitextract_vxwibcq7/

├── .gitignore
├── .prettierrc
├── LICENSE
├── README.md
├── apps/
│   ├── native/
│   │   ├── .example.env
│   │   ├── .gitignore
│   │   ├── ConvexClientProvider.tsx
│   │   ├── app.json
│   │   ├── babel.config.js
│   │   ├── index.tsx
│   │   ├── metro.config.js
│   │   ├── package.json
│   │   ├── src/
│   │   │   ├── app/
│   │   │   │   ├── (app)/
│   │   │   │   │   ├── _layout.tsx
│   │   │   │   │   ├── index.tsx
│   │   │   │   │   └── notes/
│   │   │   │   │       ├── [noteId].tsx
│   │   │   │   │       └── new.tsx
│   │   │   │   ├── (auth)/
│   │   │   │   │   ├── _layout.tsx
│   │   │   │   │   └── sign-in.tsx
│   │   │   │   └── _layout.tsx
│   │   │   └── screens/
│   │   │       ├── CreateNoteScreen.tsx
│   │   │       ├── InsideNoteScreen.tsx
│   │   │       ├── LoginScreen.tsx
│   │   │       └── NotesDashboardScreen.tsx
│   │   └── tsconfig.json
│   └── web/
│       ├── .example.env
│       ├── .gitignore
│       ├── eslint.config.mjs
│       ├── package.json
│       ├── postcss.config.js
│       ├── src/
│       │   ├── app/
│       │   │   ├── ConvexClientProvider.tsx
│       │   │   ├── globals.css
│       │   │   ├── layout.tsx
│       │   │   ├── notes/
│       │   │   │   ├── [slug]/
│       │   │   │   │   └── page.tsx
│       │   │   │   └── page.tsx
│       │   │   └── page.tsx
│       │   ├── components/
│       │   │   ├── Header.tsx
│       │   │   ├── common/
│       │   │   │   ├── Logo.tsx
│       │   │   │   ├── Menu.tsx
│       │   │   │   ├── TestTimonialCard.tsx
│       │   │   │   ├── UserNav.tsx
│       │   │   │   ├── avatar.tsx
│       │   │   │   ├── button.tsx
│       │   │   │   └── dropdown-menu.tsx
│       │   │   ├── home/
│       │   │   │   ├── Benefits.tsx
│       │   │   │   ├── ComplexToggle.tsx
│       │   │   │   ├── Footer.tsx
│       │   │   │   ├── FooterHero.tsx
│       │   │   │   ├── Hero.tsx
│       │   │   │   └── Testimonials.tsx
│       │   │   └── notes/
│       │   │       ├── Checkbox.tsx
│       │   │       ├── CreateNote.tsx
│       │   │       ├── DeleteNote.tsx
│       │   │       ├── NoteDetails.tsx
│       │   │       ├── NoteItem.tsx
│       │   │       └── Notes.tsx
│       │   ├── lib/
│       │   │   └── utils.ts
│       │   └── proxy.ts
│       ├── tsconfig.json
│       └── vercel.json
├── package.json
├── packages/
│   └── backend/
│       ├── .gitignore
│       ├── convex/
│       │   ├── README.md
│       │   ├── _generated/
│       │   │   ├── api.d.ts
│       │   │   ├── api.js
│       │   │   ├── dataModel.d.ts
│       │   │   ├── server.d.ts
│       │   │   └── server.js
│       │   ├── auth.config.ts
│       │   ├── notes.ts
│       │   ├── openai.ts
│       │   ├── schema.ts
│       │   ├── tsconfig.json
│       │   └── utils.ts
│       └── package.json
├── pnpm-workspace.yaml
├── renovate.json
└── turbo.json

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
.pnp
.pnp.js

# testing
coverage

# next.js
.next/
.swc/
out/
build

# expo
.expo

# misc
.DS_Store
*.pem
dist

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
.env

# turbo
.turbo


================================================
FILE: .prettierrc
================================================
{
  "arrowParens": "always"
}


================================================
FILE: LICENSE
================================================

                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright 2024 Convex, Inc.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.


================================================
FILE: README.md
================================================
# Fullstack Monorepo Template

This repo is a modern TypeScript monorepo for a shared notes app across web and native.

It currently uses:

- [Turborepo](https://turbo.build/repo)
- [pnpm](https://pnpm.io/)
- [Next.js 16](https://nextjs.org/) with the App Router
- [Expo SDK 55](https://docs.expo.dev/) with Expo Router
- [React 19](https://react.dev/)
- [Convex](https://convex.dev/)
- [Clerk](https://clerk.com/)
- [OpenAI](https://platform.openai.com/docs/quickstart?api-mode=responses) for optional note summaries

## What’s inside

- `apps/web` - the Next.js web app
- `apps/native` - the Expo native app
- `packages/backend` - the Convex backend and generated API types

## Quick start

### 1. Install dependencies

```sh
pnpm install
```

### 2. Configure Convex

Run the backend setup command:

```sh
pnpm --filter @packages/backend setup
```

This will log you into Convex, create or connect a project, and generate `packages/backend/.env.local`.

### 3. Configure Clerk for Convex

Follow the official [Convex + Clerk guide](https://docs.convex.dev/auth/clerk).

In the Clerk dashboard, enable the Convex integration and copy the Clerk JWT issuer domain. Add it to your Convex environment variables as:

```sh
CLERK_JWT_ISSUER_DOMAIN=https://your-frontend-api.clerk.accounts.dev
```

If you want native social login, enable Google and Apple in Clerk as well.

If you want AI summaries, also add:

```sh
OPENAI_API_KEY=...
```

to your Convex environment variables.

### 4. Configure the app env files

Create `.env.local` files in `apps/web` and `apps/native` from the provided `.example.env` files.

- Use `CONVEX_URL` from `packages/backend/.env.local` for both `NEXT_PUBLIC_CONVEX_URL` and `EXPO_PUBLIC_CONVEX_URL`
- Use your Clerk publishable key for both app env files
- Use your Clerk secret key in `apps/web/.env.local`

### 5. Run the apps

```sh
pnpm dev
```

This runs the backend, web app, and native app through Turbo.

## Deploying

From `apps/web`, use Convex to deploy the backend and build the web app:

```sh
cd ../../packages/backend && pnpm exec convex deploy --cmd 'cd ../../apps/web && pnpm build' --cmd-url-env-var-name NEXT_PUBLIC_CONVEX_URL
```

`apps/web/vercel.json` is already set up for this flow on Vercel.

## Adding dependencies

Install dependencies in the package that actually uses them.

Examples:

```sh
pnpm --filter web-app add mypackage@latest
pnpm --filter native-app add mypackage@latest
pnpm --filter @packages/backend add mypackage@latest
```

## Notes

- The native app uses Expo Router route groups under `apps/native/src/app`
- The web app protects note routes with `apps/web/src/proxy.ts`
- Convex enforces note ownership server-side in `packages/backend/convex/notes.ts`


================================================
FILE: apps/native/.example.env
================================================
EXPO_PUBLIC_CONVEX_URL=
EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY=


================================================
FILE: apps/native/.gitignore
================================================
node_modules/
.expo/
dist/
npm-debug.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/

# macOS
.DS_Store

# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*

# @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb
# The following patterns were generated by expo-cli

expo-env.d.ts
# @end expo-cli

================================================
FILE: apps/native/ConvexClientProvider.tsx
================================================
import { type ReactNode } from "react";
import { ClerkProvider, useAuth } from "@clerk/clerk-expo";
import { tokenCache } from "@clerk/clerk-expo/token-cache";
import { ConvexReactClient } from "convex/react";
import { ConvexProviderWithClerk } from "convex/react-clerk";

const convexUrl = process.env.EXPO_PUBLIC_CONVEX_URL;
const clerkPublishableKey = process.env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY;

if (!convexUrl)
  throw new Error(
    "Missing EXPO_PUBLIC_CONVEX_URL for the native Convex client",
  );

if (!clerkPublishableKey)
  throw new Error(
    "Missing EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY for the native Clerk client",
  );

const convex = new ConvexReactClient(convexUrl);

export default function ConvexClientProvider({
  children,
}: {
  children: ReactNode;
}) {
  return (
    <ClerkProvider publishableKey={clerkPublishableKey} tokenCache={tokenCache}>
      <ConvexProviderWithClerk client={convex} useAuth={useAuth}>
        {children}
      </ConvexProviderWithClerk>
    </ClerkProvider>
  );
}


================================================
FILE: apps/native/app.json
================================================
{
  "expo": {
    "newArchEnabled": true,
    "name": "NotesContract",
    "slug": "NotesContract",
    "scheme": "notescontract",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "userInterfaceStyle": "light",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#0D87E1"
    },
    "assetBundlePatterns": ["**/*"],
    "ios": {
      "supportsTablet": true
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#ffffff"
      }
    },
    "web": {
      "bundler": "metro",
      "favicon": "./assets/favicon.png"
    },
    "plugins": [
      [
        "expo-router",
        {
          "root": "./src/app"
        }
      ],
      "expo-font",
      "expo-secure-store"
    ],
    "experiments": {
      "typedRoutes": true
    }
  }
}


================================================
FILE: apps/native/babel.config.js
================================================
module.exports = function (api) {
  api.cache(true);
  return {
    presets: ["babel-preset-expo"],
  };
};


================================================
FILE: apps/native/index.tsx
================================================
import * as WebBrowser from "expo-web-browser";

WebBrowser.maybeCompleteAuthSession();

import "expo-router/entry";


================================================
FILE: apps/native/metro.config.js
================================================
const { getDefaultConfig } = require("expo/metro-config");

module.exports = getDefaultConfig(__dirname);


================================================
FILE: apps/native/package.json
================================================
{
  "name": "native-app",
  "version": "1.0.0",
  "main": "index.tsx",
  "scripts": {
    "dev": "expo start",
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "typecheck": "tsc --noEmit"
  },
  "dependencies": {
    "@clerk/clerk-expo": "^2.19.31",
    "@expo/vector-icons": "^15.1.1",
    "@packages/backend": "workspace:*",
    "expo": "~55.0.16",
    "expo-asset": "~55.0.16",
    "expo-auth-session": "~55.0.15",
    "expo-constants": "~55.0.15",
    "expo-font": "~55.0.6",
    "expo-linking": "~55.0.14",
    "expo-router": "~55.0.13",
    "expo-secure-store": "~55.0.13",
    "expo-system-ui": "~55.0.16",
    "expo-web-browser": "~55.0.14",
    "react": "19.2.0",
    "react-dom": "19.2.0",
    "react-native": "0.83.6",
    "react-native-gesture-handler": "~2.30.1",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-reanimated": "~4.2.1",
    "react-native-responsive-fontsize": "^0.5.1",
    "react-native-safe-area-context": "5.6.2",
    "react-native-screens": "~4.23.0",
    "react-native-web": "~0.21.2",
    "react-native-worklets": "0.7.4"
  },
  "devDependencies": {
    "@babel/core": "7.29.0",
    "@types/jest": "29.5.14",
    "@types/react": "19.2.14",
    "@types/react-test-renderer": "19.1.0",
    "jest": "29.7.0",
    "jest-expo": "55.0.16",
    "react-test-renderer": "19.2.0",
    "typescript": "5.9.3"
  },
  "private": true
}


================================================
FILE: apps/native/src/app/(app)/_layout.tsx
================================================
import { useAuth } from "@clerk/clerk-expo";
import { Redirect, Stack } from "expo-router";

export default function AppLayout() {
  const { isLoaded, isSignedIn } = useAuth();

  if (!isLoaded) return null;

  if (!isSignedIn) return <Redirect href="/sign-in" />;

  return <Stack screenOptions={{ headerShown: false }} />;
}


================================================
FILE: apps/native/src/app/(app)/index.tsx
================================================
export { default } from "../../screens/NotesDashboardScreen";


================================================
FILE: apps/native/src/app/(app)/notes/[noteId].tsx
================================================
export { default } from "../../../screens/InsideNoteScreen";


================================================
FILE: apps/native/src/app/(app)/notes/new.tsx
================================================
export { default } from "../../../screens/CreateNoteScreen";


================================================
FILE: apps/native/src/app/(auth)/_layout.tsx
================================================
import { useAuth } from "@clerk/clerk-expo";
import { Redirect, Stack } from "expo-router";

export default function AuthLayout() {
  const { isLoaded, isSignedIn } = useAuth();

  if (!isLoaded) return null;

  if (isSignedIn) return <Redirect href="/" />;

  return <Stack screenOptions={{ headerShown: false }} />;
}


================================================
FILE: apps/native/src/app/(auth)/sign-in.tsx
================================================
export { default } from "../../screens/LoginScreen";


================================================
FILE: apps/native/src/app/_layout.tsx
================================================
import { useFonts } from "expo-font";
import { Stack } from "expo-router";
import { Platform, StatusBar, View } from "react-native";
import ConvexClientProvider from "../../ConvexClientProvider";

const statusBarHeight =
  Platform.OS === "ios" ? 50 : (StatusBar.currentHeight ?? 0);

export default function RootLayout() {
  const [loaded] = useFonts({
    Bold: require("../assets/fonts/Inter-Bold.ttf"),
    SemiBold: require("../assets/fonts/Inter-SemiBold.ttf"),
    Medium: require("../assets/fonts/Inter-Medium.ttf"),
    Regular: require("../assets/fonts/Inter-Regular.ttf"),
    MBold: require("../assets/fonts/Montserrat-Bold.ttf"),
    MSemiBold: require("../assets/fonts/Montserrat-SemiBold.ttf"),
    MMedium: require("../assets/fonts/Montserrat-Medium.ttf"),
    MRegular: require("../assets/fonts/Montserrat-Regular.ttf"),
    MLight: require("../assets/fonts/Montserrat-Light.ttf"),
  });

  if (!loaded) return null;

  return (
    <ConvexClientProvider>
      <View style={{ flex: 1 }}>
        <View style={{ height: statusBarHeight, backgroundColor: "#0D87E1" }}>
          <StatusBar
            translucent
            backgroundColor="#0D87E1"
            barStyle="light-content"
          />
        </View>
        <Stack screenOptions={{ headerShown: false }} />
      </View>
    </ConvexClientProvider>
  );
}


================================================
FILE: apps/native/src/screens/CreateNoteScreen.tsx
================================================
import React, { useEffect, useRef, useState } from "react";
import {
  StyleSheet,
  Text,
  View,
  Image,
  Dimensions,
  TouchableOpacity,
  TextInput,
  Keyboard,
  Animated,
  Alert,
} from "react-native";
import { RFValue } from "react-native-responsive-fontsize";
import { AntDesign } from "@expo/vector-icons";
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
import { api } from "@packages/backend/convex/_generated/api";
import { useConvexAuth, useMutation, useQuery } from "convex/react";
import { useRouter } from "expo-router";

const { width } = Dimensions.get("window");

export default function CreateNoteScreen() {
  const router = useRouter();
  const { isLoading, isAuthenticated } = useConvexAuth();
  const createNote = useMutation(api.notes.createNote);
  const openaiKeySet = useQuery(api.openai.openaiKeySet) ?? false;

  const [isAdvancedSummarizationEnabled, setIsAdvancedSummarizationEnabled] =
    useState(false);
  const [noteContent, setNoteContent] = useState("");
  const [noteTitle, setNoteTitle] = useState("");
  const footerY = useRef(new Animated.Value(0)).current;

  const toggleAdvancedSummarization = () => {
    setIsAdvancedSummarizationEnabled(!isAdvancedSummarizationEnabled);
  };

  useEffect(() => {
    const keyboardDidShowListener = Keyboard.addListener(
      "keyboardDidShow",
      () => {
        // Slide down the footer
        Animated.timing(footerY, {
          toValue: 1,
          duration: 300,
          useNativeDriver: true,
        }).start();
      },
    );
    const keyboardDidHideListener = Keyboard.addListener(
      "keyboardDidHide",
      () => {
        // Slide up the footer
        Animated.timing(footerY, {
          toValue: 0,
          duration: 300,
          useNativeDriver: true,
        }).start();
      },
    );

    // Clean up function
    return () => {
      keyboardDidShowListener.remove();
      keyboardDidHideListener.remove();
    };
  }, [footerY]);

  // Calculate the position of the footer based on the Animated.Value
  const footerTranslateY = footerY.interpolate({
    inputRange: [0, 1],
    outputRange: [0, 100], // Adjust this range according to the height of your footer
  });

  const createUserNote = async () => {
    if (!noteTitle.trim() || !noteContent.trim()) {
      Alert.alert("Missing fields", "Please add both a title and content.");
      return;
    }

    if (isLoading) {
      Alert.alert(
        "Please wait",
        "Authenticating with backend, try again in a moment.",
      );
      return;
    }

    if (!isAuthenticated) {
      Alert.alert(
        "Not authenticated with backend",
        "Please wait a moment or re-open the app and try again.",
      );
      return;
    }

    try {
      await createNote({
        title: noteTitle,
        content: noteContent,
        isSummary: isAdvancedSummarizationEnabled,
      });
      router.replace("/");
    } catch (error) {
      Alert.alert("Failed to create note", String(error));
    }
  };

  return (
    <View style={styles.container}>
      <View style={styles.header}>
        <Image
          source={require("../assets/icons/logo2small.png")} // Replace with your logo image file
          style={styles.logo}
        />
      </View>

      <View style={styles.underHeaderContainer}>
        <TouchableOpacity
          onPress={() => {
            router.back();
          }}
        >
          <Image
            style={styles.arrowBack}
            source={require("../assets/icons/arrow-back.png")}
          />
        </TouchableOpacity>

        <Text style={styles.title}>Create a New Note</Text>
        <TouchableOpacity>
          <Image
            style={styles.arrowBack}
            source={require("../assets/icons/saveIcon.png")}
          />
        </TouchableOpacity>
      </View>

      <KeyboardAwareScrollView
        showsVerticalScrollIndicator={false}
        contentContainerStyle={{ paddingBottom: 100 }}
      >
        <View style={styles.inputContainer}>
          <Text style={styles.inputLabel}>Title</Text>
          <TextInput
            value={noteTitle}
            onChangeText={(val: string) => setNoteTitle(val)}
            style={styles.inputField}
            placeholder="Note Title"
            placeholderTextColor="#A9A9A9"
          />
          <Text style={styles.inputLabel}>Content</Text>
          <TextInput
            value={noteContent}
            onChangeText={(val: string) => setNoteContent(val)}
            style={[styles.inputField, styles.inputFieldMulti]}
            multiline
            placeholder="Note Comments"
            placeholderTextColor="#A9A9A9"
          />
        </View>
        <Text
          style={{ ...styles.inputLabel, paddingHorizontal: 27, marginTop: 10 }}
        >
          AI Features
        </Text>

        {/* Advanced Summarization Section */}
        <View style={styles.advancedSummarizationContainer}>
          <View style={styles.advancedSummarizationCheckboxContainer}>
            <TouchableOpacity
              onPress={toggleAdvancedSummarization}
              style={openaiKeySet ? styles.checkbox : styles.checkboxDisabled}
              disabled={!openaiKeySet}
            >
              {isAdvancedSummarizationEnabled && (
                <AntDesign name="check" size={RFValue(12.5)} color="#0D87E1" />
              )}
            </TouchableOpacity>
            <Text style={styles.advancedSummarizationText}>
              Advanced Summarization {openaiKeySet ? "" : " (Disabled)"}
            </Text>
          </View>
          <Text style={styles.advancedSummarizationSubtext}>
            {openaiKeySet
              ? "Check this box if you want to generate summaries using AI."
              : "Please set OPENAI_API_KEY in your environment variables."}
          </Text>
        </View>
      </KeyboardAwareScrollView>
      <Animated.View
        style={[
          styles.newNoteButtonContainer,
          { transform: [{ translateY: footerTranslateY }] },
        ]}
      >
        <TouchableOpacity onPress={createUserNote} style={styles.newNoteButton}>
          <AntDesign name="plus-circle" size={20} color="#fff" />
          <Text style={styles.newNoteButtonText}>Create a New Note</Text>
        </TouchableOpacity>
      </Animated.View>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff",
  },
  header: {
    backgroundColor: "#0D87E1",
    height: 67,
    justifyContent: "center",
    alignItems: "center",
  },
  logo: {
    width: 46,
    height: 46,
    borderRadius: 20,
    resizeMode: "contain",
  },
  underHeaderContainer: {
    width: width,
    height: 62,
    backgroundColor: "#fff",
    borderBottomWidth: 2,
    borderBottomColor: "#D9D9D9",
    flexDirection: "row",
    alignItems: "center",
    justifyContent: "space-between",
    paddingHorizontal: 16,
  },
  arrowBack: {
    width: 20,
    height: 20,
    resizeMode: "contain",
  },
  title: {
    fontSize: RFValue(17.5),
    fontFamily: "MMedium",
    color: "#2D2D2D",
  },
  inputContainer: {
    paddingHorizontal: 27,
    marginTop: 43,
  },
  inputLabel: {
    fontSize: RFValue(15),
    fontFamily: "MMedium",
    color: "#000",
    marginBottom: 6,
  },
  inputField: {
    backgroundColor: "#FFF",
    marginBottom: 30,
    fontSize: RFValue(15),
    fontFamily: "MLight",
    color: "#000",
    borderRadius: 8,
    paddingHorizontal: 14,
    paddingVertical: 12.5,
    borderWidth: 1,
    borderColor: "#D9D9D9",
  },
  inputFieldMulti: {
    minHeight: 228,
    textAlignVertical: "top",
    paddingTop: 10,
  },
  advancedSummarizationContainer: {
    paddingHorizontal: 27,
    marginTop: 10,
  },
  advancedSummarizationCheckboxContainer: {
    flexDirection: "row",
    alignItems: "center",
    marginBottom: 8,
  },
  checkbox: {
    width: RFValue(17.5),
    height: RFValue(17.5),
    borderRadius: RFValue(5),
    borderWidth: 1,
    borderColor: "#0D87E1",
    justifyContent: "center",
    alignItems: "center",
    marginRight: RFValue(10),
    backgroundColor: "#F9F5FF",
  },
  checkboxDisabled: {
    width: RFValue(17.5),
    height: RFValue(17.5),
    borderRadius: RFValue(5),
    borderWidth: 1,
    borderColor: "#D9D9D9",
    justifyContent: "center",
    alignItems: "center",
    marginRight: RFValue(10),
    backgroundColor: "#F9F5FF",
  },
  advancedSummarizationText: {
    fontSize: RFValue(15),
    fontFamily: "MLight",
    color: "#000",
  },
  advancedSummarizationSubtext: {
    fontSize: RFValue(12.5),
    fontFamily: "MRegular",
    color: "#A9A9A9",
    paddingHorizontal: 30,
  },
  newNoteButton: {
    flexDirection: "row",
    backgroundColor: "#0D87E1",
    borderRadius: 7,
    width: width / 1.6,
    alignSelf: "center",
    alignItems: "center",
    justifyContent: "center",
    minHeight: 44,
    position: "absolute",
    bottom: 35,
    shadowColor: "#000",
    shadowOffset: {
      width: 0,
      height: 3,
    },
    shadowOpacity: 0.27,
    shadowRadius: 4.65,
    elevation: 6,
  },
  newNoteButtonText: {
    color: "white",
    fontSize: RFValue(15),
    fontFamily: "MMedium",
    marginLeft: 10,
  },
  newNoteButtonContainer: {
    position: "absolute",
    bottom: 0,
    alignSelf: "center",
    // ... other styles you need
  },
});


================================================
FILE: apps/native/src/screens/InsideNoteScreen.tsx
================================================
import React, { useState } from "react";
import { api } from "@packages/backend/convex/_generated/api";
import { useQuery } from "convex/react";
import { useLocalSearchParams, useRouter } from "expo-router";
import {
  StyleSheet,
  Text,
  View,
  Image,
  Dimensions,
  TouchableOpacity,
  ScrollView,
} from "react-native";
import { RFValue } from "react-native-responsive-fontsize";

const { width } = Dimensions.get("window");

export default function InsideNoteScreen() {
  const router = useRouter();
  const { noteId } = useLocalSearchParams<{ noteId: string }>();
  const note = useQuery(api.notes.getNote, {
    id: noteId ?? undefined,
  });
  const [activeTab, setActiveTab] = useState("original");
  const noteContentText = !note
    ? "Note not found"
    : activeTab === "original"
      ? note.content
      : note.summary
        ? note.summary
        : "No summary available";

  return (
    <View style={styles.container}>
      <View style={styles.header}>
        <Image
          source={require("../assets/icons/logo2small.png")}
          style={styles.logo}
        />
      </View>

      <View style={styles.underHeaderContainer}>
        <TouchableOpacity
          onPress={() => {
            router.back();
          }}
        >
          <Image
            style={styles.arrowBack}
            source={require("../assets/icons/arrow-back.png")}
          />
        </TouchableOpacity>

        <Text style={styles.title}>{note?.title ?? "Note"}</Text>
        <TouchableOpacity></TouchableOpacity>
      </View>

      <ScrollView
        showsVerticalScrollIndicator={false}
        contentContainerStyle={{ paddingBottom: 100 }}
      >
        <View style={styles.contentContainer}>
          <Text style={styles.contentDescription}>{noteContentText}</Text>
        </View>
      </ScrollView>

      {/* Sticky footer */}
      <View style={styles.footer}>
        <TouchableOpacity
          style={[
            styles.footerTab,
            activeTab === "original" && styles.activeTab,
          ]}
          onPress={() => setActiveTab("original")}
        >
          <Image
            source={require("../assets/icons/OrignalIcon.png")} // Replace with your original icon image file
            style={[
              styles.footerIcon,
              activeTab === "original"
                ? styles.activeIcon
                : styles.inactiveIcon,
            ]}
          />
          <Text
            style={[
              styles.footerText,
              activeTab === "original"
                ? styles.activeTabText
                : styles.inactiveTabText,
            ]}
          >
            Original
          </Text>
        </TouchableOpacity>
        <TouchableOpacity
          style={[
            styles.footerTab,
            activeTab === "summary" && styles.activeTab,
          ]}
          onPress={() => setActiveTab("summary")}
        >
          <Image
            source={require("../assets/icons/summaryIcon.png")} // Replace with your summary icon image file
            style={[
              styles.footerIcon,
              activeTab === "summary" ? styles.activeIcon : styles.inactiveIcon,
            ]}
          />
          <Text
            style={[
              styles.footerText,
              activeTab === "summary"
                ? styles.activeTabText
                : styles.inactiveTabText,
            ]}
          >
            Summary
          </Text>
        </TouchableOpacity>
      </View>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#F5F7FE",
  },
  header: {
    backgroundColor: "#0D87E1",
    height: 67,
    justifyContent: "center",
    alignItems: "center",
  },
  logo: {
    width: 46,
    height: 46,
    borderRadius: 20,
    resizeMode: "contain",
  },
  underHeaderContainer: {
    width: width,
    height: 62,
    backgroundColor: "#fff",
    borderBottomWidth: 2,
    borderBottomColor: "#D9D9D9",
    flexDirection: "row",
    alignItems: "center",
    justifyContent: "space-between",
    paddingHorizontal: 16,
  },
  arrowBack: {
    width: 20,
    height: 20,
    resizeMode: "contain",
  },
  title: {
    fontSize: RFValue(17.5),
    fontFamily: "MMedium",
    color: "#2D2D2D",
  },
  contentContainer: {
    // Add styles for contentContainer if needed
  },
  contentTitle: {
    fontSize: RFValue(17.5),
    fontFamily: "MMedium",
    color: "#000",
    textAlign: "center",
    marginTop: 28,
  },
  contentDescription: {
    fontSize: RFValue(17.5),
    fontFamily: "MRegular",
    alignSelf: "center",
    textAlign: "justify",
    paddingLeft: 29,
    paddingRight: 21,
    marginTop: 30,
  },
  footer: {
    flexDirection: "row",
    position: "absolute",
    bottom: 0,
    left: 0,
    right: 0,
    backgroundColor: "#fff",
    borderTopWidth: 1,
    borderTopColor: "#D9D9D9",
  },
  footerTab: {
    flex: 1,
    padding: 12,
    justifyContent: "center",
    alignItems: "center",
  },
  footerIcon: {
    width: 25,
    height: 25,
    resizeMode: "contain",
  },
  activeTab: {
    backgroundColor: "#0D87E1",
  },
  activeIcon: {
    tintColor: "#fff",
  },
  inactiveIcon: {
    tintColor: "#000",
  },
  footerText: {
    fontSize: RFValue(12.5),
    fontFamily: "MRegular",
  },
  activeTabText: {
    color: "#fff",
  },
  inactiveTabText: {
    color: "#000",
  },
});


================================================
FILE: apps/native/src/screens/LoginScreen.tsx
================================================
import React from "react";
import { StyleSheet, View, Text, TouchableOpacity, Image } from "react-native";
import { useSSO } from "@clerk/clerk-expo";
import { RFValue } from "react-native-responsive-fontsize";
import { AntDesign } from "@expo/vector-icons";
import { useRouter } from "expo-router";

type OAuthStrategy = "oauth_google" | "oauth_apple";

const LoginScreen = () => {
  const router = useRouter();
  const { startSSOFlow } = useSSO();

  const onPress = async ({ strategy }: { strategy: OAuthStrategy }) => {
    try {
      const { createdSessionId, setActive } = await startSSOFlow({ strategy });
      if (!createdSessionId || !setActive) return;

      await setActive({ session: createdSessionId });
      router.replace("/");
    } catch (err) {
      const message = String(err);
      if (message.includes("already signed in")) {
        return;
      }

      console.error("OAuth error", err);
    }
  };

  return (
    <View style={styles.container}>
      <View style={styles.card}>
        <Image
          source={require("../assets/icons/logo.png")} // Ensure the correct path to your logo image file
          style={styles.logo}
        />
        <Text style={styles.title}>Log in to your account</Text>
        <Text style={styles.subtitle}>Welcome! Please login below.</Text>
        <TouchableOpacity
          style={styles.buttonGoogle}
          onPress={() => {
            onPress({ strategy: "oauth_google" });
          }}
        >
          <Image
            style={styles.googleIcon}
            source={require("../assets/icons/google.png")}
          />
          <Text style={{ ...styles.buttonText, color: "#344054" }}>
            Continue with Google
          </Text>
        </TouchableOpacity>

        <TouchableOpacity
          style={styles.buttonApple}
          onPress={() => {
            onPress({ strategy: "oauth_apple" });
          }}
        >
          <AntDesign name="apple" size={24} color="black" />
          <Text
            style={{ ...styles.buttonText, color: "#344054", marginLeft: 12 }}
          >
            Continue with Apple
          </Text>
        </TouchableOpacity>

        <View style={styles.signupContainer}>
          <Text style={{ fontFamily: "Regular" }}>Don’t have an account? </Text>
          <Text>Sign up above.</Text>
        </View>
      </View>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff",
  },
  card: {
    backgroundColor: "#fff",
    padding: 10,
    alignItems: "center",
    width: "98%",
  },
  logo: {
    width: 74,
    height: 74,
    marginTop: 20,
  },
  title: {
    marginTop: 49,
    fontSize: RFValue(21),
    fontFamily: "SemiBold",
  },
  subtitle: {
    marginTop: 8,
    fontSize: RFValue(14),
    color: "#000",
    fontFamily: "Regular",
    marginBottom: 32,
    textAlign: "center",
  },
  input: {
    width: "100%",
    borderWidth: 1,
    borderColor: "#D0D5DD",
    borderRadius: 10,
    padding: 14,
    marginBottom: 16,
    fontFamily: "Regular",
    fontSize: RFValue(14),
  },
  buttonEmail: {
    backgroundColor: "#0D87E1",
    padding: 15,
    borderRadius: 10,
    width: "100%",
    marginBottom: 24,
    minHeight: 44,
  },
  buttonText: {
    textAlign: "center",
    color: "#FFF",
    fontFamily: "SemiBold",
    fontSize: RFValue(14),
  },
  buttonTextWithIcon: {
    marginLeft: 10,
  },
  dividerContainer: {
    flexDirection: "row",
    alignItems: "center",
    width: "100%",
    marginBottom: 24,
  },
  divider: {
    flex: 1,
    height: 1,
    backgroundColor: "#000",
  },
  dividerText: {
    marginHorizontal: 10,
    color: "#000",
    fontFamily: "Medium",
  },
  buttonGoogle: {
    flexDirection: "row",
    alignItems: "center",
    justifyContent: "center",
    backgroundColor: "#FFF",
    borderRadius: 10,
    borderWidth: 1,
    borderColor: "#D0D5DD",
    width: "100%",
    marginBottom: 12,
    height: 44,
  },
  buttonApple: {
    flexDirection: "row",
    justifyContent: "center",
    alignItems: "center",
    backgroundColor: "#FFF",
    padding: 15,
    borderRadius: 10,
    borderWidth: 1,
    borderColor: "#D0D5DD",
    width: "100%",
    marginBottom: 32,
  },
  signupContainer: {
    flexDirection: "row",
  },
  signupText: {
    color: "#4D9DE0",
    fontFamily: "SemiBold",
  },
  googleIcon: {
    width: 24,
    height: 24,
    marginRight: 12,
  },
  errorText: {
    fontSize: RFValue(14),
    color: "tomato",
    fontFamily: "Medium",
    alignSelf: "flex-start",
    marginBottom: 8,
    marginLeft: 4,
  },
});

export default LoginScreen;


================================================
FILE: apps/native/src/screens/NotesDashboardScreen.tsx
================================================
import React, { useState } from "react";
import {
  StyleSheet,
  View,
  Text,
  TextInput,
  TouchableOpacity,
  Image,
  FlatList,
  Dimensions,
} from "react-native";
import { Feather, AntDesign } from "@expo/vector-icons";
import { RFValue } from "react-native-responsive-fontsize";
import { useUser } from "@clerk/clerk-expo";
import { api } from "@packages/backend/convex/_generated/api";
import { type Doc } from "@packages/backend/convex/_generated/dataModel";
import { useQuery } from "convex/react";
import { type Href, useRouter } from "expo-router";

const NotesDashboardScreen = () => {
  const router = useRouter();
  const user = useUser();
  const imageUrl = user?.user?.imageUrl;
  const firstName = user?.user?.firstName;

  const allNotes = useQuery(api.notes.getNotes);
  const [search, setSearch] = useState("");

  const finalNotes =
    search && allNotes
      ? allNotes.filter(
          (note) =>
            note.title.toLowerCase().includes(search.toLowerCase()) ||
            note.content.toLowerCase().includes(search.toLowerCase()),
        )
      : (allNotes ?? []);

  const renderItem = ({ item }: { item: Doc<"notes"> }) => (
    <TouchableOpacity
      onPress={() => {
        router.push(`/notes/${item._id}` as Href);
      }}
      activeOpacity={0.5}
      style={styles.noteItem}
    >
      <Text style={styles.noteText}>{item.title}</Text>
    </TouchableOpacity>
  );

  return (
    <View style={styles.container}>
      <View style={styles.header}>
        <Image
          source={require("../assets/icons/logo2small.png")} // Replace with your logo image file
          style={styles.logo}
        />
      </View>

      <View style={styles.yourNotesContainer}>
        {/* @ts-ignore, for css purposes */}
        <Image style={styles.avatarSmall} />
        <Text style={styles.title}>Your Notes</Text>
        {imageUrl ? (
          <Image style={styles.avatarSmall} source={{ uri: imageUrl }} />
        ) : (
          <Text>{firstName ? firstName : ""}</Text>
        )}
      </View>
      <View style={styles.searchContainer}>
        <Feather
          name="search"
          size={20}
          color="grey"
          style={styles.searchIcon}
        />
        <TextInput
          value={search}
          onChangeText={setSearch}
          placeholder="Search"
          style={styles.searchInput}
        />
      </View>
      {!finalNotes || finalNotes.length === 0 ? (
        <View style={styles.emptyState}>
          <Text style={styles.emptyStateText}>
            Create your first note to{"\n"}get started
          </Text>
        </View>
      ) : (
        <FlatList
          data={finalNotes}
          renderItem={renderItem}
          keyExtractor={(item) => item._id}
          style={styles.notesList}
          contentContainerStyle={{
            marginTop: 19,
            borderTopWidth: 0.5,
            borderTopColor: "rgba(0, 0, 0, 0.59)",
          }}
        />
      )}

      <TouchableOpacity
        onPress={() => {
          router.push("/notes/new");
        }}
        style={styles.newNoteButton}
      >
        <AntDesign name="plus-circle" size={20} color="#fff" />
        <Text style={styles.newNoteButtonText}>Create a New Note</Text>
      </TouchableOpacity>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "white",
  },
  header: {
    backgroundColor: "#0D87E1",
    height: 67,
    justifyContent: "center",
    alignItems: "center",
  },
  logo: {
    width: 46,
    height: 46,
    borderRadius: 20,
    resizeMode: "contain",
  },
  title: {
    fontSize: RFValue(17.5),
    fontFamily: "MMedium",
    alignSelf: "center",
  },
  yourNotesContainer: {
    flexDirection: "row",
    alignItems: "center",
    justifyContent: "space-between",
    paddingHorizontal: 13,
    marginTop: 19,
  },
  avatarSmall: {
    width: 28,
    height: 28,
    borderRadius: 10,
  },
  searchContainer: {
    flexDirection: "row",
    alignItems: "center",
    borderWidth: 1,
    borderColor: "grey",
    borderRadius: 10,
    padding: 10,
    marginHorizontal: 15,
    marginTop: 30,
  },
  searchIcon: {
    marginRight: 10,
  },
  searchInput: {
    flex: 1,
    fontSize: RFValue(15),
    fontFamily: "MRegular",
    color: "#2D2D2D",
  },
  notesList: {
    flex: 1,
  },
  noteItem: {
    padding: 20,
    borderBottomWidth: 0.5,
    borderBottomColor: "rgba(0, 0, 0, 0.59)",

    backgroundColor: "#F9FAFB",
  },
  noteText: {
    fontSize: 16,
    fontFamily: "MLight",
    color: "#2D2D2D",
  },

  newNoteButton: {
    flexDirection: "row",
    backgroundColor: "#0D87E1",
    borderRadius: 7,
    width: Dimensions.get("window").width / 1.6,
    alignSelf: "center",
    alignItems: "center",
    justifyContent: "center",
    minHeight: 44,
    position: "absolute",
    bottom: 35,
    shadowColor: "#000",
    shadowOffset: {
      width: 0,
      height: 3,
    },
    shadowOpacity: 0.27,
    shadowRadius: 4.65,

    elevation: 6,
  },
  newNoteButtonText: {
    color: "white",
    fontSize: RFValue(15),
    fontFamily: "MMedium",
    marginLeft: 10,
  },
  switchContainer: {
    position: "absolute",
    top: 20,
    right: 20,
  },
  emptyStateText: {
    textAlign: "center",
    alignSelf: "center",
    fontSize: RFValue(15),
    color: "grey",
    fontFamily: "MLight",
  },
  emptyState: {
    width: "100%",
    height: "35%",
    marginTop: 19,
    backgroundColor: "#F9FAFB",
    justifyContent: "center",
    alignItems: "center",
    borderWidth: 0.5,
    borderColor: "rgba(0, 0, 0, 0.59)",
  },
});

export default NotesDashboardScreen;


================================================
FILE: apps/native/tsconfig.json
================================================
{
  "extends": "expo/tsconfig.base",
  "compilerOptions": {
    "strict": true,
    "paths": {
      "@/*": ["./src/*"]
    }
  },
  "include": ["**/*.ts", "**/*.tsx", ".expo/types/**/*.ts", "expo-env.d.ts"]
}


================================================
FILE: apps/web/.example.env
================================================
NEXT_PUBLIC_CONVEX_URL=
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
CLERK_SECRET_KEY=


================================================
FILE: apps/web/.gitignore
================================================
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts


================================================
FILE: apps/web/eslint.config.mjs
================================================
import { defineConfig, globalIgnores } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";

export default defineConfig([
  ...nextVitals,
  globalIgnores([".next/**", "out/**", "build/**", "next-env.d.ts"]),
]);


================================================
FILE: apps/web/package.json
================================================
{
  "name": "web-app",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "eslint .",
    "typecheck": "tsc --noEmit"
  },
  "dependencies": {
    "@clerk/nextjs": "^7.2.3",
    "@headlessui/react": "^2.2.10",
    "@heroicons/react": "^2.2.0",
    "@packages/backend": "workspace:*",
    "@radix-ui/react-avatar": "^1.1.11",
    "@radix-ui/react-dropdown-menu": "^2.1.16",
    "@radix-ui/react-slot": "^1.2.4",
    "class-variance-authority": "^0.7.1",
    "convex": "^1.35.1",
    "lucide-react": "^1.8.0",
    "next": "^16.2.4",
    "react": "^19.2.5",
    "react-dom": "^19.2.5",
    "tailwind-merge": "^3.5.0"
  },
  "devDependencies": {
    "@eslint/eslintrc": "^3.3.5",
    "@tailwindcss/forms": "0.5.11",
    "@tailwindcss/postcss": "4.2.4",
    "@types/node": "^25.6.0",
    "@types/react": "19.2.14",
    "@types/react-dom": "19.2.3",
    "eslint": "^9.39.4",
    "eslint-config-next": "16.2.4",
    "postcss": "8.5.10",
    "tailwindcss": "4.2.4",
    "typescript": "6.0.3"
  }
}


================================================
FILE: apps/web/postcss.config.js
================================================
module.exports = {
  plugins: {
    "@tailwindcss/postcss": {},
  },
};


================================================
FILE: apps/web/src/app/ConvexClientProvider.tsx
================================================
"use client";

import { type ReactNode } from "react";
import { useAuth } from "@clerk/nextjs";
import { ConvexReactClient } from "convex/react";
import { ConvexProviderWithClerk } from "convex/react-clerk";

const convexUrl = process.env.NEXT_PUBLIC_CONVEX_URL;

if (!convexUrl)
  throw new Error("Missing NEXT_PUBLIC_CONVEX_URL for the web Convex client");

const convex = new ConvexReactClient(convexUrl);

export default function ConvexClientProvider({
  children,
}: {
  children: ReactNode;
}) {
  return (
    <ConvexProviderWithClerk client={convex} useAuth={useAuth}>
      {children}
    </ConvexProviderWithClerk>
  );
}


================================================
FILE: apps/web/src/app/globals.css
================================================
@import 'tailwindcss';

@theme {
  --breakpoint-*: initial;
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1440px;

  --color-primary: #0d87e1;

  --font-inter: Inter, sans-serif;
  --font-lato: Lato, sans-serif;
  --font-montserrat: Montserrat, sans-serif;

  --background-image-gradient-radial: radial-gradient(var(--tw-gradient-stops));
  --background-image-gradient-conic: conic-gradient(
    from 180deg at 50% 50%,
    var(--tw-gradient-stops)
  );
}

@utility container {
  margin-inline: auto;
}

/*
  The default border color has changed to `currentcolor` in Tailwind CSS v4,
  so we've added these compatibility styles to make sure everything still
  looks the same as it did with Tailwind CSS v3.

  If we ever want to remove these styles, we need to add an explicit border
  color utility to any element that depends on these defaults.
*/
@layer base {
  *,
  ::after,
  ::before,
  ::backdrop,
  ::file-selector-button {
    border-color: var(--color-gray-200, currentcolor);
  }
}

.linear_gradient {
  background: linear-gradient(
    267deg,
    #fff -9.43%,
    #040218 -9.42%,
    #fff 4.63%,
    #d2e4f2 127.55%
  );
}

.bg_image {
  background:
    linear-gradient(
      181deg,
      rgba(255, 255, 255, 0) 57.92%,
      #fff 97.09%,
      rgba(255, 255, 255, 0) 127.09%
    ),
    url("/images/background.png"),
    lightgray 0% 0% / 261.2499952316284px 261.2499952316284px repeat;
}
.button {
  border-radius: 8px;
  background: linear-gradient(
    267deg,
    #0983df -9.43%,
    #040218 -9.42%,
    #0d87e1 4.63%,
    #0983df 127.55%
  );
  box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
}


================================================
FILE: apps/web/src/app/layout.tsx
================================================
import type { Metadata } from "next";
import { ClerkProvider } from "@clerk/nextjs";
import { Inter, Montserrat, Lato } from "next/font/google";
import { cn } from "@/lib/utils";
import "./globals.css";
import ConvexClientProvider from "./ConvexClientProvider";

const inter = Inter({ subsets: ["latin"] });
const montserrat = Montserrat({ subsets: ["latin"] });
const lato = Lato({ weight: "400", subsets: ["latin"] });

export const metadata: Metadata = {
  title: "Notes App",
  description: "This is an app to take notes.",
};

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <body
        className={cn(inter.className, montserrat.className, lato.className)}
      >
        <ClerkProvider>
          <ConvexClientProvider>{children}</ConvexClientProvider>
        </ClerkProvider>
      </body>
    </html>
  );
}


================================================
FILE: apps/web/src/app/notes/[slug]/page.tsx
================================================
import Header from "@/components/Header";
import NoteDetails from "@/components/notes/NoteDetails";
import { Id } from "@packages/backend/convex/_generated/dataModel";

export default async function Page({
  params,
}: {
  params: Promise<{ slug: string }>;
}) {
  const { slug } = await params;
  return (
    <main className="bg-[#F5F7FE] h-screen">
      <Header />
      <NoteDetails noteId={slug as Id<"notes">} />
    </main>
  );
}


================================================
FILE: apps/web/src/app/notes/page.tsx
================================================
import Header from "@/components/Header";
import Notes from "@/components/notes/Notes";

export default function Home() {
  return (
    <main className="bg-[#EDEDED] h-screen">
      <Header />
      <Notes />
    </main>
  );
}


================================================
FILE: apps/web/src/app/page.tsx
================================================
"use client";

import Header from "@/components/Header";
import Benefits from "@/components/home/Benefits";
import Footer from "@/components/home/Footer";
import FooterHero from "@/components/home/FooterHero";
import Hero from "@/components/home/Hero";
import Testimonials from "@/components/home/Testimonials";

export default function Home() {
  return (
    <main>
      <Header />
      <Hero />
      <Benefits />
      <Testimonials />
      <FooterHero />
      <Footer />
    </main>
  );
}


================================================
FILE: apps/web/src/components/Header.tsx
================================================
"use client";

import {
  Disclosure,
  DisclosureButton,
  DisclosurePanel,
} from "@headlessui/react";
import { Bars3Icon, XMarkIcon } from "@heroicons/react/24/outline";
import { useUser } from "@clerk/nextjs";
import Link from "next/link";
import Logo from "./common/Logo";
import { UserNav } from "./common/UserNav";
import { usePathname } from "next/navigation";

type NavigationItem = {
  name: string;
  href: string;
  current: boolean;
};

const navigation: NavigationItem[] = [
  { name: "Benefits", href: "#Benefits", current: true },
  { name: "Reviews", href: "#reviews", current: false },
];

export default function Header() {
  const { user } = useUser();
  const pathname = usePathname();

  return (
    <Disclosure as="nav" className=" ">
      {({ open }) => (
        <>
          <div className="flex items-center bg-white h-16 sm:h-20">
            <div className="container px-2 sm:px-0">
              <div className="relative flex h-16 items-center justify-between">
                <div className="flex sm:hidden shrink-0 items-center">
                  <Logo isMobile={true} />
                </div>
                <div className="sm:flex hidden shrink-0 items-center">
                  <Logo />
                </div>
                {pathname === "/" && (
                  <div className="flex flex-1 items-center justify-center ">
                    <div className="hidden sm:ml-6 sm:block">
                      <ul className="flex space-x-28">
                        {navigation.map((item) => (
                          <li key={item.name}>
                            <Link
                              href={item.href}
                              className="text-[#2D2D2D] text-center text-xl not-italic font-normal leading-[normal]"
                              aria-current={item.current ? "page" : undefined}
                            >
                              {item.name}
                            </Link>
                          </li>
                        ))}
                      </ul>
                    </div>
                  </div>
                )}
                {user ? (
                  <div className="hidden sm:flex absolute inset-y-0 right-0 gap-6 items-center pr-2 sm:static sm:inset-auto sm:ml-6 sm:pr-0">
                    <Link href="/notes">
                      <button
                        type="button"
                        className=" text-white text-center text-xl not-italic font-normal leading-[normal] font-montserrat px-[22px] py-[11px] button"
                      >
                        See your Notes
                      </button>
                    </Link>
                    <UserNav
                      image={user?.imageUrl}
                      name={user?.fullName ?? "Account"}
                      email={user?.primaryEmailAddress?.emailAddress ?? ""}
                    />
                  </div>
                ) : (
                  <div className="hidden sm:flex absolute inset-y-0 right-0 gap-6 items-center pr-2 sm:static sm:inset-auto sm:ml-6 sm:pr-0">
                    <Link
                      href="/notes"
                      className="border rounded-lg border-solid border-[#2D2D2D] text-[#2D2D2D] text-center text-xl not-italic font-normal leading-[normal] font-montserrat px-[22px] py-2.5"
                    >
                      Sign in
                    </Link>
                    <Link
                      href="/notes"
                      className=" text-white text-center text-xl not-italic font-normal leading-[normal] font-montserrat px-[22px] py-[11px] button"
                    >
                      Get Started
                    </Link>
                  </div>
                )}
                <div className="block sm:hidden">
                  {/* Mobile menu button*/}
                  <DisclosureButton className="relative inline-flex  items-center justify-center rounded-md p-2 text-gray-400 focus:outline-hidden focus:ring-2 focus:ring-inset focus:ring-white">
                    <span className="absolute -inset-0.5" />
                    <span className="sr-only">Open main menu</span>
                    {open ? (
                      <XMarkIcon className="block h-6 w-6" aria-hidden="true" />
                    ) : (
                      <Bars3Icon className="block h-6 w-6" aria-hidden="true" />
                    )}
                  </DisclosureButton>
                </div>
              </div>
            </div>
          </div>

          <DisclosurePanel className="sm:hidden">
            <div className="space-y-1 px-2 pb-3 pt-2 flex flex-col gap-3 items-start">
              {navigation.map((item) => (
                <DisclosureButton
                  key={item.name}
                  as={Link}
                  href={item.href}
                  className="text-[#2D2D2D] text-center text-xl not-italic font-normal leading-[normal]"
                  aria-current={item.current ? "page" : undefined}
                >
                  {item.name}
                </DisclosureButton>
              ))}
              {user ? (
                <div className="flex gap-6 items-center pr-2 sm:static sm:inset-auto sm:ml-6 sm:pr-0">
                  <Link
                    href="/notes"
                    className="text-white text-center text-xl not-italic font-normal leading-[normal] font-montserrat px-5 py-1.5 button"
                  >
                    See your Notes
                  </Link>
                </div>
              ) : (
                <div className="flex gap-6 items-center pr-2 sm:static sm:inset-auto sm:ml-6 sm:pr-0">
                  <Link
                    href="/notes"
                    className="border rounded-lg border-solid border-[#2D2D2D] text-[#2D2D2D] text-center text-xl not-italic font-normal leading-[normal] font-montserrat px-5 py-[5px]"
                  >
                    Sign in
                  </Link>
                  <Link
                    href="/notes"
                    className=" text-white text-center text-xl not-italic font-normal leading-[normal] font-montserrat px-5 py-1.5 button"
                  >
                    Get Started
                  </Link>
                </div>
              )}
            </div>
          </DisclosurePanel>
        </>
      )}
    </Disclosure>
  );
}


================================================
FILE: apps/web/src/components/common/Logo.tsx
================================================
import Image from "next/image";
import Link from "next/link";
import React from "react";

interface Props {
  isMobile?: boolean;
}

const Logo = ({ isMobile }: Props) => {
  return (
    <Link href={"/"}>
      <div className="flex gap-2 items-center">
        <Image src={"/images/logo.png"} width={26} height={26} alt="logo" />
        {!isMobile ? (
          <h1 className="font-montserrat text-black text-3xl sm:text-[35px] not-italic font-normal leading-[90.3%] tracking-[-0.875px]">
            UseNotes
          </h1>
        ) : null}
      </div>
    </Link>
  );
};

export default Logo;


================================================
FILE: apps/web/src/components/common/Menu.tsx
================================================
import Link from "next/link";

interface Props {
  menuItems: {
    title: string;
    url: string;
  }[];
}

const Menu = ({ menuItems }: Props) => {
  return (
    <ul className="flex flex-col sm:flex-row items-end sm:items-center gap-[22px] md:gap-28 ">
      {menuItems.map((item, index) => (
        <li key={index}>
          <Link
            href={item.url}
            className="text-[#475467] text-base not-italic font-semibold leading-6 underline font-montserrat"
          >
            {item.title}
          </Link>
        </li>
      ))}
    </ul>
  );
};

export default Menu;


================================================
FILE: apps/web/src/components/common/TestTimonialCard.tsx
================================================
import Image from "next/image";
interface Props {
  data: {
    feature?: boolean;
    review: string;
    profile: string;
    name: string;
    designation: string;
  };
}

const TestTimonialCard = ({ data }: Props) => {
  return (
    <div
      className={`max-w-[370px] w-full space-y-8 h-auto shrink-0 rounded-[20px] border-[1.5px] border-solid border-[#EAECF0] px-[35px] pt-14 pb-20 ${
        data.feature ? "bg-primary" : "bg-white"
      } $}`}
    >
      <div className="flex gap-2">
        {Array(5)
          .fill(0)
          .map((data, index) => (
            <Image
              src="/images/star.svg"
              width={29}
              height={29}
              alt="star"
              key={index}
            />
          ))}
      </div>
      <blockquote
        className={` text-lg not-italic font-normal leading-[26px] font-montserrat ${
          data.feature ? "text-white" : "text-[#313234]"
        }`}
      >
        <span className="text-lg">&ldquo;</span>
        {data.review}
        <span className="text-lg">&rdquo;</span>
      </blockquote>
      <div className="flex gap-7 items-center ">
        <div className="w-[52px] h-[52px] shrink-0 border rounded-full flex items-center justify-center">
          <Image
            className="rounded-[38px] w-[38px] h-[38px] "
            src={data.profile}
            width={38}
            height={38}
            alt="ryan"
          />
        </div>
        <div className="">
          <h3
            className={` text-xl not-italic font-medium leading-[normal] font-montserrat ${
              data.feature ? "text-white" : "text-[#25262B]"
            }`}
          >
            {data.name}
          </h3>
          <p
            className={` text-base not-italic font-medium leading-[normal] font-montserrat ${
              data.feature ? "text-white" : "text-[#555F68]"
            }`}
          >
            {data.designation}
          </p>
        </div>
      </div>
    </div>
  );
};

export default TestTimonialCard;


================================================
FILE: apps/web/src/components/common/UserNav.tsx
================================================
import { useClerk } from "@clerk/nextjs";
import { LogOut, Paintbrush2 } from "lucide-react";
import Link from "next/link";
import Image from "next/image";
import { Avatar, AvatarFallback, AvatarImage } from "./avatar";
import { Button } from "./button";
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuLabel,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from "./dropdown-menu";

export function UserNav({
  image,
  name,
  email,
}: {
  image: string;
  name: string;
  email: string;
}) {
  const { signOut } = useClerk();

  return (
    <DropdownMenu>
      <DropdownMenuTrigger asChild>
        <Button variant="ghost" className="relative h-10 w-10 rounded-full">
          <Avatar className="h-10 w-10">
            <AvatarImage src={image} alt={name} />
            <AvatarFallback>
              <Image
                src="/images/profile.png"
                alt={name}
                width={40}
                height={40}
              />
            </AvatarFallback>
          </Avatar>
        </Button>
      </DropdownMenuTrigger>
      <DropdownMenuContent className="w-56 bg-white" align="end" forceMount>
        <DropdownMenuLabel className="font-normal">
          <div className="flex flex-col space-y-1">
            <p className="text-sm font-medium leading-none text-black">
              {name}
            </p>
            <p className="text-xs leading-none text-black">{email}</p>
          </div>
        </DropdownMenuLabel>
        <DropdownMenuSeparator />
        <Link href="/notes">
          <DropdownMenuItem className="hover:cursor-pointer hover:bg-gray-200">
            <Paintbrush2 className="mr-2 h-4 w-4 text-black" />
            <span className="text-black">Dashboard</span>
          </DropdownMenuItem>
        </Link>
        <DropdownMenuItem
          onClick={() => {
            signOut({ redirectUrl: "/" });
          }}
          className="hover:cursor-pointer hover:bg-gray-200"
        >
          <LogOut className="mr-2 h-4 w-4 text-black" />
          <span className="text-black">Log out</span>
        </DropdownMenuItem>
      </DropdownMenuContent>
    </DropdownMenu>
  );
}


================================================
FILE: apps/web/src/components/common/avatar.tsx
================================================
import * as React from "react";
import * as AvatarPrimitive from "@radix-ui/react-avatar";
import { cn } from "@/lib/utils";

const Avatar = React.forwardRef<
  React.ComponentRef<typeof AvatarPrimitive.Root>,
  React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
>(({ className, ...props }, ref) => (
  <AvatarPrimitive.Root
    ref={ref}
    className={cn(
      "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
      className,
    )}
    {...props}
  />
));
Avatar.displayName = AvatarPrimitive.Root.displayName;

const AvatarImage = React.forwardRef<
  React.ComponentRef<typeof AvatarPrimitive.Image>,
  React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
>(({ className, ...props }, ref) => (
  <AvatarPrimitive.Image
    ref={ref}
    className={cn("aspect-square h-full w-full", className)}
    {...props}
  />
));
AvatarImage.displayName = AvatarPrimitive.Image.displayName;

const AvatarFallback = React.forwardRef<
  React.ComponentRef<typeof AvatarPrimitive.Fallback>,
  React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
>(({ className, ...props }, ref) => (
  <AvatarPrimitive.Fallback
    ref={ref}
    className={cn(
      "bg-muted flex h-full w-full items-center justify-center rounded-full",
      className,
    )}
    {...props}
  />
));
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;

export { Avatar, AvatarImage, AvatarFallback };


================================================
FILE: apps/web/src/components/common/button.tsx
================================================
import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";

import { cn } from "@/lib/utils";

const buttonVariants = cva(
  "inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
  {
    variants: {
      variant: {
        default:
          "bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",
        destructive:
          "bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90",
        outline:
          "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground",
        secondary:
          "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
        ghost: "hover:bg-accent hover:text-accent-foreground",
        link: "text-primary underline-offset-4 hover:underline",
      },
      size: {
        default: "h-9 px-4 py-2",
        sm: "h-8 rounded-md px-3 text-xs",
        lg: "h-10 rounded-md px-8",
        icon: "h-9 w-9",
      },
    },
    defaultVariants: {
      variant: "default",
      size: "default",
    },
  },
);

export interface ButtonProps
  extends
    React.ButtonHTMLAttributes<HTMLButtonElement>,
    VariantProps<typeof buttonVariants> {
  asChild?: boolean;
}

const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
  ({ className, variant, size, asChild = false, ...props }, ref) => {
    const Comp = asChild ? Slot : "button";
    return (
      <Comp
        className={cn(buttonVariants({ variant, size, className }))}
        ref={ref}
        {...props}
      />
    );
  },
);
Button.displayName = "Button";

export { Button, buttonVariants };


================================================
FILE: apps/web/src/components/common/dropdown-menu.tsx
================================================
import * as React from "react";
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
import { Check, ChevronRight, Circle } from "lucide-react";
import { cn } from "@/lib/utils";

const DropdownMenu = DropdownMenuPrimitive.Root;

const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;

const DropdownMenuGroup = DropdownMenuPrimitive.Group;

const DropdownMenuPortal = DropdownMenuPrimitive.Portal;

const DropdownMenuSub = DropdownMenuPrimitive.Sub;

const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;

const DropdownMenuSubTrigger = React.forwardRef<
  React.ComponentRef<typeof DropdownMenuPrimitive.SubTrigger>,
  React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
    inset?: boolean;
  }
>(({ className, inset, children, ...props }, ref) => (
  <DropdownMenuPrimitive.SubTrigger
    ref={ref}
    className={cn(
      "focus:bg-accent data-[state=open]:bg-accent flex cursor-default select-none items-center rounded-xs px-2 py-1.5 text-sm outline-hidden",
      inset && "pl-8",
      className,
    )}
    {...props}
  >
    {children}
    <ChevronRight className="ml-auto h-4 w-4" />
  </DropdownMenuPrimitive.SubTrigger>
));
DropdownMenuSubTrigger.displayName =
  DropdownMenuPrimitive.SubTrigger.displayName;

const DropdownMenuSubContent = React.forwardRef<
  React.ComponentRef<typeof DropdownMenuPrimitive.SubContent>,
  React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
>(({ className, ...props }, ref) => (
  <DropdownMenuPrimitive.SubContent
    ref={ref}
    className={cn(
      "bg-popover text-popover-foreground z-50 min-w-32 overflow-hidden rounded-md border p-1 shadow-md animate-in data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1",
      className,
    )}
    {...props}
  />
));
DropdownMenuSubContent.displayName =
  DropdownMenuPrimitive.SubContent.displayName;

const DropdownMenuContent = React.forwardRef<
  React.ComponentRef<typeof DropdownMenuPrimitive.Content>,
  React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
>(({ className, sideOffset = 4, ...props }, ref) => (
  <DropdownMenuPrimitive.Portal>
    <DropdownMenuPrimitive.Content
      ref={ref}
      sideOffset={sideOffset}
      className={cn(
        "bg-popover text-popover-foreground z-50 min-w-32 overflow-hidden rounded-md border p-1 shadow-md animate-in data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
        className,
      )}
      {...props}
    />
  </DropdownMenuPrimitive.Portal>
));
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;

const DropdownMenuItem = React.forwardRef<
  React.ComponentRef<typeof DropdownMenuPrimitive.Item>,
  React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
    inset?: boolean;
  }
>(({ className, inset, ...props }, ref) => (
  <DropdownMenuPrimitive.Item
    ref={ref}
    className={cn(
      "focus:bg-accent focus:text-accent-foreground relative flex cursor-default select-none items-center rounded-xs px-2 py-1.5 text-sm outline-hidden transition-colors data-disabled:pointer-events-none data-disabled:opacity-50",
      inset && "pl-8",
      className,
    )}
    {...props}
  />
));
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;

const DropdownMenuCheckboxItem = React.forwardRef<
  React.ComponentRef<typeof DropdownMenuPrimitive.CheckboxItem>,
  React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
>(({ className, children, checked, ...props }, ref) => (
  <DropdownMenuPrimitive.CheckboxItem
    ref={ref}
    className={cn(
      "focus:bg-accent focus:text-accent-foreground relative flex cursor-default select-none items-center rounded-xs py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors data-disabled:pointer-events-none data-disabled:opacity-50",
      className,
    )}
    checked={checked}
    {...props}
  >
    <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
      <DropdownMenuPrimitive.ItemIndicator>
        <Check className="h-4 w-4" />
      </DropdownMenuPrimitive.ItemIndicator>
    </span>
    {children}
  </DropdownMenuPrimitive.CheckboxItem>
));
DropdownMenuCheckboxItem.displayName =
  DropdownMenuPrimitive.CheckboxItem.displayName;

const DropdownMenuRadioItem = React.forwardRef<
  React.ComponentRef<typeof DropdownMenuPrimitive.RadioItem>,
  React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
>(({ className, children, ...props }, ref) => (
  <DropdownMenuPrimitive.RadioItem
    ref={ref}
    className={cn(
      "focus:bg-accent focus:text-accent-foreground relative flex cursor-default select-none items-center rounded-xs py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors data-disabled:pointer-events-none data-disabled:opacity-50",
      className,
    )}
    {...props}
  >
    <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
      <DropdownMenuPrimitive.ItemIndicator>
        <Circle className="h-2 w-2 fill-current" />
      </DropdownMenuPrimitive.ItemIndicator>
    </span>
    {children}
  </DropdownMenuPrimitive.RadioItem>
));
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;

const DropdownMenuLabel = React.forwardRef<
  React.ComponentRef<typeof DropdownMenuPrimitive.Label>,
  React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
    inset?: boolean;
  }
>(({ className, inset, ...props }, ref) => (
  <DropdownMenuPrimitive.Label
    ref={ref}
    className={cn(
      "px-2 py-1.5 text-sm font-semibold",
      inset && "pl-8",
      className,
    )}
    {...props}
  />
));
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;

const DropdownMenuSeparator = React.forwardRef<
  React.ComponentRef<typeof DropdownMenuPrimitive.Separator>,
  React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
>(({ className, ...props }, ref) => (
  <DropdownMenuPrimitive.Separator
    ref={ref}
    className={cn("bg-muted -mx-1 my-1 h-px", className)}
    {...props}
  />
));
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;

const DropdownMenuShortcut = ({
  className,
  ...props
}: React.HTMLAttributes<HTMLSpanElement>) => {
  return (
    <span
      className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
      {...props}
    />
  );
};
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";

export {
  DropdownMenu,
  DropdownMenuTrigger,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuCheckboxItem,
  DropdownMenuRadioItem,
  DropdownMenuLabel,
  DropdownMenuSeparator,
  DropdownMenuShortcut,
  DropdownMenuGroup,
  DropdownMenuPortal,
  DropdownMenuSub,
  DropdownMenuSubContent,
  DropdownMenuSubTrigger,
  DropdownMenuRadioGroup,
};


================================================
FILE: apps/web/src/components/home/Benefits.tsx
================================================
import Image from "next/image";

const benefits = [
  {
    title: "Effortless Note-Taking",
    description: "Capture thoughts effortlessly with our intuitive interface",
    image: "/images/goodNews.png",
  },
  {
    title: "Seamless Sync",
    description:
      "Access your notes anytime, anywhere, with seamless cloud synchronization.",
    image: "/images/cloudSync.png",
  },
  {
    title: "Enhanced Productivity",
    description:
      "Let AI handle organization, so you can focus on what matters most.",
    image: "/images/googleCalander.png",
  },
  {
    title: "AI-Powered Insights",
    description:
      "Gain valuable insights with smart analytics based on your note patterns.",
    image: "/images/bot.png",
  },
];

const Benefits = () => {
  return (
    <section id="Benefits" className="relative pointer-events-none">
      <Image
        src={"/images/blue-circle.svg"}
        width={503}
        height={531}
        alt=""
        className="absolute hidden sm:block -left-40 -top-48 h-[531px]"
      />
      <div className="container py-16 px-2 md:px-0">
        <p className="text-black text-[17px] sm:text-3xl not-italic font-medium leading-[90.3%] tracking-[-0.75px] text-center font-montserrat pb-2 sm:pb-[18px]">
          Benefits
        </p>
        <h3 className=" text-black text-3xl sm:text-[57px] not-italic font-medium leading-[90.3%] tracking-[-1.425px] font-montserrat text-center pb-[46px] sm:pb-[87px]">
          Why Choose UseNotes
        </h3>

        <div className="relative">
          <div className="hidden sm:flex justify-between items-center absolute inset-0 -z-10">
            {Array(3)
              .fill(0)
              .map((_, index) => (
                <Image
                  src="/images/cricle.svg"
                  width={183}
                  height={193}
                  alt="line"
                  key={index}
                />
              ))}
          </div>

          <div className="grid grid-cols-1 lg:grid-cols-2 gap-8 z-10 ">
            {benefits.map((benefit, index) => (
              <div
                key={index}
                className="flex gap-2 sm:gap-7 bg-white items-center border rounded-[17px] py-4 px-2 sm:py-12 sm:px-6 border-solid border-[#B8B5B5] shadow-xl"
              >
                <div className=" min-w-16 sm:min-w-28">
                  <Image
                    src={benefit.image}
                    width={100}
                    height={100}
                    alt="benefit"
                    className="sm:w-[100px] w-[58px]"
                  />
                </div>
                <div className="">
                  <h4 className="text-black text-[24px] sm:text-[42px] not-italic font-medium leading-[90.3%] tracking-[-1.05px] pb-2 sm:pb-6 font-montserrat">
                    {benefit.title}
                  </h4>
                  <p className="font-montserrat pb-2 text-black text-[17px] sm:text-3xl not-italic font-normal leading-[90.3%] tracking-[-0.75px]">
                    {benefit.description}
                  </p>
                </div>
              </div>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
};

export default Benefits;


================================================
FILE: apps/web/src/components/home/ComplexToggle.tsx
================================================
import { useState } from "react";
import { Switch } from "@headlessui/react";

function classNames(...classes: string[]) {
  return classes.filter(Boolean).join(" ");
}

export default function ComplexToggle({
  setIsSummary,
  isSummary,
}: {
  setIsSummary: (value: boolean) => void;
  isSummary: boolean;
}) {
  return (
    <Switch.Group as="div" className="flex items-center">
      <Switch.Label as="span" className="mr-3 text-sm">
        <span
          className={`text-gray-900 ${
            !isSummary ? "font-bold" : "font-medium"
          }`}
        >
          Original Note
        </span>{" "}
      </Switch.Label>
      <Switch
        checked={isSummary}
        onChange={setIsSummary}
        className={classNames(
          isSummary ? "bg-primary" : "bg-gray-200",
          "relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-hidden ",
        )}
      >
        <span
          aria-hidden="true"
          className={classNames(
            isSummary ? "translate-x-5" : "translate-x-0",
            "pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow-sm ring-0 transition duration-200 ease-in-out",
          )}
        />
      </Switch>
      <Switch.Label as="span" className="ml-3 text-sm">
        <span
          className={`text-gray-900 ${isSummary ? "font-bold" : "font-medium"}`}
        >
          AI Summary
        </span>{" "}
      </Switch.Label>
    </Switch.Group>
  );
}


================================================
FILE: apps/web/src/components/home/Footer.tsx
================================================
import React from "react";
import Logo from "../common/Logo";
import Menu from "../common/Menu";

const menuItems = [
  {
    title: "Home",
    url: "/",
  },
  {
    title: "Benefits",
    url: "#Benefits",
  },
  {
    title: "Get Started",
    url: "/notes",
  },
  {
    title: "Reviews",
    url: "#reviews",
  },
];

const Footer = () => {
  return (
    <>
      <div className="container hidden sm:block py-12">
        <div className="flex flex-wrap md:flex-nowrap justify-between items-center pb-6">
          <Logo />
          <Menu menuItems={menuItems} />
        </div>
        <div className="pt-8 border-t-[#929292] border-t border-solid">
          <h3 className="text-gray-900 text-xl not-italic font-semibold leading-[30px] font-montserrat pb-2">
            Take more efficient notes with UseNotes
          </h3>
          <div className="flex justify-between">
            <p className="text-gray-600 font-montserrat text-base not-italic font-normal leading-6">
              Save countless hours of note-taking and organize your notes
              easier.
            </p>
            <p className="text-gray-600 font-inter text-base not-italic font-normal leading-6">
              © 2023 UseNotes. All rights reserved.
            </p>
          </div>
        </div>
      </div>

      <div className="container sm:hidden pt-7 pl-6 pr-5">
        <div className="flex justify-between items-center">
          <div className="flex flex-col gap-6">
            <Logo />
            <h3 className="text-[#101828] text-base not-italic font-semibold leading-[18px] font-montserrat">
              Take more efficient notes with UseNotes
            </h3>
            <p className="text-[#101828] font-montserrat text-base not-italic font-light leading-[18px]">
              Save countless hours of note-taking and organize your notes
              easier.
            </p>
          </div>
          <div className="min-w-[100px]">
            <Menu menuItems={menuItems} />
          </div>
        </div>
        <p className="text-[#667085] font-inter text-center text-base not-italic font-light leading-[18px] py-11">
          © 2023 UseNotes. All rights reserved. <br />
          <span className="mt-1"> Icons by Icons8</span>
        </p>
      </div>
    </>
  );
};

export default Footer;


================================================
FILE: apps/web/src/components/home/FooterHero.tsx
================================================
import Image from "next/image";
import Link from "next/link";
import React from "react";

const FooterHero = () => {
  return (
    <div className="bg-primary">
      <div className="flex flex-wrap md:flex-nowrap justify-between container py-20 px-6 sm:px-0">
        <div className="max-w-[802px]">
          <h2 className="font-montserrat text-wrap text-white not-italic text-3xl md:text-[57px] font-semibold sm:leading-[109.3%] sm:tracking-[-1.425px] leading-[97.3%] tracking-[-0.75px] pb-[31px] sm:pb-[38px]">
            Start Your Intelligent Note-Taking Journey
          </h2>
          <p className="text-white max-w-[681px] text-xl sm:text-3xl not-italic font-normal leading-[103.3%] tracking-[-0.75px] font-montserrat pb-[66px] sm:pb-[53px]">
            Sign up now and experience the power of AI-enhanced note-taking with
            UseNotes
          </p>
          <Link href={"/notes"}>
            <button className="linear_gradient flex max-w-[438px] w-full justify-center items-center gap-2.5 shadow-[0px_4px_4px_0px_rgba(0,0,0,0.25)] px-8 py-4 rounded-[11px]  text-black text-xl sm:text-3xl not-italic font-semibold leading-[90.3%] tracking-[-0.75px]">
              Get Started For Free
            </button>
          </Link>
        </div>
        <div className="mt-20 md:mt-0">
          <Image
            src="/images/monitor.png"
            alt="hero"
            width={560}
            height={456}
          />
        </div>
      </div>
    </div>
  );
};

export default FooterHero;


================================================
FILE: apps/web/src/components/home/Hero.tsx
================================================
import Image from "next/image";
import Link from "next/link";

const Hero = () => {
  return (
    <section className="bg_image">
      <div className="container py-16 sm:py-36 px-6 sm:px-0">
        <div className="flex sm:flex-wrap flex-nowrap justify-between items-center max-h-[690px] h-full">
          <div className="">
            <h2 className="font-montserrat pb-7 sm:pb-[26px] text-black text-[44px] sm:text-[75px] not-italic font-medium leading-[111.3%] tracking-[-1.1px] sm:tracking-[-1.875px]">
              The Ultimate <br /> Note-Taking Experience
            </h2>
            <p className="font-montserrat sm:pb-16 max-w-[680px] text-black text-xl sm:text-3xl not-italic font-normal leading-[103.3%] tracking-[-0.5px] sm:tracking-[-0.75px] pb-11">
              UseNotes harnesses the power of artificial intelligence to
              revolutionize the way you capture, organize, and recall your
              thoughts
            </p>
            <Link href={"/notes"}>
              <button className="button gap-2.5 px-8 py-4 font-montserrat text-white text-xl sm:text-3xl not-italic font-semibold leading-[90.3%] tracking-[-0.5px] sm:tracking-[-0.75px]">
                Get Started
              </button>
            </Link>
          </div>
          <div className="max-w-[570px] w-full h-full">
            <div className="relative max-w-[570px] w-full h-[380px] sm:h-[680px]">
              <div className="absolute z-10 inset-0 flex justify-center items-center bg-[#0983DF99] opacity-40 blur-[102px] rounded-[673px]">
                <Image
                  src={"/images/hero_image_bg.svg"}
                  width={541}
                  height={673}
                  alt="hero"
                  className="w-[344px] sm:w-[541px] "
                />
              </div>
              <div className=" absolute z-50 inset-0 flex justify-center items-center">
                <Image
                  src={"/images/hero.png"}
                  width={561}
                  height={456}
                  alt="hero"
                  className="w-[357px] sm:w-[561px]"
                />
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
};

export default Hero;


================================================
FILE: apps/web/src/components/home/Testimonials.tsx
================================================
import Image from "next/image";
import TestTimonialCard from "../common/TestTimonialCard";

const TestimonialsData = [
  {
    rating: 5,
    review:
      "Great note-taking application! The AI features make note-taking a breeze",
    name: "Ryan Lowry",
    designation: "Engineer & Author",
    profile: "/images/profile.png",
    feature: false,
  },
  {
    rating: 5,
    review:
      "Really like the clean design of UseNotes. The AI-driven search is impressively accurate, adding a personal dimension to my notes. Fast and very easy to use.",
    name: "John Collins",
    designation: "Engineer & Author",
    profile: "/images/profile.png",
    feature: true,
  },
  {
    rating: 5,
    review: "Simply brilliant! UseNotes has elevated my productivity.",
    name: "Moe Partuj",
    designation: "Student",
    profile: "/images/Moe-Partuj.jpeg",
    feature: false,
  },
];

const Testimonials = () => {
  return (
    <section
      id="reviews"
      className="bg_image bg_circle relative overflow-hidden"
    >
      <Image
        src={"/images/blue-circle-right.svg"}
        width={503}
        height={531}
        alt=""
        className="absolute hidden sm:block -right-40 top-1/4 h-[531px]"
      />
      <div className="container py-11 sm:py-16 px-6 sm:px-0">
        <p className="text-black text-[17px] sm:text-3xl not-italic font-medium leading-[90.3%] tracking-[-0.75px] text-center font-montserrat pb-2 sm:pb-[18px]">
          Reviews
        </p>
        <h3 className=" text-black text-3xl sm:text-[57px] not-italic font-medium leading-[90.3%] tracking-[-1.425px] font-montserrat text-center pb-[20px] sm:pb-[87px]">
          User Testimonials
        </h3>

        <div className="flex flex-wrap md:flex-nowrap justify-center items-start gap-4 pb-10 mb-10 relative">
          <Image
            src={"/images/message-left.svg"}
            width={110}
            height={102}
            alt=""
            className="absolute hidden md:block left-0 top-full"
          />
          <Image
            src={"/images/message-right.svg"}
            width={110}
            height={102}
            alt=""
            className="absolute hidden md:block right-0 bottom-full"
          />
          {TestimonialsData.map((item, index) => (
            <TestTimonialCard data={item} key={index} />
          ))}
        </div>
      </div>
    </section>
  );
};

export default Testimonials;


================================================
FILE: apps/web/src/components/notes/Checkbox.tsx
================================================
const Checkbox = ({
  isChecked,
  checkHandler,
  openaiKeySet,
}: {
  isChecked: boolean;
  checkHandler: () => void;
  openaiKeySet: boolean;
}) => {
  return (
    <div className="relative flex  gap-x-3">
      <div className="flex items-start mt-[5px]">
        <input
          id="candidates"
          name="candidates"
          type="checkbox"
          checked={isChecked}
          onChange={checkHandler}
          className="accent-white checked:accent-white w-5 h-5 focus:ring-0 focus:outline-0  border-[#0D87E1] rounded-[6px] bg-[#F9F5FF]"
          disabled={!openaiKeySet}
        />
      </div>
      <div className="">
        <label
          htmlFor="candidates"
          className=" text-black text-[17px] sm:text-2xl pb-2 not-italic font-light leading-[90.3%] tracking-[-0.6px]"
        >
          Advanced Summarization {openaiKeySet ? "" : " (Disabled)"}
        </label>
        {openaiKeySet ? (
          <p className=" text-black text-sm sm:text-[17px] not-italic font-extralight leading-[90.3%] tracking-[-0.425px]">
            Check this box if you want to generate summaries using AI
          </p>
        ) : (
          <p>
            <a
              className="text-blue-500"
              target="_blank"
              href="https://dashboard.convex.dev/deployment/settings/environment-variables?var=OPENAI_API_KEY"
            >
              Set an OPENAI_API_KEY in your environment variables here.
            </a>
          </p>
        )}
      </div>
    </div>
  );
};

export default Checkbox;


================================================
FILE: apps/web/src/components/notes/CreateNote.tsx
================================================
"use client";

import { Fragment, useRef, useState } from "react";
import { Dialog, Transition } from "@headlessui/react";
import Image from "next/image";
import Checkbox from "./Checkbox";
import { api } from "@packages/backend/convex/_generated/api";
import { useMutation, useQuery } from "convex/react";

export default function CreateNote() {
  const [open, setOpen] = useState(false);
  const [title, setTitle] = useState("");
  const [content, setContent] = useState("");
  const [isChecked, setIsChecked] = useState<boolean>(false);

  const cancelButtonRef = useRef(null);

  const createNote = useMutation(api.notes.createNote);
  const openaiKeySet = useQuery(api.openai.openaiKeySet) ?? true;

  const createUserNote = async () => {
    await createNote({
      title,
      content,
      isSummary: isChecked,
    });
    setOpen(false);
  };

  return (
    <>
      <div className="flex justify-center items-center">
        <button
          onClick={() => setOpen(true)}
          className="button text-[#EBECEF] flex gap-4 justify-center items-center text-center px-8 sm:px-16 py-2"
        >
          <Image
            src={"/images/Add.png"}
            width={40}
            height={40}
            alt="search"
            className="float-right sm:w-[40px] sm:h-[40px] w-6 h-6"
          />
          <span className="text-[17px] sm:text-3xl not-italic font-medium leading-[79%] tracking-[-0.75px]">
            {" "}
            New Note
          </span>
        </button>
      </div>

      <Transition.Root show={open} as={Fragment}>
        <Dialog
          as="div"
          className="relative z-10"
          initialFocus={cancelButtonRef}
          onClose={setOpen}
        >
          <Transition.Child
            as={Fragment}
            enter="ease-out duration-300"
            enterFrom="opacity-0"
            enterTo="opacity-100"
            leave="ease-in duration-200"
            leaveFrom="opacity-100"
            leaveTo="opacity-0"
          >
            <div className="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" />
          </Transition.Child>

          <form className="fixed inset-0 z-10 w-screen overflow-y-auto">
            <div className="flex min-h-full items-end justify-center p-2 text-center sm:items-center sm:p-0">
              <Transition.Child
                as={Fragment}
                enter="ease-out duration-300"
                enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
                enterTo="opacity-100 translate-y-0 sm:scale-100"
                leave="ease-in duration-200"
                leaveFrom="opacity-100 translate-y-0 sm:scale-100"
                leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
              >
                <Dialog.Panel className="relative transform overflow-hidden rounded-[10px] bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-[719px]">
                  <div className="bg-white px-4 pb-4 pt-5 sm:p-8 sm:pb-4">
                    <>
                      <div className="mt-3  sm:mt-0 text-left">
                        <Dialog.Title
                          as="h3"
                          className="text-black text-center text-xl sm:text-left sm:text-[35px] pb-6 sm:pb-8 not-italic font-semibold leading-[90.3%] tracking-[-0.875px]"
                        >
                          Create New Note
                        </Dialog.Title>
                        <div className="mt-2 space-y-3">
                          <div className="pb-2">
                            <label
                              htmlFor="title"
                              className=" text-black text-[17px] sm:text-2xl not-italic font-medium leading-[90.3%] tracking-[-0.6px]"
                            >
                              Title
                            </label>
                            <div className="mt-2">
                              <input
                                id="title"
                                name="title"
                                type="text"
                                placeholder="Note Title"
                                autoComplete="title"
                                value={title}
                                onChange={(e) => setTitle(e.target.value)}
                                className="border shadow-[0px_1px_2px_0px_rgba(16,24,40,0.05)] rounded-lg border-solid border-[#D0D5DD] bg-white w-full py-2.5 px-[14px] text-black text-[17px] not-italic font-light leading-[90.3%] tracking-[-0.425px] sm:text-2xl"
                              />
                            </div>
                          </div>

                          <div className="">
                            <label
                              htmlFor="description"
                              className=" text-black text-[17px] sm:text-2xl not-italic font-medium leading-[90.3%] tracking-[-0.6px]"
                            >
                              The Note
                            </label>
                            <div className="mt-2 pb-[18px]">
                              <textarea
                                id="description"
                                name="description"
                                rows={8}
                                placeholder="Start your note "
                                className="block w-full rounded-md border-0 py-1.5  border-[#D0D5DD] text-2xl shadow-xs ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600  sm:leading-6 text-black text-[17px] not-italic font-light leading-[90.3%] tracking-[-0.425px] sm:text-2xl"
                                value={content}
                                onChange={(e) => setContent(e.target.value)}
                              />
                            </div>
                            <p className="text-black text-[17px] sm:text-2xl not-italic font-medium leading-[90.3%] tracking-[-0.6px]">
                              AI Features
                            </p>
                          </div>

                          <Checkbox
                            openaiKeySet={openaiKeySet}
                            isChecked={isChecked}
                            checkHandler={() => setIsChecked(!isChecked)}
                          />
                        </div>
                      </div>
                    </>
                  </div>
                  <div className=" px-4 py-3 mb-5 flex justify-center items-center">
                    <button
                      type="button"
                      className="button text-white text-center text-[17px] sm:text-2xl not-italic font-semibold leading-[90.3%] tracking-[-0.6px] px-[70px] py-2"
                      onClick={createUserNote}
                    >
                      Create
                    </button>
                  </div>
                </Dialog.Panel>
              </Transition.Child>
            </div>
          </form>
        </Dialog>
      </Transition.Root>
    </>
  );
}


================================================
FILE: apps/web/src/components/notes/DeleteNote.tsx
================================================
"use client";
import { Fragment, useRef, useState } from "react";
import { Dialog, Transition } from "@headlessui/react";
import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
import Image from "next/image";

export default function DeleteNote({ deleteAction }: any) {
  const [open, setOpen] = useState(false);

  const cancelButtonRef = useRef(null);

  return (
    <>
      <Image
        onClick={() => setOpen(true)}
        src={"/images/delete.svg"}
        width={20}
        height={20}
        alt="search"
        className="cursor-pointer"
      />

      <Transition.Root show={open} as={Fragment}>
        <Dialog
          as="div"
          className="relative z-10"
          initialFocus={cancelButtonRef}
          onClose={setOpen}
        >
          <Transition.Child
            as={Fragment}
            enter="ease-out duration-300"
            enterFrom="opacity-0"
            enterTo="opacity-100"
            leave="ease-in duration-200"
            leaveFrom="opacity-100"
            leaveTo="opacity-0"
          >
            <div className="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" />
          </Transition.Child>

          <div className="fixed inset-0 z-10 w-screen overflow-y-auto">
            <div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
              <Transition.Child
                as={Fragment}
                enter="ease-out duration-300"
                enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
                enterTo="opacity-100 translate-y-0 sm:scale-100"
                leave="ease-in duration-200"
                leaveFrom="opacity-100 translate-y-0 sm:scale-100"
                leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
              >
                <Dialog.Panel className="relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg">
                  <div className="bg-white px-4 pb-4 pt-5 sm:p-6 sm:pb-4">
                    <div className="sm:flex sm:items-start">
                      <div className="mx-auto flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10">
                        <ExclamationTriangleIcon
                          className="h-6 w-6 text-red-600"
                          aria-hidden="true"
                        />
                      </div>
                      <div className="mt-3 text-center sm:ml-4 sm:mt-0 sm:text-left">
                        <Dialog.Title
                          as="h3"
                          className="text-base font-semibold leading-6 text-gray-900"
                        >
                          Delete Note
                        </Dialog.Title>
                        <div className="mt-2">
                          <p className="text-sm text-gray-500">
                            Are you sure you want to delete this note? All of
                            your data will be permanently removed. This action
                            cannot be undone.
                          </p>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div className="bg-gray-50 px-4 py-3 sm:flex sm:flex-row-reverse sm:px-6">
                    <button
                      type="button"
                      className="inline-flex w-full justify-center rounded-md bg-red-600 px-3 py-2 text-sm font-semibold text-white shadow-xs hover:bg-red-500 sm:ml-3 sm:w-auto"
                      onClick={() => {
                        deleteAction();
                        setOpen(false);
                      }}
                    >
                      Delete
                    </button>
                    <button
                      type="button"
                      className="mt-3 inline-flex w-full justify-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50 sm:mt-0 sm:w-auto"
                      onClick={() => setOpen(false)}
                      ref={cancelButtonRef}
                    >
                      Cancel
                    </button>
                  </div>
                </Dialog.Panel>
              </Transition.Child>
            </div>
          </div>
        </Dialog>
      </Transition.Root>
    </>
  );
}


================================================
FILE: apps/web/src/components/notes/NoteDetails.tsx
================================================
"use client";

import { api } from "@packages/backend/convex/_generated/api";
import { Id } from "@packages/backend/convex/_generated/dataModel";
import { useQuery } from "convex/react";
import ComplexToggle from "../home/ComplexToggle";
import { useState } from "react";

interface NoteDetailsProps {
  noteId: Id<"notes">;
}

const NoteDetails = ({ noteId }: NoteDetailsProps) => {
  const [isSummary, setIsSummary] = useState(false);
  const currentNote = useQuery(api.notes.getNote, { id: noteId });

  return (
    <div className="container space-y-6 sm:space-y-9 py-20 px-[26px] sm:px-0">
      <div className="flex justify-center items-center">
        <ComplexToggle isSummary={isSummary} setIsSummary={setIsSummary} />
      </div>
      <h3 className="text-black text-center pb-5 text-xl sm:text-[32px] not-italic font-semibold leading-[90.3%] tracking-[-0.8px]">
        {currentNote?.title}
      </h3>
      <p className="text-black text-xl sm:text-[28px] not-italic font-normal leading-[130.3%] tracking-[-0.7px]">
        {!isSummary
          ? currentNote?.content
          : currentNote?.summary
            ? currentNote?.summary
            : "No Summary available"}
      </p>
    </div>
  );
};

export default NoteDetails;


================================================
FILE: apps/web/src/components/notes/NoteItem.tsx
================================================
import Link from "next/link";
import DeleteNote from "./DeleteNote";

export interface NoteProps {
  note: {
    title: string;
    _id: string;
    _creationTime: number;
  };
  deleteNote: any;
}

const NoteItem = ({ note, deleteNote }: NoteProps) => {
  return (
    <div className="flex justify-between items-center h-[74px] bg-[#F9FAFB] py-5 px-5 sm:px-11 gap-x-5 sm:gap-x-10">
      <Link href={`/notes/${note._id}`} className="flex-1">
        <h1 className=" text-[#2D2D2D] text-[17px] sm:text-2xl not-italic font-normal leading-[114.3%] tracking-[-0.6px]">
          {note.title}
        </h1>
      </Link>
      <p className="hidden md:flex text-[#2D2D2D] text-center text-xl not-italic font-extralight leading-[114.3%] tracking-[-0.5px]">
        {new Date(Number(note._creationTime)).toLocaleDateString()}
      </p>
      <DeleteNote deleteAction={() => deleteNote({ noteId: note._id })} />
    </div>
  );
};

export default NoteItem;


================================================
FILE: apps/web/src/components/notes/Notes.tsx
================================================
"use client";

import { api } from "@packages/backend/convex/_generated/api";
import { useMutation, useQuery } from "convex/react";
import Image from "next/image";
import { useState } from "react";
import CreateNote from "./CreateNote";
import NoteItem from "./NoteItem";

const Notes = () => {
  const [search, setSearch] = useState("");

  const allNotes = useQuery(api.notes.getNotes);
  const deleteNote = useMutation(api.notes.deleteNote);

  const finalNotes = search
    ? allNotes?.filter(
        (note) =>
          note.title.toLowerCase().includes(search.toLowerCase()) ||
          note.content.toLowerCase().includes(search.toLowerCase()),
      )
    : allNotes;

  return (
    <div className="container pb-10">
      <h1 className="text-[#2D2D2D] text-center text-[20px] sm:text-[43px] not-italic font-normal sm:font-medium leading-[114.3%] tracking-[-1.075px] sm:mt-8 my-4  sm:mb-10">
        Your Notes
      </h1>
      <div className="px-5 sm:px-0">
        <div className="bg-white flex items-center h-[39px] sm:h-[55px] rounded-sm border border-solid gap-2 sm:gap-5 mb-10 border-[rgba(0,0,0,0.40)] px-3 sm:px-11">
          <Image
            src={"/images/search.svg"}
            width={23}
            height={22}
            alt="search"
            className="cursor-pointer sm:w-[23px] sm:h-[22px] w-[20px] h-[20px]"
          />
          <input
            type="text"
            placeholder="Search"
            value={search}
            onChange={(e) => setSearch(e.target.value)}
            className="flex-1 text-[#2D2D2D] text-[17px] sm:text-2xl not-italic font-light leading-[114.3%] tracking-[-0.6px] focus:outline-0 focus:ring-0 focus:border-0 border-0"
          />
        </div>
      </div>

      <div className="border-[0.5px] mb-20 divide-y-[0.5px] divide-[#00000096] border-[#00000096]">
        {finalNotes &&
          finalNotes.map((note) => (
            <NoteItem key={note._id} note={note} deleteNote={deleteNote} />
          ))}
      </div>

      <CreateNote />
    </div>
  );
};

export default Notes;


================================================
FILE: apps/web/src/lib/utils.ts
================================================
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";

export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs));
}


================================================
FILE: apps/web/src/proxy.ts
================================================
import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server";

const isProtectedRoute = createRouteMatcher(["/notes(.*)"]);

export default clerkMiddleware(async (auth, request) => {
  if (!isProtectedRoute(request)) return;

  await auth.protect();
});

export const config = {
  matcher: [
    "/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)",
    "/(api|trpc)(.*)",
  ],
};


================================================
FILE: apps/web/tsconfig.json
================================================
{
  "compilerOptions": {
    "target": "ES2022",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "bundler",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "react-jsx",
    "incremental": true,
    "plugins": [
      {
        "name": "next"
      }
    ],
    "paths": {
      "@/*": ["./src/*"]
    }
  },
  "include": [
    "next-env.d.ts",
    "**/*.ts",
    "**/*.tsx",
    ".next/types/**/*.ts",
    ".next/dev/types/**/*.ts"
  ],
  "exclude": ["node_modules"]
}


================================================
FILE: apps/web/vercel.json
================================================
{
  "buildCommand": "cd ../../packages/backend && npx convex deploy --cmd 'cd ../../apps/web && turbo run build' --cmd-url-env-var-name NEXT_PUBLIC_CONVEX_URL"
}


================================================
FILE: package.json
================================================
{
  "name": "convex-monorepo",
  "private": true,
  "scripts": {
    "dev": "turbo run dev",
    "build": "turbo run build",
    "typecheck": "turbo run typecheck",
    "clean": "turbo run clean && rm -rf node_modules",
    "format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\" --ignore-path .gitignore"
  },
  "devDependencies": {
    "prettier": "3.8.3",
    "turbo": "2.9.6"
  },
  "engines": {
    "node": ">=20.20.0"
  },
  "workspaces": [
    "apps/*",
    "packages/*"
  ],
  "packageManager": "pnpm@10.33.0"
}


================================================
FILE: packages/backend/.gitignore
================================================
.env.local
.env


================================================
FILE: packages/backend/convex/README.md
================================================
# Welcome to your Convex functions directory!

Write your Convex functions here. See
https://docs.convex.dev/using/writing-convex-functions for more.

A query function that takes two arguments looks like:

```ts
// functions.js
import { query } from "./_generated/server";
import { v } from "convex/values";

export const myQueryFunction = query({
  // Validators for arguments.
  args: {
    first: v.number(),
    second: v.string(),
  },

  // Function implementation.
  handler: async (ctx, args) => {
    // Read the database as many times as you need here.
    // See https://docs.convex.dev/database/reading-data.
    const documents = await ctx.db.query("tablename").collect();

    // Arguments passed from the client are properties of the args object.
    console.log(args.first, args.second);

    // Write arbitrary JavaScript here: filter, aggregate, build derived data,
    // remove non-public properties, or create new objects.
    return documents;
  },
});
```

Using this query function in a React component looks like:

```ts
const data = useQuery(api.functions.myQueryFunction, {
  first: 10,
  second: "hello",
});
```

A mutation function looks like:

```ts
// functions.js
import { mutation } from "./_generated/server";
import { v } from "convex/values";

export const myMutationFunction = mutation({
  // Validators for arguments.
  args: {
    first: v.string(),
    second: v.string(),
  },

  // Function implementation.
  handler: async (ctx, args) => {
    // Insert or modify documents in the database here.
    // Mutations can also read from the database like queries.
    // See https://docs.convex.dev/database/writing-data.
    const message = { body: args.first, author: args.second };
    const id = await ctx.db.insert("messages", message);

    // Optionally, return a value from your mutation.
    return await ctx.db.get(id);
  },
});
```

Using this mutation function in a React component looks like:

```ts
const mutation = useMutation(api.functions.myMutationFunction);
function handleButtonPress() {
  // fire and forget, the most common way to use mutations
  mutation({ first: "Hello!", second: "me" });
  // OR
  // use the result once the mutation has completed
  mutation({ first: "Hello!", second: "me" }).then((result) =>
    console.log(result),
  );
}
```

Use the Convex CLI to push your functions to a deployment. See everything
the Convex CLI can do by running `npx convex -h` in your project root
directory. To learn more, launch the docs with `npx convex docs`.


================================================
FILE: packages/backend/convex/_generated/api.d.ts
================================================
/* eslint-disable */
/**
 * Generated `api` utility.
 *
 * THIS CODE IS AUTOMATICALLY GENERATED.
 *
 * To regenerate, run `npx convex dev`.
 * @module
 */

import type * as notes from "../notes.js";
import type * as openai from "../openai.js";
import type * as utils from "../utils.js";

import type {
  ApiFromModules,
  FilterApi,
  FunctionReference,
} from "convex/server";

declare const fullApi: ApiFromModules<{
  notes: typeof notes;
  openai: typeof openai;
  utils: typeof utils;
}>;

/**
 * A utility for referencing Convex functions in your app's public API.
 *
 * Usage:
 * ```js
 * const myFunctionReference = api.myModule.myFunction;
 * ```
 */
export declare const api: FilterApi<
  typeof fullApi,
  FunctionReference<any, "public">
>;

/**
 * A utility for referencing Convex functions in your app's internal API.
 *
 * Usage:
 * ```js
 * const myFunctionReference = internal.myModule.myFunction;
 * ```
 */
export declare const internal: FilterApi<
  typeof fullApi,
  FunctionReference<any, "internal">
>;

export declare const components: {};


================================================
FILE: packages/backend/convex/_generated/api.js
================================================
/* eslint-disable */
/**
 * Generated `api` utility.
 *
 * THIS CODE IS AUTOMATICALLY GENERATED.
 *
 * To regenerate, run `npx convex dev`.
 * @module
 */

import { anyApi, componentsGeneric } from "convex/server";

/**
 * A utility for referencing Convex functions in your app's API.
 *
 * Usage:
 * ```js
 * const myFunctionReference = api.myModule.myFunction;
 * ```
 */
export const api = anyApi;
export const internal = anyApi;
export const components = componentsGeneric();


================================================
FILE: packages/backend/convex/_generated/dataModel.d.ts
================================================
/* eslint-disable */
/**
 * Generated data model types.
 *
 * THIS CODE IS AUTOMATICALLY GENERATED.
 *
 * To regenerate, run `npx convex dev`.
 * @module
 */

import type {
  DataModelFromSchemaDefinition,
  DocumentByName,
  TableNamesInDataModel,
  SystemTableNames,
} from "convex/server";
import type { GenericId } from "convex/values";
import schema from "../schema.js";

/**
 * The names of all of your Convex tables.
 */
export type TableNames = TableNamesInDataModel<DataModel>;

/**
 * The type of a document stored in Convex.
 *
 * @typeParam TableName - A string literal type of the table name (like "users").
 */
export type Doc<TableName extends TableNames> = DocumentByName<
  DataModel,
  TableName
>;

/**
 * An identifier for a document in Convex.
 *
 * Convex documents are uniquely identified by their `Id`, which is accessible
 * on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids).
 *
 * Documents can be loaded using `db.get(tableName, id)` in query and mutation functions.
 *
 * IDs are just strings at runtime, but this type can be used to distinguish them from other
 * strings when type checking.
 *
 * @typeParam TableName - A string literal type of the table name (like "users").
 */
export type Id<TableName extends TableNames | SystemTableNames> =
  GenericId<TableName>;

/**
 * A type describing your Convex data model.
 *
 * This type includes information about what tables you have, the type of
 * documents stored in those tables, and the indexes defined on them.
 *
 * This type is used to parameterize methods like `queryGeneric` and
 * `mutationGeneric` to make them type-safe.
 */
export type DataModel = DataModelFromSchemaDefinition<typeof schema>;


================================================
FILE: packages/backend/convex/_generated/server.d.ts
================================================
/* eslint-disable */
/**
 * Generated utilities for implementing server-side Convex query and mutation functions.
 *
 * THIS CODE IS AUTOMATICALLY GENERATED.
 *
 * To regenerate, run `npx convex dev`.
 * @module
 */

import {
  ActionBuilder,
  HttpActionBuilder,
  MutationBuilder,
  QueryBuilder,
  GenericActionCtx,
  GenericMutationCtx,
  GenericQueryCtx,
  GenericDatabaseReader,
  GenericDatabaseWriter,
} from "convex/server";
import type { DataModel } from "./dataModel.js";

/**
 * Define a query in this Convex app's public API.
 *
 * This function will be allowed to read your Convex database and will be accessible from the client.
 *
 * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
 * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
 */
export declare const query: QueryBuilder<DataModel, "public">;

/**
 * Define a query that is only accessible from other Convex functions (but not from the client).
 *
 * This function will be allowed to read from your Convex database. It will not be accessible from the client.
 *
 * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
 * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
 */
export declare const internalQuery: QueryBuilder<DataModel, "internal">;

/**
 * Define a mutation in this Convex app's public API.
 *
 * This function will be allowed to modify your Convex database and will be accessible from the client.
 *
 * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
 * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
 */
export declare const mutation: MutationBuilder<DataModel, "public">;

/**
 * Define a mutation that is only accessible from other Convex functions (but not from the client).
 *
 * This function will be allowed to modify your Convex database. It will not be accessible from the client.
 *
 * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
 * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
 */
export declare const internalMutation: MutationBuilder<DataModel, "internal">;

/**
 * Define an action in this Convex app's public API.
 *
 * An action is a function which can execute any JavaScript code, including non-deterministic
 * code and code with side-effects, like calling third-party services.
 * They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
 * They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
 *
 * @param func - The action. It receives an {@link ActionCtx} as its first argument.
 * @returns The wrapped action. Include this as an `export` to name it and make it accessible.
 */
export declare const action: ActionBuilder<DataModel, "public">;

/**
 * Define an action that is only accessible from other Convex functions (but not from the client).
 *
 * @param func - The function. It receives an {@link ActionCtx} as its first argument.
 * @returns The wrapped function. Include this as an `export` to name it and make it accessible.
 */
export declare const internalAction: ActionBuilder<DataModel, "internal">;

/**
 * Define an HTTP action.
 *
 * The wrapped function will be used to respond to HTTP requests received
 * by a Convex deployment if the requests matches the path and method where
 * this action is routed. Be sure to route your httpAction in `convex/http.js`.
 *
 * @param func - The function. It receives an {@link ActionCtx} as its first argument
 * and a Fetch API `Request` object as its second.
 * @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
 */
export declare const httpAction: HttpActionBuilder;

/**
 * A set of services for use within Convex query functions.
 *
 * The query context is passed as the first argument to any Convex query
 * function run on the server.
 *
 * This differs from the {@link MutationCtx} because all of the services are
 * read-only.
 */
export type QueryCtx = GenericQueryCtx<DataModel>;

/**
 * A set of services for use within Convex mutation functions.
 *
 * The mutation context is passed as the first argument to any Convex mutation
 * function run on the server.
 */
export type MutationCtx = GenericMutationCtx<DataModel>;

/**
 * A set of services for use within Convex action functions.
 *
 * The action context is passed as the first argument to any Convex action
 * function run on the server.
 */
export type ActionCtx = GenericActionCtx<DataModel>;

/**
 * An interface to read from the database within Convex query functions.
 *
 * The two entry points are {@link DatabaseReader.get}, which fetches a single
 * document by its {@link Id}, or {@link DatabaseReader.query}, which starts
 * building a query.
 */
export type DatabaseReader = GenericDatabaseReader<DataModel>;

/**
 * An interface to read from and write to the database within Convex mutation
 * functions.
 *
 * Convex guarantees that all writes within a single mutation are
 * executed atomically, so you never have to worry about partial writes leaving
 * your data in an inconsistent state. See [the Convex Guide](https://docs.convex.dev/understanding/convex-fundamentals/functions#atomicity-and-optimistic-concurrency-control)
 * for the guarantees Convex provides your functions.
 */
export type DatabaseWriter = GenericDatabaseWriter<DataModel>;


================================================
FILE: packages/backend/convex/_generated/server.js
================================================
/* eslint-disable */
/**
 * Generated utilities for implementing server-side Convex query and mutation functions.
 *
 * THIS CODE IS AUTOMATICALLY GENERATED.
 *
 * To regenerate, run `npx convex dev`.
 * @module
 */

import {
  actionGeneric,
  httpActionGeneric,
  queryGeneric,
  mutationGeneric,
  internalActionGeneric,
  internalMutationGeneric,
  internalQueryGeneric,
} from "convex/server";

/**
 * Define a query in this Convex app's public API.
 *
 * This function will be allowed to read your Convex database and will be accessible from the client.
 *
 * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
 * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
 */
export const query = queryGeneric;

/**
 * Define a query that is only accessible from other Convex functions (but not from the client).
 *
 * This function will be allowed to read from your Convex database. It will not be accessible from the client.
 *
 * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
 * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
 */
export const internalQuery = internalQueryGeneric;

/**
 * Define a mutation in this Convex app's public API.
 *
 * This function will be allowed to modify your Convex database and will be accessible from the client.
 *
 * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
 * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
 */
export const mutation = mutationGeneric;

/**
 * Define a mutation that is only accessible from other Convex functions (but not from the client).
 *
 * This function will be allowed to modify your Convex database. It will not be accessible from the client.
 *
 * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
 * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
 */
export const internalMutation = internalMutationGeneric;

/**
 * Define an action in this Convex app's public API.
 *
 * An action is a function which can execute any JavaScript code, including non-deterministic
 * code and code with side-effects, like calling third-party services.
 * They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
 * They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
 *
 * @param func - The action. It receives an {@link ActionCtx} as its first argument.
 * @returns The wrapped action. Include this as an `export` to name it and make it accessible.
 */
export const action = actionGeneric;

/**
 * Define an action that is only accessible from other Convex functions (but not from the client).
 *
 * @param func - The function. It receives an {@link ActionCtx} as its first argument.
 * @returns The wrapped function. Include this as an `export` to name it and make it accessible.
 */
export const internalAction = internalActionGeneric;

/**
 * Define an HTTP action.
 *
 * The wrapped function will be used to respond to HTTP requests received
 * by a Convex deployment if the requests matches the path and method where
 * this action is routed. Be sure to route your httpAction in `convex/http.js`.
 *
 * @param func - The function. It receives an {@link ActionCtx} as its first argument
 * and a Fetch API `Request` object as its second.
 * @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
 */
export const httpAction = httpActionGeneric;


================================================
FILE: packages/backend/convex/auth.config.ts
================================================
import { type AuthConfig } from "convex/server";

const clerkJwtIssuerDomain = process.env.CLERK_JWT_ISSUER_DOMAIN;

if (!clerkJwtIssuerDomain)
  throw new Error(
    "Missing CLERK_JWT_ISSUER_DOMAIN in Convex environment variables",
  );

export default {
  providers: [
    {
      domain: clerkJwtIssuerDomain,
      applicationID: "convex",
    },
  ],
} satisfies AuthConfig;


================================================
FILE: packages/backend/convex/notes.ts
================================================
import { mutation, query } from "./_generated/server";
import { v } from "convex/values";
import { type Auth } from "convex/server";
import { internal } from "./_generated/api";

export async function getUserId({ auth }: { auth: Auth }) {
  return (await auth.getUserIdentity())?.subject ?? null;
}

async function requireUserId({ auth }: { auth: Auth }) {
  const userId = await getUserId({ auth });
  if (userId) return userId;

  throw new Error(
    "Authenticated user was required, but no Clerk subject was found",
  );
}

// Get all notes for a specific user
export const getNotes = query({
  args: {},
  handler: async (ctx) => {
    const userId = await getUserId(ctx);
    if (!userId) return [];

    return await ctx.db
      .query("notes")
      .withIndex("by_userId", (q) => q.eq("userId", userId))
      .order("desc")
      .take(100);
  },
});

// Get note for a specific note
export const getNote = query({
  args: {
    id: v.optional(v.string()),
  },
  handler: async (ctx, args) => {
    const { id } = args;
    if (!id) return null;

    const normalizedId = ctx.db.normalizeId("notes", id);
    if (!normalizedId) return null;

    const userId = await getUserId(ctx);
    if (!userId) return null;

    const note = await ctx.db.get(normalizedId);
    if (!note || note.userId !== userId) return null;

    return note;
  },
});

// Create a new note for a user
export const createNote = mutation({
  args: {
    title: v.string(),
    content: v.string(),
    isSummary: v.boolean(),
  },
  handler: async (ctx, { title, content, isSummary }) => {
    const userId = await requireUserId(ctx);
    const noteId = await ctx.db.insert("notes", { userId, title, content });

    if (isSummary) {
      await ctx.scheduler.runAfter(0, internal.openai.summary, {
        id: noteId,
        title,
        content,
      });
    }

    return noteId;
  },
});

export const deleteNote = mutation({
  args: {
    noteId: v.id("notes"),
  },
  handler: async (ctx, { noteId }) => {
    const userId = await requireUserId(ctx);
    const note = await ctx.db.get(noteId);

    if (!note) throw new Error(`Note '${noteId}' could not be found`);

    if (note.userId !== userId)
      throw new Error(`User '${userId}' cannot delete note '${noteId}'`);

    await ctx.db.delete(noteId);
  },
});


================================================
FILE: packages/backend/convex/openai.ts
================================================
import OpenAI from "openai";
import { internalAction, internalMutation, query } from "./_generated/server";
import { v } from "convex/values";
import { internal } from "./_generated/api";
import { missingEnvVariableUrl } from "./utils";

export const openaiKeySet = query({
  args: {},
  handler: async () => {
    return Boolean(process.env.OPENAI_API_KEY);
  },
});

export const summary = internalAction({
  args: {
    id: v.id("notes"),
    title: v.string(),
    content: v.string(),
  },
  handler: async (ctx, { id, title, content }) => {
    const apiKey = process.env.OPENAI_API_KEY;
    if (!apiKey) {
      const error = missingEnvVariableUrl(
        "OPENAI_API_KEY",
        "https://platform.openai.com/account/api-keys",
      );
      console.error(error);
      await ctx.runMutation(internal.openai.saveSummary, {
        id: id,
        summary: error,
      });
      return;
    }

    const openai = new OpenAI({ apiKey });
    const output = await openai.responses.create({
      model: "gpt-5.4-mini",
      instructions:
        "You summarize user notes in concise plain English. Respond with summary text only.",
      input: `Summarize the following note.\n\nTitle: ${title}\n\nContent:\n${content}`,
    });
    const summary = output.output_text.trim();

    if (!summary)
      throw new Error(`OpenAI returned an empty summary for note '${id}'`);

    await ctx.runMutation(internal.openai.saveSummary, {
      id,
      summary,
    });
  },
});

export const saveSummary = internalMutation({
  args: {
    id: v.id("notes"),
    summary: v.string(),
  },
  handler: async (ctx, { id, summary }) => {
    await ctx.db.patch(id, {
      summary,
    });
  },
});


================================================
FILE: packages/backend/convex/schema.ts
================================================
import { defineSchema, defineTable } from "convex/server";
import { v } from "convex/values";

export default defineSchema({
  notes: defineTable({
    userId: v.string(),
    title: v.string(),
    content: v.string(),
    summary: v.optional(v.string()),
  }).index("by_userId", ["userId"]),
});


================================================
FILE: packages/backend/convex/tsconfig.json
================================================
{
  /* This TypeScript project config describes the environment that
   * Convex functions run in and is used to typecheck them.
   * You can modify it, but some settings required to use Convex.
   */
  "compilerOptions": {
    /* These settings are not required by Convex and can be modified. */
    "allowJs": true,
    "strict": true,

    /* These compiler options are required by Convex */
    "target": "ESNext",
    "lib": ["ES2021", "dom"],
    "forceConsistentCasingInFileNames": true,
    "allowSyntheticDefaultImports": true,
    "module": "ESNext",
    "moduleResolution": "Bundler",
    "isolatedModules": true,
    "skipLibCheck": true,
    "noEmit": true
  },
  "include": ["./**/*"],
  "exclude": ["./_generated"]
}


================================================
FILE: packages/backend/convex/utils.ts
================================================
export function missingEnvVariableUrl(envVarName: string, whereToGet: string) {
  const deployment = deploymentName();
  if (!deployment) return `Missing ${envVarName} in environment variables.`;
  return (
    `\n  Missing ${envVarName} in environment variables.\n\n` +
    `  Get it from ${whereToGet} .\n  Paste it on the Convex dashboard:\n` +
    `  https://dashboard.convex.dev/d/${deployment}/settings?var=${envVarName}`
  );
}

export function deploymentName() {
  const url = process.env.CONVEX_CLOUD_URL;
  if (!url) return undefined;
  const regex = new RegExp("https://(.+).convex.cloud");
  return regex.exec(url)?.[1];
}


================================================
FILE: packages/backend/package.json
================================================
{
  "name": "@packages/backend",
  "version": "1.0.0",
  "description": "",
  "scripts": {
    "dev": "convex dev",
    "setup": "convex dev --until-success",
    "typecheck": "tsc --noEmit -p convex"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "convex": "^1.35.1",
    "openai": "^6.34.0"
  },
  "devDependencies": {
    "typescript": "6.0.3"
  }
}


================================================
FILE: pnpm-workspace.yaml
================================================
packages:
  - "apps/*"
  - "packages/*"
allowBuilds:
  '@clerk/shared': true
  browser-tabs-lock: true
  bufferutil: true
  core-js: true
  esbuild: true
  sharp: true
  unrs-resolver: true
  utf-8-validate: true

nodeLinker: hoisted


================================================
FILE: renovate.json
================================================
{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "packageRules": [
    {
      "matchUpdateTypes": ["minor", "patch", "pin", "digest"],
      "automerge": true
    },
    {
      "matchDepTypes": ["devDependencies"],
      "automerge": true
    }
  ],
  "extends": ["config:best-practices"]
}


================================================
FILE: turbo.json
================================================
{
  "$schema": "https://turbo.build/schema.json",
  "globalDependencies": ["**/.env.*local"],
  "ui": "tui",
  "tasks": {
    "build": {
      "outputs": ["dist/**", ".next/**", "!.next/cache/**"],
      "dependsOn": ["^build"]
    },
    "dev": {
      "cache": false,
      "persistent": true
    },
    "lint": {},
    "typecheck": {},
    "clean": {
      "cache": false
    }
  }
}
Download .txt
gitextract_vxwibcq7/

├── .gitignore
├── .prettierrc
├── LICENSE
├── README.md
├── apps/
│   ├── native/
│   │   ├── .example.env
│   │   ├── .gitignore
│   │   ├── ConvexClientProvider.tsx
│   │   ├── app.json
│   │   ├── babel.config.js
│   │   ├── index.tsx
│   │   ├── metro.config.js
│   │   ├── package.json
│   │   ├── src/
│   │   │   ├── app/
│   │   │   │   ├── (app)/
│   │   │   │   │   ├── _layout.tsx
│   │   │   │   │   ├── index.tsx
│   │   │   │   │   └── notes/
│   │   │   │   │       ├── [noteId].tsx
│   │   │   │   │       └── new.tsx
│   │   │   │   ├── (auth)/
│   │   │   │   │   ├── _layout.tsx
│   │   │   │   │   └── sign-in.tsx
│   │   │   │   └── _layout.tsx
│   │   │   └── screens/
│   │   │       ├── CreateNoteScreen.tsx
│   │   │       ├── InsideNoteScreen.tsx
│   │   │       ├── LoginScreen.tsx
│   │   │       └── NotesDashboardScreen.tsx
│   │   └── tsconfig.json
│   └── web/
│       ├── .example.env
│       ├── .gitignore
│       ├── eslint.config.mjs
│       ├── package.json
│       ├── postcss.config.js
│       ├── src/
│       │   ├── app/
│       │   │   ├── ConvexClientProvider.tsx
│       │   │   ├── globals.css
│       │   │   ├── layout.tsx
│       │   │   ├── notes/
│       │   │   │   ├── [slug]/
│       │   │   │   │   └── page.tsx
│       │   │   │   └── page.tsx
│       │   │   └── page.tsx
│       │   ├── components/
│       │   │   ├── Header.tsx
│       │   │   ├── common/
│       │   │   │   ├── Logo.tsx
│       │   │   │   ├── Menu.tsx
│       │   │   │   ├── TestTimonialCard.tsx
│       │   │   │   ├── UserNav.tsx
│       │   │   │   ├── avatar.tsx
│       │   │   │   ├── button.tsx
│       │   │   │   └── dropdown-menu.tsx
│       │   │   ├── home/
│       │   │   │   ├── Benefits.tsx
│       │   │   │   ├── ComplexToggle.tsx
│       │   │   │   ├── Footer.tsx
│       │   │   │   ├── FooterHero.tsx
│       │   │   │   ├── Hero.tsx
│       │   │   │   └── Testimonials.tsx
│       │   │   └── notes/
│       │   │       ├── Checkbox.tsx
│       │   │       ├── CreateNote.tsx
│       │   │       ├── DeleteNote.tsx
│       │   │       ├── NoteDetails.tsx
│       │   │       ├── NoteItem.tsx
│       │   │       └── Notes.tsx
│       │   ├── lib/
│       │   │   └── utils.ts
│       │   └── proxy.ts
│       ├── tsconfig.json
│       └── vercel.json
├── package.json
├── packages/
│   └── backend/
│       ├── .gitignore
│       ├── convex/
│       │   ├── README.md
│       │   ├── _generated/
│       │   │   ├── api.d.ts
│       │   │   ├── api.js
│       │   │   ├── dataModel.d.ts
│       │   │   ├── server.d.ts
│       │   │   └── server.js
│       │   ├── auth.config.ts
│       │   ├── notes.ts
│       │   ├── openai.ts
│       │   ├── schema.ts
│       │   ├── tsconfig.json
│       │   └── utils.ts
│       └── package.json
├── pnpm-workspace.yaml
├── renovate.json
└── turbo.json
Download .txt
SYMBOL INDEX (39 symbols across 28 files)

FILE: apps/native/ConvexClientProvider.tsx
  function ConvexClientProvider (line 22) | function ConvexClientProvider({

FILE: apps/native/src/app/(app)/_layout.tsx
  function AppLayout (line 4) | function AppLayout() {

FILE: apps/native/src/app/(auth)/_layout.tsx
  function AuthLayout (line 4) | function AuthLayout() {

FILE: apps/native/src/app/_layout.tsx
  function RootLayout (line 9) | function RootLayout() {

FILE: apps/native/src/screens/CreateNoteScreen.tsx
  function CreateNoteScreen (line 23) | function CreateNoteScreen() {

FILE: apps/native/src/screens/InsideNoteScreen.tsx
  function InsideNoteScreen (line 18) | function InsideNoteScreen() {

FILE: apps/native/src/screens/LoginScreen.tsx
  type OAuthStrategy (line 8) | type OAuthStrategy = "oauth_google" | "oauth_apple";

FILE: apps/web/src/app/ConvexClientProvider.tsx
  function ConvexClientProvider (line 15) | function ConvexClientProvider({

FILE: apps/web/src/app/layout.tsx
  function RootLayout (line 17) | function RootLayout({

FILE: apps/web/src/app/notes/[slug]/page.tsx
  function Page (line 5) | async function Page({

FILE: apps/web/src/app/notes/page.tsx
  function Home (line 4) | function Home() {

FILE: apps/web/src/app/page.tsx
  function Home (line 10) | function Home() {

FILE: apps/web/src/components/Header.tsx
  type NavigationItem (line 15) | type NavigationItem = {
  function Header (line 26) | function Header() {

FILE: apps/web/src/components/common/Logo.tsx
  type Props (line 5) | interface Props {

FILE: apps/web/src/components/common/Menu.tsx
  type Props (line 3) | interface Props {

FILE: apps/web/src/components/common/TestTimonialCard.tsx
  type Props (line 2) | interface Props {

FILE: apps/web/src/components/common/UserNav.tsx
  function UserNav (line 16) | function UserNav({

FILE: apps/web/src/components/common/button.tsx
  type ButtonProps (line 37) | interface ButtonProps

FILE: apps/web/src/components/home/ComplexToggle.tsx
  function classNames (line 4) | function classNames(...classes: string[]) {
  function ComplexToggle (line 8) | function ComplexToggle({

FILE: apps/web/src/components/notes/CreateNote.tsx
  function CreateNote (line 10) | function CreateNote() {

FILE: apps/web/src/components/notes/DeleteNote.tsx
  function DeleteNote (line 7) | function DeleteNote({ deleteAction }: any) {

FILE: apps/web/src/components/notes/NoteDetails.tsx
  type NoteDetailsProps (line 9) | interface NoteDetailsProps {

FILE: apps/web/src/components/notes/NoteItem.tsx
  type NoteProps (line 4) | interface NoteProps {

FILE: apps/web/src/lib/utils.ts
  function cn (line 4) | function cn(...inputs: ClassValue[]) {

FILE: packages/backend/convex/_generated/dataModel.d.ts
  type TableNames (line 23) | type TableNames = TableNamesInDataModel<DataModel>;
  type Doc (line 30) | type Doc<TableName extends TableNames> = DocumentByName<
  type Id (line 48) | type Id<TableName extends TableNames | SystemTableNames> =
  type DataModel (line 60) | type DataModel = DataModelFromSchemaDefinition<typeof schema>;

FILE: packages/backend/convex/_generated/server.d.ts
  type QueryCtx (line 107) | type QueryCtx = GenericQueryCtx<DataModel>;
  type MutationCtx (line 115) | type MutationCtx = GenericMutationCtx<DataModel>;
  type ActionCtx (line 123) | type ActionCtx = GenericActionCtx<DataModel>;
  type DatabaseReader (line 132) | type DatabaseReader = GenericDatabaseReader<DataModel>;
  type DatabaseWriter (line 143) | type DatabaseWriter = GenericDatabaseWriter<DataModel>;

FILE: packages/backend/convex/notes.ts
  function getUserId (line 6) | async function getUserId({ auth }: { auth: Auth }) {
  function requireUserId (line 10) | async function requireUserId({ auth }: { auth: Auth }) {

FILE: packages/backend/convex/utils.ts
  function missingEnvVariableUrl (line 1) | function missingEnvVariableUrl(envVarName: string, whereToGet: string) {
  function deploymentName (line 11) | function deploymentName() {
Condensed preview — 77 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (141K chars).
[
  {
    "path": ".gitignore",
    "chars": 394,
    "preview": "# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.\n\n# dependencies\nnode_modules\n.pnp\n"
  },
  {
    "path": ".prettierrc",
    "chars": 30,
    "preview": "{\n  \"arrowParens\": \"always\"\n}\n"
  },
  {
    "path": "LICENSE",
    "chars": 11343,
    "preview": "\n                                 Apache License\n                           Version 2.0, January 2004\n                  "
  },
  {
    "path": "README.md",
    "chars": 2729,
    "preview": "# Fullstack Monorepo Template\n\nThis repo is a modern TypeScript monorepo for a shared notes app across web and native.\n\n"
  },
  {
    "path": "apps/native/.example.env",
    "chars": 59,
    "preview": "EXPO_PUBLIC_CONVEX_URL=\nEXPO_PUBLIC_CLERK_PUBLISHABLE_KEY=\n"
  },
  {
    "path": "apps/native/.gitignore",
    "chars": 367,
    "preview": "node_modules/\n.expo/\ndist/\nnpm-debug.*\n*.jks\n*.p8\n*.p12\n*.key\n*.mobileprovision\n*.orig.*\nweb-build/\n\n# macOS\n.DS_Store\n\n"
  },
  {
    "path": "apps/native/ConvexClientProvider.tsx",
    "chars": 1019,
    "preview": "import { type ReactNode } from \"react\";\nimport { ClerkProvider, useAuth } from \"@clerk/clerk-expo\";\nimport { tokenCache "
  },
  {
    "path": "apps/native/app.json",
    "chars": 921,
    "preview": "{\n  \"expo\": {\n    \"newArchEnabled\": true,\n    \"name\": \"NotesContract\",\n    \"slug\": \"NotesContract\",\n    \"scheme\": \"notes"
  },
  {
    "path": "apps/native/babel.config.js",
    "chars": 108,
    "preview": "module.exports = function (api) {\n  api.cache(true);\n  return {\n    presets: [\"babel-preset-expo\"],\n  };\n};\n"
  },
  {
    "path": "apps/native/index.tsx",
    "chars": 117,
    "preview": "import * as WebBrowser from \"expo-web-browser\";\n\nWebBrowser.maybeCompleteAuthSession();\n\nimport \"expo-router/entry\";\n"
  },
  {
    "path": "apps/native/metro.config.js",
    "chars": 106,
    "preview": "const { getDefaultConfig } = require(\"expo/metro-config\");\n\nmodule.exports = getDefaultConfig(__dirname);\n"
  },
  {
    "path": "apps/native/package.json",
    "chars": 1466,
    "preview": "{\n  \"name\": \"native-app\",\n  \"version\": \"1.0.0\",\n  \"main\": \"index.tsx\",\n  \"scripts\": {\n    \"dev\": \"expo start\",\n    \"star"
  },
  {
    "path": "apps/native/src/app/(app)/_layout.tsx",
    "chars": 327,
    "preview": "import { useAuth } from \"@clerk/clerk-expo\";\nimport { Redirect, Stack } from \"expo-router\";\n\nexport default function App"
  },
  {
    "path": "apps/native/src/app/(app)/index.tsx",
    "chars": 62,
    "preview": "export { default } from \"../../screens/NotesDashboardScreen\";\n"
  },
  {
    "path": "apps/native/src/app/(app)/notes/[noteId].tsx",
    "chars": 61,
    "preview": "export { default } from \"../../../screens/InsideNoteScreen\";\n"
  },
  {
    "path": "apps/native/src/app/(app)/notes/new.tsx",
    "chars": 61,
    "preview": "export { default } from \"../../../screens/CreateNoteScreen\";\n"
  },
  {
    "path": "apps/native/src/app/(auth)/_layout.tsx",
    "chars": 320,
    "preview": "import { useAuth } from \"@clerk/clerk-expo\";\nimport { Redirect, Stack } from \"expo-router\";\n\nexport default function Aut"
  },
  {
    "path": "apps/native/src/app/(auth)/sign-in.tsx",
    "chars": 53,
    "preview": "export { default } from \"../../screens/LoginScreen\";\n"
  },
  {
    "path": "apps/native/src/app/_layout.tsx",
    "chars": 1340,
    "preview": "import { useFonts } from \"expo-font\";\nimport { Stack } from \"expo-router\";\nimport { Platform, StatusBar, View } from \"re"
  },
  {
    "path": "apps/native/src/screens/CreateNoteScreen.tsx",
    "chars": 9342,
    "preview": "import React, { useEffect, useRef, useState } from \"react\";\nimport {\n  StyleSheet,\n  Text,\n  View,\n  Image,\n  Dimensions"
  },
  {
    "path": "apps/native/src/screens/InsideNoteScreen.tsx",
    "chars": 5387,
    "preview": "import React, { useState } from \"react\";\nimport { api } from \"@packages/backend/convex/_generated/api\";\nimport { useQuer"
  },
  {
    "path": "apps/native/src/screens/LoginScreen.tsx",
    "chars": 4614,
    "preview": "import React from \"react\";\nimport { StyleSheet, View, Text, TouchableOpacity, Image } from \"react-native\";\nimport { useS"
  },
  {
    "path": "apps/native/src/screens/NotesDashboardScreen.tsx",
    "chars": 5635,
    "preview": "import React, { useState } from \"react\";\nimport {\n  StyleSheet,\n  View,\n  Text,\n  TextInput,\n  TouchableOpacity,\n  Image"
  },
  {
    "path": "apps/native/tsconfig.json",
    "chars": 210,
    "preview": "{\n  \"extends\": \"expo/tsconfig.base\",\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"paths\": {\n      \"@/*\": [\"./src/*\"]\n"
  },
  {
    "path": "apps/web/.example.env",
    "chars": 77,
    "preview": "NEXT_PUBLIC_CONVEX_URL=\nNEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=\nCLERK_SECRET_KEY=\n"
  },
  {
    "path": "apps/web/.gitignore",
    "chars": 391,
    "preview": "# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.\n\n# dependencies\n/node_modules\n/.pn"
  },
  {
    "path": "apps/web/eslint.config.mjs",
    "chars": 244,
    "preview": "import { defineConfig, globalIgnores } from \"eslint/config\";\nimport nextVitals from \"eslint-config-next/core-web-vitals\""
  },
  {
    "path": "apps/web/package.json",
    "chars": 1084,
    "preview": "{\n  \"name\": \"web-app\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"scripts\": {\n    \"dev\": \"next dev\",\n    \"build\": \"next"
  },
  {
    "path": "apps/web/postcss.config.js",
    "chars": 72,
    "preview": "module.exports = {\n  plugins: {\n    \"@tailwindcss/postcss\": {},\n  },\n};\n"
  },
  {
    "path": "apps/web/src/app/ConvexClientProvider.tsx",
    "chars": 632,
    "preview": "\"use client\";\n\nimport { type ReactNode } from \"react\";\nimport { useAuth } from \"@clerk/nextjs\";\nimport { ConvexReactClie"
  },
  {
    "path": "apps/web/src/app/globals.css",
    "chars": 1670,
    "preview": "@import 'tailwindcss';\n\n@theme {\n  --breakpoint-*: initial;\n  --breakpoint-sm: 640px;\n  --breakpoint-md: 768px;\n  --brea"
  },
  {
    "path": "apps/web/src/app/layout.tsx",
    "chars": 898,
    "preview": "import type { Metadata } from \"next\";\nimport { ClerkProvider } from \"@clerk/nextjs\";\nimport { Inter, Montserrat, Lato } "
  },
  {
    "path": "apps/web/src/app/notes/[slug]/page.tsx",
    "chars": 439,
    "preview": "import Header from \"@/components/Header\";\nimport NoteDetails from \"@/components/notes/NoteDetails\";\nimport { Id } from \""
  },
  {
    "path": "apps/web/src/app/notes/page.tsx",
    "chars": 230,
    "preview": "import Header from \"@/components/Header\";\nimport Notes from \"@/components/notes/Notes\";\n\nexport default function Home() "
  },
  {
    "path": "apps/web/src/app/page.tsx",
    "chars": 499,
    "preview": "\"use client\";\n\nimport Header from \"@/components/Header\";\nimport Benefits from \"@/components/home/Benefits\";\nimport Foote"
  },
  {
    "path": "apps/web/src/components/Header.tsx",
    "chars": 6408,
    "preview": "\"use client\";\n\nimport {\n  Disclosure,\n  DisclosureButton,\n  DisclosurePanel,\n} from \"@headlessui/react\";\nimport { Bars3I"
  },
  {
    "path": "apps/web/src/components/common/Logo.tsx",
    "chars": 601,
    "preview": "import Image from \"next/image\";\nimport Link from \"next/link\";\nimport React from \"react\";\n\ninterface Props {\n  isMobile?:"
  },
  {
    "path": "apps/web/src/components/common/Menu.tsx",
    "chars": 595,
    "preview": "import Link from \"next/link\";\n\ninterface Props {\n  menuItems: {\n    title: string;\n    url: string;\n  }[];\n}\n\nconst Menu"
  },
  {
    "path": "apps/web/src/components/common/TestTimonialCard.tsx",
    "chars": 2032,
    "preview": "import Image from \"next/image\";\ninterface Props {\n  data: {\n    feature?: boolean;\n    review: string;\n    profile: stri"
  },
  {
    "path": "apps/web/src/components/common/UserNav.tsx",
    "chars": 2183,
    "preview": "import { useClerk } from \"@clerk/nextjs\";\nimport { LogOut, Paintbrush2 } from \"lucide-react\";\nimport Link from \"next/lin"
  },
  {
    "path": "apps/web/src/components/common/avatar.tsx",
    "chars": 1422,
    "preview": "import * as React from \"react\";\nimport * as AvatarPrimitive from \"@radix-ui/react-avatar\";\nimport { cn } from \"@/lib/uti"
  },
  {
    "path": "apps/web/src/components/common/button.tsx",
    "chars": 1841,
    "preview": "import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"cla"
  },
  {
    "path": "apps/web/src/components/common/dropdown-menu.tsx",
    "chars": 6998,
    "preview": "import * as React from \"react\";\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { Check, "
  },
  {
    "path": "apps/web/src/components/home/Benefits.tsx",
    "chars": 3232,
    "preview": "import Image from \"next/image\";\n\nconst benefits = [\n  {\n    title: \"Effortless Note-Taking\",\n    description: \"Capture t"
  },
  {
    "path": "apps/web/src/components/home/ComplexToggle.tsx",
    "chars": 1552,
    "preview": "import { useState } from \"react\";\nimport { Switch } from \"@headlessui/react\";\n\nfunction classNames(...classes: string[])"
  },
  {
    "path": "apps/web/src/components/home/Footer.tsx",
    "chars": 2326,
    "preview": "import React from \"react\";\nimport Logo from \"../common/Logo\";\nimport Menu from \"../common/Menu\";\n\nconst menuItems = [\n  "
  },
  {
    "path": "apps/web/src/components/home/FooterHero.tsx",
    "chars": 1519,
    "preview": "import Image from \"next/image\";\nimport Link from \"next/link\";\nimport React from \"react\";\n\nconst FooterHero = () => {\n  r"
  },
  {
    "path": "apps/web/src/components/home/Hero.tsx",
    "chars": 2254,
    "preview": "import Image from \"next/image\";\nimport Link from \"next/link\";\n\nconst Hero = () => {\n  return (\n    <section className=\"b"
  },
  {
    "path": "apps/web/src/components/home/Testimonials.tsx",
    "chars": 2429,
    "preview": "import Image from \"next/image\";\nimport TestTimonialCard from \"../common/TestTimonialCard\";\n\nconst TestimonialsData = [\n "
  },
  {
    "path": "apps/web/src/components/notes/Checkbox.tsx",
    "chars": 1547,
    "preview": "const Checkbox = ({\n  isChecked,\n  checkHandler,\n  openaiKeySet,\n}: {\n  isChecked: boolean;\n  checkHandler: () => void;\n"
  },
  {
    "path": "apps/web/src/components/notes/CreateNote.tsx",
    "chars": 7126,
    "preview": "\"use client\";\n\nimport { Fragment, useRef, useState } from \"react\";\nimport { Dialog, Transition } from \"@headlessui/react"
  },
  {
    "path": "apps/web/src/components/notes/DeleteNote.tsx",
    "chars": 4494,
    "preview": "\"use client\";\nimport { Fragment, useRef, useState } from \"react\";\nimport { Dialog, Transition } from \"@headlessui/react\""
  },
  {
    "path": "apps/web/src/components/notes/NoteDetails.tsx",
    "chars": 1247,
    "preview": "\"use client\";\n\nimport { api } from \"@packages/backend/convex/_generated/api\";\nimport { Id } from \"@packages/backend/conv"
  },
  {
    "path": "apps/web/src/components/notes/NoteItem.tsx",
    "chars": 950,
    "preview": "import Link from \"next/link\";\nimport DeleteNote from \"./DeleteNote\";\n\nexport interface NoteProps {\n  note: {\n    title: "
  },
  {
    "path": "apps/web/src/components/notes/Notes.tsx",
    "chars": 2065,
    "preview": "\"use client\";\n\nimport { api } from \"@packages/backend/convex/_generated/api\";\nimport { useMutation, useQuery } from \"con"
  },
  {
    "path": "apps/web/src/lib/utils.ts",
    "chars": 169,
    "preview": "import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: C"
  },
  {
    "path": "apps/web/src/proxy.ts",
    "chars": 460,
    "preview": "import { clerkMiddleware, createRouteMatcher } from \"@clerk/nextjs/server\";\n\nconst isProtectedRoute = createRouteMatcher"
  },
  {
    "path": "apps/web/tsconfig.json",
    "chars": 654,
    "preview": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"lib\": [\"dom\", \"dom.iterable\", \"esnext\"],\n    \"allowJs\": true,\n    "
  },
  {
    "path": "apps/web/vercel.json",
    "chars": 162,
    "preview": "{\n  \"buildCommand\": \"cd ../../packages/backend && npx convex deploy --cmd 'cd ../../apps/web && turbo run build' --cmd-u"
  },
  {
    "path": "package.json",
    "chars": 525,
    "preview": "{\n  \"name\": \"convex-monorepo\",\n  \"private\": true,\n  \"scripts\": {\n    \"dev\": \"turbo run dev\",\n    \"build\": \"turbo run bui"
  },
  {
    "path": "packages/backend/.gitignore",
    "chars": 16,
    "preview": ".env.local\n.env\n"
  },
  {
    "path": "packages/backend/convex/README.md",
    "chars": 2523,
    "preview": "# Welcome to your Convex functions directory!\n\nWrite your Convex functions here. See\nhttps://docs.convex.dev/using/writi"
  },
  {
    "path": "packages/backend/convex/_generated/api.d.ts",
    "chars": 1064,
    "preview": "/* eslint-disable */\n/**\n * Generated `api` utility.\n *\n * THIS CODE IS AUTOMATICALLY GENERATED.\n *\n * To regenerate, ru"
  },
  {
    "path": "packages/backend/convex/_generated/api.js",
    "chars": 480,
    "preview": "/* eslint-disable */\n/**\n * Generated `api` utility.\n *\n * THIS CODE IS AUTOMATICALLY GENERATED.\n *\n * To regenerate, ru"
  },
  {
    "path": "packages/backend/convex/_generated/dataModel.d.ts",
    "chars": 1736,
    "preview": "/* eslint-disable */\n/**\n * Generated data model types.\n *\n * THIS CODE IS AUTOMATICALLY GENERATED.\n *\n * To regenerate,"
  },
  {
    "path": "packages/backend/convex/_generated/server.d.ts",
    "chars": 5600,
    "preview": "/* eslint-disable */\n/**\n * Generated utilities for implementing server-side Convex query and mutation functions.\n *\n * "
  },
  {
    "path": "packages/backend/convex/_generated/server.js",
    "chars": 3696,
    "preview": "/* eslint-disable */\n/**\n * Generated utilities for implementing server-side Convex query and mutation functions.\n *\n * "
  },
  {
    "path": "packages/backend/convex/auth.config.ts",
    "chars": 381,
    "preview": "import { type AuthConfig } from \"convex/server\";\n\nconst clerkJwtIssuerDomain = process.env.CLERK_JWT_ISSUER_DOMAIN;\n\nif "
  },
  {
    "path": "packages/backend/convex/notes.ts",
    "chars": 2313,
    "preview": "import { mutation, query } from \"./_generated/server\";\nimport { v } from \"convex/values\";\nimport { type Auth } from \"con"
  },
  {
    "path": "packages/backend/convex/openai.ts",
    "chars": 1697,
    "preview": "import OpenAI from \"openai\";\nimport { internalAction, internalMutation, query } from \"./_generated/server\";\nimport { v }"
  },
  {
    "path": "packages/backend/convex/schema.ts",
    "chars": 298,
    "preview": "import { defineSchema, defineTable } from \"convex/server\";\nimport { v } from \"convex/values\";\n\nexport default defineSche"
  },
  {
    "path": "packages/backend/convex/tsconfig.json",
    "chars": 732,
    "preview": "{\n  /* This TypeScript project config describes the environment that\n   * Convex functions run in and is used to typeche"
  },
  {
    "path": "packages/backend/convex/utils.ts",
    "chars": 635,
    "preview": "export function missingEnvVariableUrl(envVarName: string, whereToGet: string) {\n  const deployment = deploymentName();\n "
  },
  {
    "path": "packages/backend/package.json",
    "chars": 371,
    "preview": "{\n  \"name\": \"@packages/backend\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"scripts\": {\n    \"dev\": \"convex dev\",\n    "
  },
  {
    "path": "pnpm-workspace.yaml",
    "chars": 234,
    "preview": "packages:\n  - \"apps/*\"\n  - \"packages/*\"\nallowBuilds:\n  '@clerk/shared': true\n  browser-tabs-lock: true\n  bufferutil: tru"
  },
  {
    "path": "renovate.json",
    "chars": 314,
    "preview": "{\n  \"$schema\": \"https://docs.renovatebot.com/renovate-schema.json\",\n  \"packageRules\": [\n    {\n      \"matchUpdateTypes\": "
  },
  {
    "path": "turbo.json",
    "chars": 387,
    "preview": "{\n  \"$schema\": \"https://turbo.build/schema.json\",\n  \"globalDependencies\": [\"**/.env.*local\"],\n  \"ui\": \"tui\",\n  \"tasks\": "
  }
]

About this extraction

This page contains the full source code of the get-convex/turbo-expo-nextjs-clerk-convex-monorepo GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 77 files (126.5 KB), approximately 34.2k tokens, and a symbol index with 39 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!