This repository is a scaffold for a Next.js web application with multiple independent features and a global settings page. The project is structured to allow different team members to work on separate features in isolation, with a shared layout and global styles.
- Deadlines Lookup: Find relevant deadlines by ZIP code (e.g., voter registration deadlines).
- Translation Assistant: Translate text into different languages.
- SMS Simulator: A simple interface to simulate sending and receiving SMS messages.
- News Claim Fact Check: Verify the authenticity of news or claims using the Google Fact Check API (with a fallback to news search via GNews).
- Settings: Toggle dark mode and adjust text size preferences (affecting the entire app via CSS variables).
Each feature's frontend code lives in its own folder under /features, and each has a corresponding page in /pages for routing.
features/ -> Feature-specific React components (UI for each feature)
server/ -> Placeholder backend logic for each feature (to be implemented)
pages/ -> Next.js pages that route to feature components and other pages
components/ -> Shared components (Layout, Nav, ThemeToggle)
styles/ -> Global CSS and CSS variable definitions (themes, tokens)
data/ -> Local JSON data for placeholders or fallback (optional)
lib/ -> Utility functions (e.g., fetchJson for API calls)
.env.example -> Example environment variables for API keys
docs/ -> Documentation (API specs, etc.)
No database is used in this scaffold. Any data is either hardcoded in the data/ JSON files or will be fetched via external APIs. The backend files under server/ are currently empty and serve as placeholders for future implementation (they could be implemented as serverless functions or separate services as needed).
Global theming (dark mode and text size) is handled via CSS variables defined in styles/tokens.css. The ThemeToggle component (used in the Settings page) updates these variables by toggling attributes on the element, allowing for instant theme changes across the app. The app's layout and navigation are defined in the components/Layout.tsx and components/Nav.tsx files, ensuring a consistent look and feel.
Run npm install (or yarn) to install the required packages.
The translation feature requires Python dependencies. Follow these steps:
# Install Python packages for the translation backend
pip install -r requirements.txt# Run the Flask translation service (required for translation feature)
python server/translation/main.pyThis will start the Python backend on http://localhost:8000
# Test the health endpoint
curl http://localhost:8000/health
# Test translation endpoint
curl -X POST -H "Content-Type: application/json" -d '{"text":"Hello","target_lang":"es"}' http://localhost:8000/translateNote: The Python backend must be running for the translation feature to work. The Next.js frontend will connect to the Python service at http://localhost:8000.
Copy .env.example to .env in the project root, and fill in the necessary API keys:
GOOGLE_FACTCHECK_API_KEY- API key for Google Fact Check API (for the fact-check feature).GNEWS_API_KEY- API key for GNews API (used as a fallback for news search).TRANSLATOR_ENGINE- Identifier or API key for the translation service (if needed, e.g., "google" or "deepl").
Use npm run dev to start the Next.js development server.
Open http://localhost:3000 to view the app. You should see the homepage with links to all features. Each feature page has a basic UI and dummy functionality as described.
This project can be deployed to Vercel (or any platform that supports Next.js). Ensure that you add the environment variables in your deployment environment (e.g., in Vercel's dashboard) for the API keys. Since the backend logic is not implemented yet, the app will function in a read-only or demo capacity until those are added.
To avoid Git merge conflicts and ensure a smooth development process:
-
One Feature per Developer: Each team member should focus on one feature. Limit changes to your feature's folder in
/featuresand its corresponding page in/pages. -
Coordinate Shared Changes: Shared files (like those in
/componentsor global styles in/styles) should be edited by the team lead or with clear communication among team members. If you need a change in a shared file, coordinate first to avoid overlapping edits. -
Use Feature Branches: Develop each feature in its own Git branch (e.g.,
feature/deadlines-ui,feature/translation-ui). Merge into the main branch only when the feature is stable to prevent conflicts. -
Consistent Code Style: Follow the established coding style in this scaffold (e.g., functional React components, hook usage for state, etc.). This will make it easier to integrate each feature smoothly.
-
Placeholder Backends: If you need to simulate backend behavior for testing, you can use the JSON files in
/dataor create simple stub functions. Avoid adding actual backend logic in this repository; that will be handled in the future or in a separate backend service.
Files completed:
features/deadlines/DeadlinesPage.tsx- β COMPLETED - Enhanced frontend with comprehensive polling location displaypages/deadlines.tsx- β COMPLETED - Page routepages/api/deadlines.ts- β COMPLETED - Google Civic Information API integrationserver/deadlines/index.ts- β COMPLETED - Backend logic
What was implemented:
- β Google Civic Information API integration - Full voterInfoQuery implementation with real election data
- β Address validation - Complete address input with validation
- β Comprehensive error handling - Graceful API failures and user-friendly messages
- β Enhanced UI - Complete polling location display with accessibility information
- β Real election data filtering - Filters out test elections, focuses on real elections
- β Polling location details - Name, address, hours, accessibility information
- β Early voting sites - Early voting locations with complete details
- β Drop-off locations - Ballot drop-off sites with full information
API Key: GOOGLE_CIVIC_INFORMATION_API_KEY β
CONFIGURED
Working addresses for testing:
- Virginia:
123 Main Street, Richmond, VA 23219 - Michigan:
123 Main Street, Detroit, MI 48201
Files to work on:
features/translation/TranslationPage.tsx- Frontend componentpages/translate.tsx- Page routepages/api/translation.ts- β COMPLETED - API endpointserver/translation/main.py- β COMPLETED - Python backend
What to do:
- Test the translation flow - Frontend β API β Python backend
- Add more languages - Expand the language dropdown
- Improve UI/UX - Better translation display
- Run Python backend:
python server/translation/main.py(port 8000)
No API key needed - Uses free Google Translate via deep-translator
Files to work on:
features/sms/SMSPage.tsx- Frontend componentpages/sms.tsx- Page routepages/api/sms.ts- API endpoint (implement SMS simulation)server/sms/index.ts- Backend logic
What to implement:
- SMS simulation logic - Simulate sending/receiving messages
- Conversation history - Store and display message threads
- Automated responses - Generate realistic bot replies
- UI improvements - Better chat interface design
No external API needed - Pure simulation
Files to work on:
features/factcheck/FactCheckPage.tsx- Frontend componentpages/factcheck.tsx- Page routepages/api/factcheck.ts- API endpoint (implement fact-checking)server/factcheck/index.ts- Backend logic
What to implement:
- Google Fact Check Tools API - Primary fact-checking service
- GNews API fallback - When no fact-check found, show related news
- Result formatting - Display fact-check ratings and sources
- Error handling - Handle API failures and rate limits
API Keys needed: GOOGLE_FACTCHECK_API_KEY, GNEWS_API_KEY
Implementation flow:
- Try Google Fact Check API first
- If no results, fallback to GNews API
- Return fact-check results OR related news articles
Files to work on:
pages/index.tsx- Homepagepages/settings.tsx- Settings pagepages/_app.tsx- Main app componentcomponents/Layout.tsx- Layout componentcomponents/Nav.tsx- Navigation componentcomponents/ThemeToggle.tsx- Theme toggle
What to manage:
- Shared components - Layout, Nav, ThemeToggle
- Global theming - Dark mode, text size, CSS variables
- Navigation - Links between all features
- Coordination - Help other developers with shared changes
No backend needed - Frontend only
# Install dependencies
npm install
# Copy environment variables
cp .env.example .env
# Fill in your API keys in .env filegit checkout -b feature/developer-1-deadlines
git checkout -b feature/developer-2-translation
git checkout -b feature/developer-3-sms
git checkout -b feature/developer-4-factcheck
git checkout -b feature/developer-5-main-app# Start Next.js dev server
npm run dev
# For Developer 2 (Translation), also start Python backend
# Make sure to install Python dependencies first: pip install -r requirements.txt
python server/translation/main.pyImportant: For the translation feature to work, you need both servers running:
- Next.js frontend:
npm run dev(port 3000) - Python backend:
python server/translation/main.py(port 8000)
- Developer 1: http://localhost:3000/deadlines
- Developer 2: http://localhost:3000/translate
- Developer 3: http://localhost:3000/sms
- Developer 4: http://localhost:3000/factcheck
- Developer 5: http://localhost:3000/
Each developer has completely separate files with no overlapping ownership.
Happy coding! This scaffold should give you a running start. Each feature page is operational in a placeholder capacity, and the overall app is set up to be expanded with real functionality. If you have any questions or need to adjust the shared components or styles, discuss with the team to coordinate those changes.