The Bitcoin Sentiment Analyzer is a web application that analyzes the sentiment of Bitcoin-related content. It provides real-time updates on the overall sentiment and displays individual sentiment scores for each piece of content.
- Real-time sentiment analysis
- Overall sentiment score visualization
- Individual content sentiment breakdown
- Simulated data for demonstration purposes
- Option to use real Twitter data (requires Twitter API access)
- Next.js
- React
- TypeScript
- GraphQL (with Apollo Client)
- Tailwind CSS
- shadcn/ui components
- Node.js (v14 or later)
- npm (v6 or later)
-
Install dependencies:
-
Create a
.env.localfile in the root directory and add the following: TWITTER_BEARER_TOKEN=your_twitter_bearer_token_here(Note: This is optional if you're using simulated data)
-
Start the development server: npm run dev
-
Open your browser and navigate to
http://localhost:3000
By default, the application uses simulated data to demonstrate the sentiment analysis functionality. This allows you to run the application without needing Twitter API access.
To use real Twitter data:
- Obtain a Twitter Bearer Token:
- Go to the Twitter Developer Portal
- Create a new project and app
- Generate a Bearer Token for your app
-
Add your Twitter Bearer Token to the
.env.localfile: TWITTER_BEARER_TOKEN=your_actual_twitter_bearer_token_here -
Modify the
app/api/graphql/resolvers.tsfile:
- Comment out the import and usage of
generateMockTweets - Uncomment and update the
fetchTwitterDatafunction to use the Twitter API
- Update the
BitcoinSentimentAnalyzer.tsxcomponent:
- Remove references to "simulated" or "mock" data in the UI
- Restart your development server
Note: Be aware of Twitter API rate limits. The free tier has restrictions on the number of requests you can make.
app/: Contains the main application codeapi/: API routes, including GraphQL endpointcomponents/: React componentshooks/: Custom React hooksutils/: Utility functions, including mock data generationpublic/: Static assetsstyles/: Global styles
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.