A comprehensive child safety monitoring dashboard with MySQL database integration for managing children profiles and alerts.
- Real-time Child Status Tracking - Monitor children's safety status and location
- Alert Management - Comprehensive alert system with priority levels
- Activity Logging - Track all system activities and events
- Dashboard Overview - Real-time statistics and monitoring
- Add/Edit/Delete Children - Full CRUD operations for child profiles
- Status Tracking - Real-time status updates (safe, warning, danger)
- Location Monitoring - Track child locations and activities
- Age-appropriate Monitoring - Customized monitoring based on child age
- Create Alerts - Generate alerts for various events
- Alert Severity - Low, medium, high priority levels
- Alert Status - Active, resolved, dismissed states
- Alert History - Complete audit trail of all alerts
Make sure you have MySQL installed and running on your system.
Run the SQL schema file in MySQL Workbench or MySQL command line:
mysql -u root -p < database_schema.sqlOr copy and paste the contents of database_schema.sql into MySQL Workbench.
Update the database configuration in config.js or set environment variables:
// config.js
module.exports = {
database: {
host: 'localhost',
user: 'root',
password: 'your_password',
database: 'parent_alert_system',
port: 3306
}
};Or use environment variables:
export DB_HOST=localhost
export DB_USER=root
export DB_PASSWORD=your_password
export DB_NAME=parent_alert_system
export DB_PORT=3306-
Clone the repository
git clone <repository-url> cd parent-alert-system
-
Install dependencies
npm install
-
Set up the database (see Database Setup above)
-
Start the server
npm start
-
Access the application
- Open your browser and navigate to
http://localhost:3000 - The dashboard will be available at the root URL
- Open your browser and navigate to
GET /api/children- Get all childrenGET /api/children/:id- Get specific childPOST /api/children- Create new childPUT /api/children/:id- Update childDELETE /api/children/:id- Delete childPUT /api/children/:id/status- Update child status
GET /api/alerts- Get all alerts (with optional filters)GET /api/alerts/active- Get active alerts onlyPOST /api/alerts- Create new alertPUT /api/alerts/:id/status- Update alert statusDELETE /api/alerts/:id- Delete alert
GET /api/activity- Get activity logPOST /api/activity- Log new activityGET /api/dashboard/stats- Get dashboard statisticsGET /api/children/status- Get children status overview
- children - Child profiles and status
- alerts - Alert records with severity and status
- activity_log - System activity tracking
- screen_captures - Screen capture records (for future use)
- active_alerts_view - Active alerts with child information
- children_status_view - Children with alert counts
- AddChild - Add new child
- UpdateChildStatus - Update child status and location
- CreateAlert - Create new alert
- ResolveAlert - Resolve an alert
- GetDashboardStats - Get dashboard statistics
- Navigate to the dashboard
- Use the "Add Child" form
- Fill in child details (name, age, avatar, location)
- Submit the form
- View active alerts on the dashboard
- Click "Resolve" to mark alerts as resolved
- Click "Delete" to remove alerts
- Create new alerts via API or system events
- Dashboard: View overall statistics and child status
- Children List: See all children with their current status
- Alerts: Check active alerts and their details
- Activity Log: Review system activity history
parent-alert-system/
βββ database_schema.sql # MySQL database schema
βββ database.js # Database connection and operations
βββ config.js # Configuration settings
βββ server.js # Express server with API endpoints
βββ js/
β βββ database-ui.js # Frontend database operations
β βββ common.js # Common utilities
β βββ script.js # Main dashboard logic
β βββ alerts.js # Alerts management
β βββ child-status.js # Child status tracking
β βββ settings.js # Settings management
βββ css/
β βββ style.css # Main stylesheet
βββ index.html # Main dashboard
βββ alert.html # Alerts page
βββ child-status.html # Child status page
βββ settings.html # Settings page
βββ package.json
Update config.js with your MySQL connection details:
host- MySQL server hostuser- MySQL usernamepassword- MySQL passworddatabase- Database nameport- MySQL port (default: 3306)
You can also use environment variables for configuration:
DB_HOST- Database hostDB_USER- Database userDB_PASSWORD- Database passwordDB_NAME- Database nameDB_PORT- Database portPORT- Server port (default: 3000)
- Database Security: Use strong passwords and limit database access
- Input Validation: All user inputs are validated on both frontend and backend
- SQL Injection Protection: Using parameterized queries with mysql2
- Error Handling: Comprehensive error handling throughout the application
- Database: Add new tables/columns to
database_schema.sql - Backend: Extend
database.jswith new methods - API: Add new endpoints in
server.js - Frontend: Update
database-ui.jsfor new functionality - UI: Add new HTML/CSS for user interface
- Test database connections
- Verify CRUD operations
- Check API endpoints
- Validate frontend functionality
- Verify MySQL is running
- Check database credentials in
config.js - Ensure database exists:
parent_alert_system - Verify user permissions
- Check server logs for error messages
- Verify database connection
- Check API endpoint URLs
- Validate request data format
This project is licensed under the ISC License.