A web application for AIβenhanced tracking of water (L) and electricity (kWh) usage. GridSync helps users log daily readings, visualize consumption patterns, and receive insights to optimize resource use.
- Overview
- Core Features
- Technology Stack
- Project Structure
- Installation & Setup
- Operational Guide
- Future Enhancements
- Contribution Guidelines
GridSync unifies manual data entry with AIβdriven recommendations, promoting cost savings and sustainability through detailed consumption insights.
- Authentication: Secure registration, login, hashed passwords, session management.
- Usage Input: Timestamped water and electricity readings via
add_usage.php
. - Dashboard: Interactive charts (Chart.js) showing hourly/daily usage (
electTodayUse.php
,waterTodayUse.php
). - Profile Management: Username/password updates and avatar uploads (
profile.php
βhtdocs/asset/uploads/
). - AI Assistant: Chat interface backed by Node.js for usage analysis (
chatbot.php
,ai_backend/
). - Theming: Light/dark mode toggle stored in
localStorage
. - 3D Globe: Placeholder Three.js visualization in
Statistics.php
. - MVCβStyle Backend: Controllers in
src/controllers/
for maintainable code.
- Backend (PHP): PHPΒ 8.x, PDO, MySQL/MariaDB, Composer (optional)
- AI Backend: Node.jsΒ 16+, Express, dotenv, OpenAI (or equivalent)
- Frontend: HTML5, TailwindΒ 3.x, VanillaΒ JS (ES6+), Chart.js, Three.js
- Build Tools: npm, Tailwind CLI
- Server: Apache/Nginx with URL rewriting
. βββ ai_backend/ # Node.js AI chatbot service
β βββ server.js
β βββ package.json
β βββ .env.example # env template for API keys & PORT
βββ config/ # Global configuration
β βββ database.php # PDO connection setup
β βββ schema.sql # users & usage_records tables
βββ htdocs/ # Public web root
β βββ index.php # Front controller
β βββ asset/ # Static assets
β β βββ logo.png
β β βββ uploads/ # Userβuploaded avatars
β βββ views/ # PHP templates
β β βββ partials/ # headers, footers, etc.
β β βββ *.php # pageβspecific files
β βββ js/ # Frontend scripts
β βββ css/ # Compiled CSS (Tailwind output)
β βββ .htaccess # URL rewrite rules
βββ src/ # Application source (MVC)
β βββ controllers/ # Request handlers
β βββ models/ # Data layer (optional)
β βββ input.css # Tailwind source
β βββ output.css # Tailwind build artifact
βββ vendor/ # Composer dependencies
βββ composer.json # PHP package manifest
βββ package.json # Node.js/Tailwind manifest
βββ README.md # Project documentation
git clone https://github.com/your-username/gridsync.git
cd gridsync
composer install # if needed
mysql -u user -p gridsync_db < config/schema.sql
cd ai_backend
npm install
cp .env.example .env # configure API_KEY and PORT
npm start
npm install # in project root
npx tailwindcss -i ./src/input.css -o ./src/output.css --watch
chmod -R 755 htdocs/asset/uploads/
- Register at
/signup
and Login at/signin
. - Add Usage: Use the Add Usage form to log daily usage readings.
- Dashboard: Visit
/homepage
or Statistics for graphical usage data. - Chatbot: Chat with the AI via
/chatbot
for smart energy insights. - Profile: Update your user info on
/profile
. - Theme: Toggle light/dark mode from the header.
- Bind AI chatbot to actual usage data for tailored insights.
- Implement backend logic for Contact and Feedback forms.
- Fetch live news or updates from external APIs.
- Replace placeholder globes with live energy or usage stats.
- Build detailed usage breakdown and goal tracking pages.
- Add password recovery via email or OTP.
- Improve validation, error handling, and testing workflows.
- Persist goal-setting data in the database for continuity.
We welcome contributions from the community!
- Fork the repository.
- Create a new feature branch.
- Open a pull request describing your changes.
- Report bugs or suggest features through the issue tracker.
Thanks for helping us improve!