U2E (Us to Earth) is a web application that visualizes climate change and regional environmental issues on an interactive 3D globe and provides AI-powered news analysis and solutions. Users can rotate the globe to explore issues in different regions and view related news and AI-generated recommendations.
- Interactive 3D Globe: Visualize global environmental issues using Three.js.
- Region & Climate Filtering: Filter news by region or specific climate challenges (droughts, floods, heatwaves, etc.).
- Gemini AI Integration: Analyze news articles and generate concise solutions using Google Gemini API.
- Related News Recommendations: Discover other relevant articles on the same topic.
- Comment System: Engage in discussions on each news article.
- JWT Authentication: Secure login and user authentication.
- Frontend: React 19, TypeScript
- 3D Rendering: Three.js
- State Management: React Query (TanStack Query) & Zustand
- Styling: Styled Components
- API Client: Axios
- AI Integration: Google Gemini API
- Auth & Security: JWT, HTTP-only cookies
- Dev Tools: Vite, ESLint, MSW (Mock Service Worker)
- Version Control: Commitlint, Husky
- Node.js v18 or higher
- pnpm v8 or higher
- Google Gemini API key (set as an environment variable)
# Clone the repository
git clone https://github.com/your-username/u2e-client.git
cd u2e-client
# Install dependencies
pnpm install
# Create .env file with your Gemini key
echo "VITE_GEMINI_API_KEY=your_api_key_here" > .env
# Start development server
pnpm dev
src/
โโโ api/ # API client and AI integration
โโโ assets/ # Fonts, images, SVGs
โโโ components/ # React components
โ โโโ animation/ # Animation components
โ โโโ chat/ # Authentication & comments
โ โโโ common/ # Shared UI components
โ โโโ earth/ # 3D globe components
โ โโโ news/ # News display components
โโโ hooks/ # Custom React hooks
โโโ mocks/ # MSW handlers for API mocking
โโโ pages/ # Page components/routes
โโโ routes/ # Router setup
โโโ styles/ # Global styles & theme
โโโ types/ # TypeScript types and interfaces
โโโ utils/ # Utility functions
- Render an interactive 3D globe using Three.js and GeoJSON data.
- Highlight region-specific environmental alerts.
- Support mouse drag and scroll zoom interactions.
- Fetch news articles from API and display full content.
- Use Gemini AI to analyze articles and generate actionable solutions.
- Present up to three related news links for further reading.
- JWT-based login and secure session management.
- Allow users to post comments and reply to others.
- Personalized experience with saved preferences.
- Start the development server:
pnpm dev
- Build for production:
pnpm build
- Run linters:
pnpm lint
Create a .env
file in the project root and add:
VITE_GEMINI_API_KEY=your_gemini_api_key_here
Globe.tsx
: Main 3D globe rendering logicGeoMap.tsx
: Maps GeoJSON data onto the globeWarning.tsx
: Displays environmental alerts on the globe
NewsContents.tsx
: Displays article text and AI-generated solutionNewsCardList.tsx
: Renders a list of news summariesNewsSideBar.tsx
: Shows original link, solutions, related news
components/chat/Login.tsx
andhooks/useLoginQuery.ts
implement JWT login and token management.
- TypeScript:
tsconfig.json
,tsconfig.app.json
,tsconfig.node.json
- ESLint:
eslint.config.js
, including TypeScript rules - Commitlint:
commitlint.config.ts
for commit message conventions - Vite:
vite.config.ts
for build and dev server settings
- Fork the repo
- Create a feature branch:
git checkout -b feature/awesome
- Commit your changes:
git commit -m 'feat: add awesome feature'
- Push branch:
git push origin feature/awesome
- Open a Pull Request
- Integrate real-time climate data feeds
- Expand issue categories (air quality, biodiversity loss)
- Add multi-language support
- Develop a mobile app version
This project is licensed under the MIT License. See the LICENSE file for details.