This is a real-time chat application that allows users to chat with AI. It provides a seamless and interactive messaging experience.
- Real-time messaging
- User authentication
- (Add more features as applicable)
- Frontend:
- Next.js
- React
- React Router
- TypeScript
- Tailwind CSS
- Shadcn
- Backend:
- Convex
The project follows a standard Next.js application structure:
.
├── app/ # Main Next.js application pages and layouts
├── components/ # Reusable UI components
├── convex/ # Convex backend functions (database schema, queries, mutations)
├── frontend/ # The react router frontend.
├── lib/ # Utility functions and shared logic
├── public/ # Static assets (images, fonts, etc.)
├── .env.local # Environment variables (for Convex, API keys, etc.)
├── next.config.js # Next.js configuration
├── package.json # Project dependencies and scripts
├── tailwind.config.ts # Tailwind CSS configuration
└── tsconfig.json # TypeScript configuration
app/: Contains the core application routes, pages, and layouts. Next.js 13+ App Router is used.components/: Houses reusable React components used throughout the application.convex/: Includes all backend logic managed by Convex. This typically contains:schema.ts: Defines the database schema.*.ts(e.g.,messages.ts,users.ts): Contains Convex query and mutation functions.
lib/: Holds shared utility functions, helper scripts, or any other code that doesn't fit into the other categories.public/: Stores static assets that are served directly by the web server (e.g., images, favicons).
Follow these instructions to get a local copy of the project up and running.
Make sure you have the following software installed on your machine:
-
Clone the repository (if applicable):
git clone <your-repository-url> cd <project-directory>
-
Install dependencies: Using npm:
npm install
This project uses Convex for its backend.
-
Set up Convex:
Initialize Convex for your project. This will guide you through creating a new Convex project or linking to an existing one.
npx convex dev
This command will also create necessary Convex configuration files and potentially a
.env.localfile or update your existing one with your Convex deployment URL (e.g.,CONVEX_URL=https://<your-project-name>.convex.cloud). -
Environment Variables: Create a
.env.localfile in the root of your project if it wasn't created bynpx convex devor if you have other environment variables to add. It should contain your Convex deployment URL:NEXT_PUBLIC_CONVEX_URL="https://<your-project-name>.convex.cloud" # Add any other environment variables here
Important: The
npx convex devcommand watches yourconvex/directory and pushes changes to your Convex deployment. It also generates TypeScript files for your Convex functions intoconvex/_generated/server.tsandconvex/_generated/client.ts, which are then used by your frontend. Keep this process running in a separate terminal while developing.
-
Start the Next.js development server and convex: Using npm:
npm run dev
This will typically start the application on http://localhost:3000. Open this URL in your browser to see the application.
Upon launching the application, users can:
- Sign up or log in.
- Send and receive messages in real-time.
- (Describe other user interactions based on features)