A modern React web application that allows users to input an address and find related local news. Built with React, Vite, and modern CSS for a beautiful user experience.
- Clean, Modern UI: Beautiful gradient design with glassmorphism effects
- Address Input: Simple form to enter any address
- Example Addresses: Quick access to sample addresses for testing
- Responsive Design: Works perfectly on desktop and mobile devices
- Loading States: Smooth loading animations and user feedback
- Error Handling: Graceful error handling with user-friendly messages
- Node.js (version 16 or higher)
- npm or yarn package manager
- Docker and Docker Compose (for PostgreSQL database)
-
Clone or download this project to your local machine
-
Run the automated setup:
./setup.sh
This will:
- Check prerequisites
- Start PostgreSQL database
- Install all dependencies
- Set up the database schema
- Optionally start all services
-
Start the database:
docker-compose up -d postgres
-
Install frontend dependencies:
npm install
-
Install backend dependencies:
cd server npm install cd ..
-
Set up environment variables:
cd server cp env.example .env # Edit .env with your database credentials if needed cd ..
-
Set up database schema:
cd server npm run db:setup cd ..
-
Start the services:
# Terminal 1 - Backend cd server && npm run dev # Terminal 2 - Frontend npm run dev
-
Open your browser and navigate to
http://localhost:3000
npm run dev- Start frontend development servernpm run build- Build frontend for productionnpm run preview- Preview production build locally
cd server && npm run dev- Start backend development servercd server && npm start- Start backend production servercd server && npm run db:setup- Set up database schema
docker-compose up -d postgres- Start PostgreSQL databasedocker-compose down- Stop PostgreSQL databasedocker-compose up -d- Start all services (including pgAdmin)
./setup.sh- Automated setup script./start-dev.sh- Quick start for development
- Enter an Address: Type any address in the input field (e.g., "123 Main St, New York, NY")
- Click "Find News": Submit the form to search for related news
- View Results: Browse through the news articles related to that location
- Try Examples: Use the example address buttons for quick testing
This application now includes a full-stack implementation with:
- React-based user interface
- Address input form with validation
- Beautiful news display with responsive design
- Real-time connection status to backend
- Express.js REST API server
- PostgreSQL database for data persistence
- Address search tracking and history
- Search statistics and analytics
- users: User management (currently demo user)
- addresses: Stored addresses with search counts
- search_history: Individual search queries and results
- User submits address → Frontend calls backend API
- Backend parses address → Stores in PostgreSQL
- News search performed → Results returned to frontend
- Search history recorded → Analytics updated
To deploy this application with real news data, you would need to:
-
Set up a backend API that interfaces with news services like:
- Google News API
- NewsAPI.org
- Bing News Search API
-
Replace the mock data in
App.jsxwith actual API calls -
Add environment variables for API keys and endpoints
-
Deploy to your preferred hosting service (Vercel, Netlify, AWS, etc.)
The application is built with modern CSS and is highly customizable:
- Colors: Modify the gradient colors in CSS variables
- Layout: Adjust grid layouts and spacing
- Components: Add new features or modify existing ones
- Styling: Update the design system to match your brand
The application is fully responsive and includes:
- Mobile-first design approach
- Flexible grid layouts
- Touch-friendly buttons and inputs
- Optimized typography for all screen sizes
The application includes comprehensive error handling:
- Form validation
- API error handling
- User-friendly error messages
- Graceful fallbacks
This project is open source and available under the MIT License.
Feel free to contribute to this project by:
- Reporting bugs
- Suggesting new features
- Submitting pull requests
- Improving documentation
If you have any questions or need help with the application, please open an issue in the project repository.
Note: This is a demonstration application. For production use, you'll need to integrate with real news APIs and implement proper backend services.