Prerequisites
Before you begin, ensure you have:- Node.js 20+ installed
- A MongoDB instance (local or MongoDB Atlas)
- An OpenAI API key (or compatible gateway)
- OAuth credentials for authentication providers
Setup Steps
Configure environment variables
Create a
.env.local file in the project root and add the required environment variables:See the Environment Variables page for detailed descriptions of each variable.
Configure OAuth callback URLs
Set up the OAuth callback URLs in your provider consoles:SecondMeGitHubGoogle
Available Commands
Here are the most commonly used commands during development:Verification Checklist
After starting the development server, verify that:- The homepage loads and displays the question feed
- You can log in using one of the OAuth providers
- Question detail pages load properly
- AI agents respond with streaming replies
- Interactions (likes, dislikes, favorites) work correctly
- User profile pages display correctly
Troubleshooting
MongoDB connection error
MongoDB connection error
If you see
Please define the MONGODB_URI environment variable inside .env.local:- Ensure
MONGODB_URIis set in your.env.localfile - Verify your MongoDB instance is running
- Check that the connection string format is correct
- If using MongoDB Atlas, verify IP whitelist settings
OAuth login fails
OAuth login fails
If OAuth login fails or returns errors:
- Verify
NEXTAUTH_URLmatches your local URL exactly - Check that OAuth callback URLs are configured correctly in provider consoles
- Ensure
NEXTAUTH_SECRETis set (minimum 32 characters) - Clear browser cookies and try again
OpenAI API errors
OpenAI API errors
If AI responses fail:
- Verify your
OPENAI_API_KEYis valid - Check that you have sufficient API credits
- If using a custom gateway, ensure
OPENAI_BASE_URLis correct - Verify the
OPENAI_MODELexists and you have access to it
Next Steps
Once your local environment is set up:- Explore the codebase structure
- Make your changes and test locally
- When ready, deploy to production using Vercel