Q2 Chat is a unified platform that gives you access to multiple AI models through a single, convenient interface. Whether you need creative writing, technical analysis, coding help, or general conversation, you can experiment with different AI models to find the one that works best for your specific task.
- Multi-Model Access: Connect to various Large Language Models (LLMs) through OpenRouter.ai.
- Cross-Platform: Seamless chat experience on both Web and Mobile (iOS/Android).
- Persistent Conversations: Chat history is saved, allowing you to revisit and continue past conversations.
- Real-time Streaming: Get AI responses streamed back to you in real-time.
- User Authentication: Secure sign-up and login functionality.
- Guest Mode: Try the app without creating an account.
- Automatic Titling: New chats are automatically given a concise title based on the initial prompt.
The project is a monorepo consisting of a backend service and two frontend clients (web and mobile).
- Supabase: Hosts our Postgres database, handles user authentication, and provides real-time updates for chat messages.
- Backend (FastAPI): A Python-based API that serves the frontend clients, handles business logic, and communicates with the LLM provider.
- Frontend (Web & Mobile): The user interfaces for interacting with the chat application.
- OpenRouter.ai: A service that provides access to a wide range of AI models from different providers.
Follow these instructions to get the project up and running on your local machine.
The project uses a local Supabase instance managed by Docker.
-
Start Supabase services:
docker compose up -d
This will start the Supabase containers in the background. You can check the status with
docker compose ps. -
Get Supabase Credentials: After the services start, the necessary
SUPABASE_URLandSUPABASE_ANON_KEYwill be printed to the console. You will need these for the next steps. You can also get them by running:docker compose logs | grep "API URL" docker compose logs | grep "anon key"
You need to set up environment variables for the backend and frontend applications.
-
Backend (
backend/.env): Create a file named.envin thebackend/directory with the following content:OPEN_ROUTER_KEY="your_open_router_api_key" SUPABASE_URL="your_supabase_url_from_previous_step" SUPABASE_KEY="your_supabase_anon_key_from_previous_step"
- Get your
OPEN_ROUTER_KEYfrom OpenRouter.ai.
- Get your
-
Frontend (Web & Mobile): Both frontends need to know the backend API URL. Create a file named
.env.localinfrontend/web/and.envinfrontend/mobile/with this content:NEXT_PUBLIC_API_URL=http://localhost:8000
(Assuming the backend runs on port 8000).
- Navigate to the backend directory:
cd backend/app - Create a virtual environment and install dependencies:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate` pip install -r requirements.txt
- Run the backend server:
From the
backend/directory:The backend should now be running onuvicorn app.main:app --reload
http://localhost:8000.
You can run either the web or the mobile client.
For the Web Client:
- Navigate to the web directory and install dependencies:
cd frontend/web npm install - Start the development server:
The web app will be available at
npm run dev
http://localhost:3000.
For the Mobile Client:
- Navigate to the mobile directory and install dependencies:
cd frontend/mobile npm install - Start the Expo development server:
Scan the QR code with the Expo Go app on your phone, or run on an emulator.
expo start
This project is licensed under the MIT License. See the LICENSE file for details.