Mistral Thing is a sleek and modern AI chat application that allows you to interact with large language models from Mistral AI. Built with a focus on user experience, it provides a clean interface for conversing with various Mistral AI models, managing conversation threads, and customizing your chat experience.
This project is built with modern technologies:
- Next.js 16 - React framework with App Router
- React 19 - UI library
- TypeScript - Type safety
- Tailwind CSS - Styling
- Shadcn/UI - UI component library
- Radix UI - Accessible component primitives
- React Markdown - Markdown rendering
- Shiki - Code syntax highlighting
- Convex - Backend-as-a-Service with real-time database
- Better Auth - Authentication system
- Mistral AI SDK - AI model integration
- Resend - Email delivery service
- Bun - Package manager and runtime
- Biome - Linter and formatter
- Ultracite - Code formatting
- Husky - Git hooks
- mprocs - Process manager for development
Before you begin, ensure you have the following installed:
- Node.js - Version 22.x or higher
- Bun - Version 1.3.1 or higher (Installation Guide)
- Convex Account - Sign up at convex.dev
- Mistral AI API Key - Get one from console.mistral.ai
- OAuth Credentials (Optional, for social login):
- GitHub OAuth App (GitHub Developer Settings)
- Google OAuth Client (Google Cloud Console)
- Resend API Key (Optional, for magic link emails) - Get one from resend.com
git clone https://github.com/RodrigoRafaelSantos7/mistral-thing.git
cd mistral-thingbun install-
Install Convex CLI globally (if not already installed):
bun add -g convex
-
Login to Convex:
bunx convex login
-
Initialize Convex in your project:
bunx convex dev
This will:
- Create a new Convex project (or link to an existing one)
- Generate deployment URL
- Start the Convex development server
-
Copy the
NEXT_PUBLIC_CONVEX_URLfrom the Convex dashboard or terminal output.
Create a .env.local file in the root directory:
NEXT_PUBLIC_CONVEX_URL=https://your-project.convex.cloudSet these in your Convex dashboard under Settings > Environment Variables:
Required:
MISTRAL_API_KEY- Your Mistral AI API keySITE_URL- Your application URL (e.g.,http://localhost:3000for development,https://mistral-thing.xyzfor production)CONVEX_SITE_URL- Your Convex site URL (usually the same asSITE_URL)
Optional (for OAuth):
GITHUB_CLIENT_ID- GitHub OAuth App Client IDGITHUB_CLIENT_SECRET- GitHub OAuth App Client SecretGOOGLE_CLIENT_ID- Google OAuth Client IDGOOGLE_CLIENT_SECRET- Google OAuth Client Secret
Optional (for Email Magic Links):
- Configure Resend API key through the Convex dashboard (Settings > Integrations > Resend)
- Go to GitHub Developer Settings
- Create a new OAuth App
- Set Authorization callback URL to:
https://your-domain.com/api/auth/callback/github - Copy the Client ID and Client Secret to Convex environment variables
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable Google+ API
- Create OAuth 2.0 credentials
- Add authorized redirect URI:
https://your-domain.com/api/auth/callback/google - Copy the Client ID and Client Secret to Convex environment variables
After setting up Convex and environment variables, you need to populate the models in your database. The models are automatically fetched from Mistral AI and filtered to only include supported models.
The models will be automatically created when you first run the application, or you can trigger the model sync manually through the Convex dashboard.
Start the development servers (both Next.js and Convex):
bun run devThis uses mprocs to run both:
- Convex development server (
bun x convex dev) - Next.js development server (
bun run next dev)
The application will be available at:
- Frontend:
http://localhost:3000 - Convex Dashboard: Check your terminal for the dashboard URL
-
Build the Next.js application:
bun run build
-
Start the production server:
bun run start
-
Sign In: Navigate to the login page and choose your preferred authentication method:
- Enter your email for a magic link
- Sign in with Google
- Sign in with GitHub
-
Configure Settings: After logging in, go to Account settings to:
- Select your preferred AI model
- Pin frequently used models
- Set your nickname and biography
- Add custom system instructions
- Choose your theme and color mode
- Start a New Conversation: Click the "New Chat" button or start typing
- Select a Model: Use the model selector to choose which Mistral AI model to use
- Send Messages: Type your message and press Enter or click Send
- View Threads: Access your conversation history from the sidebar
- Manage Threads: Threads are automatically titled based on the first message
- Streaming Responses: Watch AI responses stream in real-time
- Code Highlighting: Code blocks are automatically syntax-highlighted
- Markdown Support: Full markdown rendering for formatted responses
- Thread Organization: Conversations are organized into threads with automatic titles
- Session Management: View and revoke active sessions from account settings
bun run dev- Start development servers (Convex + Next.js)bun run build- Build the Next.js application for productionbun run start- Start the production serverbun run check- Run linting and type checkingbun run check:fix- Fix linting issues automaticallybun run clean- Remove.nextandnode_modulesdirectories
The project uses:
- Biome - Fast linter and formatter
- TypeScript - Type checking with strict mode
- Ultracite - Code formatting (via lint-staged)
- Husky - Git hooks for pre-commit checks
Code is automatically formatted on commit using lint-staged.
mistral-thing/
├── convex/ # Convex backend functions
│ ├── auth.ts # Authentication configuration
│ ├── chat.ts # Chat and AI response generation
│ ├── models.ts # Model management
│ ├── messages.ts # Message handling
│ ├── threads.ts # Thread management
│ ├── settings.ts # User settings
│ ├── schema.ts # Database schema
│ └── _generated/ # Auto-generated Convex files
├── src/
│ ├── app/ # Next.js App Router pages
│ │ ├── (auth)/ # Authentication pages
│ │ ├── (protected)/ # Protected routes
│ │ └── api/ # API routes
│ ├── components/ # React components
│ │ ├── ui/ # Shadcn/UI components
│ │ └── icons/ # Custom icons
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utility functions and stores
│ └── styles/ # Global styles and themes
├── public/ # Static assets
├── package.json # Dependencies and scripts
└── README.md # This file
convex/- Backend logic, database schema, and Convex functionssrc/app/- Next.js pages and routessrc/components/- Reusable React componentssrc/lib/- Shared utilities, stores, and configurationpublic/- Static files (images, icons, etc.)
- Push your code to GitHub
- Import your repository in Vercel
- Configure environment variables:
NEXT_PUBLIC_CONVEX_URL- Your Convex deployment URL
- Update Convex environment variables with production URLs:
SITE_URL- Your Vercel deployment URLCONVEX_SITE_URL- Your Vercel deployment URL
- Deploy!
Convex automatically deploys when you push to your main branch. For production:
- Create a production deployment in Convex dashboard
- Update environment variables for the production deployment
- Use the production deployment URL in your frontend
Convex connection errors:
- Verify
NEXT_PUBLIC_CONVEX_URLis set correctly - Ensure Convex dev server is running
- Check Convex dashboard for deployment status
Authentication not working:
- Verify OAuth credentials are set in Convex environment variables
- Check callback URLs match your application URL
- Ensure
SITE_URLandCONVEX_SITE_URLare set correctly
AI responses not generating:
- Verify
MISTRAL_API_KEYis set in Convex environment variables - Check API key is valid and has sufficient credits
- Review Convex logs for error messages
Email magic links not sending:
- Configure Resend integration in Convex dashboard
- Verify email domain is verified in Resend
- Check Convex logs for email sending errors
Distributed under the MIT License. See LICENSE for more information.
- Live Demo: mistral-thing.xyz
- Report Bug: GitHub Issues
- Request Feature: GitHub Issues