AirGuard is a professional-grade full-stack DBMS project. It features a futuristic Node.js web interface and a robust MySQL relational backend designed to showcase advanced database concepts.
Your database must be running before the application can connect.
- XAMPP: Open XAMPP Control Panel and click Start on MySQL.
- WAMP: Click the WAMP icon -> MySQL -> Service Administration -> Start Service.
net start MySQL80TIP: Ensure MySQL is RUNNING on port 3306 before starting the app.
Create a .env file in the root directory:
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_mysql_password
DB_NAME=airguard
PORT=3000
JWT_SECRET=supersecretkey123
# OpenWeatherMap API Key (Get free key at https://openweathermap.org/api)
OWM_API_KEY=your_openweather_api_key_hereOpen your terminal in the project folder and run:
- Install Requirements:
npm install - Setup Database:
node db-init.js(Automates table creation & data population) - Start Server:
npm start
View the App: http://localhost:3000
- Frontend: Vanilla JavaScript (ES6+), CSS3 (Glassmorphism), HTML5
- Backend: Node.js, Express.js
- Database: MySQL 8.0+
- API Integration: OpenWeatherMap Air Pollution API (Real-time data)
- Security: JSON Web Tokens (JWT), Bcrypt.js
- Data Visualization: Chart.js 4.4
AirGuard doesn't just store data; it actively breathes with the world:
- Automatic Sync: Every 15 minutes, the backend queries OpenWeatherMap for the latest pollutant concentrations.
- Precision Tracking: Monitors PM2.5, PM10, NO2, SO2, CO, and O3.
- Relational Integrity: API responses are parsed and mapped to the normalized
READINGtable with atomic precision. - Manual Override: Users can trigger a real-time "Sync Now" for their selected city directly from the dashboard.
This project is built to demonstrate intelligence-grade database management:
- Database Normalization (3NF): Found in
additions.sql, featuring a full decomposition demo ofRAW_AIR_DATA. - Transaction Integrity: Implementation of
COMMIT,ROLLBACK, andSAVEPOINTfor secure operations. - Concurrency Control: Demonstrations of Row-level locking and Shared locks to prevent data anomalies.
- Automated Logic: Real-time Triggers, Stored Procedures (with Cursors), and Complex Views.
schema.sql: Core relational structure & diverse sample data.additions.sql: Normalization, Transactions, and Locking demos.review-guide/: Detailed technical documentation for DBMS concepts.public/: Sleek glassmorphism frontend with real-time DB status tracking.
The UI automatically tracks your database connection:
- 🟢 DATABASE Badge: Successfully fetching real atmospheric data from MySQL.
- 🔴 SIMULATED Badge: Database disconnected; showing randomized sensor data for demo safety.
⚠️ Sidebar Status: Displays troubleshooting steps if the connection fails.