A modern, secure, and scalable home automation system built with Next.js, MQTT, and MongoDB.
- 🏠 Real-time device control and monitoring
- 👥 Multi-user support with role-based access control
- 🔐 Secure authentication and authorization
- 📱 Responsive mobile-first design
- 🎨 Customizable scenes and automation rules
- 📊 Historical data tracking and analytics
- 🏗️ Room-based organization
- 🔌 Support for various device types (lights, thermostats, security, blinds)
- Frontend: Next.js, React, Material-UI
- Backend: Next.js API Routes
- Database: MongoDB with Prisma ORM
- Real-time Communication: MQTT
- Authentication: NextAuth.js
- State Management: React Context
- Styling: Material-UI with Emotion
- Docker and Docker Compose
- Node.js v16+ (for local development)
- Git
- Clone the repository:
git clone https://github.com/yourusername/home-automation.git
cd home-automation- Create environment files:
# Create .env file for Docker
cat > .env << EOL
NEXTAUTH_SECRET=your-secret-key
DEFAULT_ADMIN_EMAIL=admin@homeautomation.com
DEFAULT_ADMIN_PASSWORD=secure-admin-password
MQTT_USER_PASSWORD=secure-mqtt-password
EOL
# Create .env.local file
cat > .env.local << EOL
MONGODB_URI=mongodb://mongodb:27017/home_automation
MQTT_HOST=mosquitto
MQTT_PORT=1883
MQTT_WS_PORT=8888
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-secret-key
DEFAULT_ADMIN_EMAIL=admin@homeautomation.com
DEFAULT_ADMIN_PASSWORD=secure-admin-password
MQTT_USER_PASSWORD=secure-mqtt-password
EOL- Build and start the services:
# Build and start all containers
docker-compose up -d --build
# Create admin user (first time only)
docker-compose exec app npm run setup-admin
# Set up MQTT password
docker-compose exec mosquitto sh -c "mosquitto_passwd -c /mosquitto/config/passwd admin"- Access the application:
- Web interface: http://localhost:3000
- Default admin credentials:
- Email: admin@homeautomation.com
- Password: (as set in .env)
- Install dependencies:
npm install- Generate Prisma client:
npx prisma generate- Push database schema:
npx prisma db push- Create admin user:
npm run setup-admin- Start the development server:
npm run devThe application runs three main services:
-
App (Next.js application)
- Port: 3000
- Main web interface
-
**
Visit http://localhost:3000 to access the application. Create an admin account on first run.
Detailed configuration instructions for:
- MongoDB setup
- MQTT broker setup
- Device integration
- Authentication providers
Can be found in our Configuration Guide.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please open an issue in the GitHub repository or contact the maintainers.
- Thanks to all contributors
- Built with Next.js
- UI components from Material-UI