myChat is an open-source project modeled after ChatGPT. It provides a user-friendly interface for interacting with GPT-like LLMs via the OpenAI API. This project is NOT directly affiliated with OpenAI in any way.
We use MongoDB for storing user information and session data. You can set up a MongoDB instance in several ways:
Once you have a running MongoDB instance, you'll need to obtain the connection string. If you're using MongoDB Atlas, you can find the connection string in your cluster's connection settings.
Add the MongoDB connection string to your .env.local
file like so:
We use Redis for rate limiting in our API routes. You can set up a Redis instance in several ways, including:
Once you have a running Redis instance, you'll need to obtain the connection string. If you're using RedisLabs, you can find the connection string in your database's configuration page.
Clone this repository:
git clone https://github.com/your-username/myChat.git
or get started using GitHub's template feature
Navigate to the project directory:
cd myChat
Install the dependencies:
npm install
Create a .env.local
file in the project root and add the necessary environment variables:
touch .env.local
Add the following to the .env.local
file:
NEXTAUTH_URL=http://localhost:3000
MONGODB_URI=yourURI
NEXTAUTH_SECRET=yourSecret
ENCRYPTION_KEY: a 32-digit hexadecimal string for AES-128 encryption (for users' API key)
REDIS_URL=yourRedisConnectionString
Replace http://localhost:3000
with whatever port your application is running on, yourURI
with your MongoDB connection string, yourSecret
with a secure random string, your32HexDigitString
with a 32-digit hexadecimal string for AES-128 encryption, and yourRedisConnectionString
with your Redis connection string.
...
To run the development server:
npm run dev
To build the application for production:
npm run build
To start the production server:
npm run start
To deploy your myChat Clone to Vercel, follow these steps:
Sign up for a Vercel account if you haven't already.
Install the Vercel CLI:
npm install -g vercel
Log in to your Vercel account from the command line:
vercel login
Navigate to your project directory:
cd myChat
Run the following command to deploy your application:
vercel --prod
During the deployment process, the Vercel CLI will ask you for the environment variables. Provide the same values you used for your .env.local
file:
NEXTAUTH_URL: https://your-vercel-url.vercel.app
MONGODB_URI: yourURI
NEXTAUTH_SECRET: yourSecret
ENCRYPTION_KEY: a 32-digit hexadecimal string for AES-128 encryption (for users' API key)
REDIS_URL=yourRedisConnectionString
Replace http://localhost:3000
with whatever port your application is running on, yourURI
with your MongoDB connection string, yourSecret
with a secure random string, your32HexDigitString
with a 32-digit hexadecimal string for AES-128 encryption, and yourRedisConnectionString
with your Redis connection string.
Remember that every time you make changes to your myChat Clone and want to deploy the updated version, you can simply run vercel --prod
from the project directory.
We welcome contributions! To contribute, please follow these steps:
git clone https://github.com/your-username/myChat.git
git checkout -b feature/my-new-feature
or git checkout -b fix/my-new-fix
git commit -am 'Add some feature'
git push origin feature/my-new-feature
This project is licensed under the MIT License.