Installation Guide
Follow these steps to set up and run the FriendZone application on your local machine.
Prerequisites
- Node.js (v16.x or later recommended)
- npm or yarn
- A Google account for OAuth credentials.
- An Upstash account for a Redis database.
- A Pusher account for real-time messaging.
1. Clone the Repository
First, clone the project repository to your local machine using Git.
git clone https://github.com/joschan21/nextjs-realtime-chat.git
cd nextjs-realtime-chat
2. Install Dependencies
Install the necessary Node.js packages using npm
or yarn
.
npm install
# or
yarn install
3. Configure Environment Variables
This project requires several environment variables for its services to function correctly. Create a new file named .env.local
in the root of the project and add the following variables. You will need to get these values from their respective service dashboards (Upstash, Google Cloud Console, Pusher).
# Upstash Redis Credentials
UPSTASH_REDIS_REST_URL="YOUR_UPSTASH_URL"
UPSTASH_REDIS_REST_TOKEN="YOUR_UPSTASH_TOKEN"
# Google Auth Credentials
GOOGLE_CLIENT_ID="YOUR_GOOGLE_CLIENT_ID"
GOOGLE_CLIENT_SECRET="YOUR_GOOGLE_CLIENT_SECRET"
# Pusher Credentials
NEXT_PUBLIC_PUSHER_APP_KEY="YOUR_PUSHER_PUBLIC_KEY"
PUSHER_APP_ID="YOUR_PUSHER_APP_ID"
PUSHER_APP_SECRET="YOUR_PUSHER_SECRET"
# NextAuth Configuration
NEXTAUTH_SECRET="your-super-secret-key-for-nextauth"
NEXTAUTH_URL="http://localhost:3000" # Use your production URL when deploying
For more details on what each of these variables does, please see the Configuration page.
4. Run the Development Server
Once the dependencies are installed and the environment variables are configured, you can start the Next.js development server.
npm run dev
The application will now be running at http://localhost:3000.