GeoChat is a simple, anonymous, real-time web chat application that connects users based on their geographic location. It's built with PHP, MySQL, and vanilla JavaScript, making it easy to deploy on standard web hosting.
- Anonymous Chat: No registration required. Just pick a temporary username and start chatting.
- Location-Based: See and chat with other users within a configurable radius (1-50 km).
- Real-Time Communication: Uses Server-Sent Events (SSE) for instant message and user list updates.
- Private Messaging: Click on a user to start a one-on-one private conversation.
- Interactive Map: View nearby users on an interactive map powered by Leaflet.js and OpenStreetMap.
- Image Sharing: Share images directly in the chat.
- Typing Indicators: See when another user is typing a message.
- Light & Dark Mode: Automatic theme detection with a manual toggle.
- Backend: PHP 8+
- Database: MySQL
- Frontend: HTML5, CSS3, Vanilla JavaScript (ES6+)
- Real-Time: Server-Sent Events (SSE)
- Mapping: Leaflet.js with OpenStreetMap
Follow these instructions to get a copy of the project up and running on your local machine.
- A web server environment (e.g., Apache or Nginx) or a local development stack like XAMPP, MAMP, etc.
- PHP 8.2 or higher with the PDO MySQL extension enabled.
- MySQL 8.0 or MariaDB 10.11+.
The easiest way to run GeoChat is using Docker. This will automatically set up PHP, MySQL, and phpMyAdmin.
-
Clone the repository:
git clone https://github.com/ricvale/geochat.git cd geochat -
Start the application:
docker compose up -d --build
-
Access the app:
- GeoChat: http://localhost:8080
- phpMyAdmin: http://localhost:8081
Note: The database is automatically initialized and configured on the first run.
Follow these instructions if you prefer to set up the project manually on a local server like XAMPP, MAMP, etc.
-
Clone the repository:
git clone https://github.com/ricvale/geochat.git cd geochat -
Create the database:
- Create a new database named
geo_chat. - Import the schema from
includes/database.sql.
- Create a new database named
-
Configure the application:
- Copy
includes/config.example.phptoincludes/config.php. - Update the database credentials to match your local environment.
- Copy
-
Set up the web server:
- Point your web server's document root to the project directory.
- Open the application in your browser.
This project is licensed under the MIT License - see the LICENSE file for details.