{"id":23849112,"url":"https://github.com/hima890/smartx-platform","last_synced_at":"2026-04-13T13:32:06.340Z","repository":{"id":273835758,"uuid":"920682627","full_name":"hima890/Smartx-Platform","owner":"hima890","description":"A Flask-based web application integrated with a microserver to simulate IoT devices. This project features user authentication, Docker containerization, and real-time IoT device communication.","archived":false,"fork":false,"pushed_at":"2025-01-25T11:27:19.000Z","size":10467,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-12T13:32:21.000Z","etag":null,"topics":["alx-africa","alx-software-engineering","api","docker","embeded-systems","flask-application","iot-platform","mysql-database","redis"],"latest_commit_sha":null,"homepage":"","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hima890.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-22T15:38:06.000Z","updated_at":"2025-01-25T11:27:23.000Z","dependencies_parsed_at":"2025-01-23T09:32:46.544Z","dependency_job_id":null,"html_url":"https://github.com/hima890/Smartx-Platform","commit_stats":null,"previous_names":["hima890/smartx-platform"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hima890/Smartx-Platform","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hima890%2FSmartx-Platform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hima890%2FSmartx-Platform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hima890%2FSmartx-Platform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hima890%2FSmartx-Platform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hima890","download_url":"https://codeload.github.com/hima890/Smartx-Platform/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hima890%2FSmartx-Platform/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31754865,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T13:27:56.013Z","status":"ssl_error","status_checked_at":"2026-04-13T13:21:23.512Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alx-africa","alx-software-engineering","api","docker","embeded-systems","flask-application","iot-platform","mysql-database","redis"],"created_at":"2025-01-02T21:51:22.184Z","updated_at":"2026-04-13T13:32:06.315Z","avatar_url":"https://github.com/hima890.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Project Demo](demo.png)\n# Flask Application - Routing and API\n\nThis project is a Flask-based web application that provides a robust backend for managing users, devices, and APIs. Below is a detailed overview of the project’s features, setup instructions, and usage guidelines.\n\n## Features\n\n1. **User Management**:\n   - Login system with session validation.\n   - User profile management with details like username, email, and last login.\n\n2. **Dashboard and Devices**:\n   - Individual dashboards for devices.\n   - Device information and statistics retrieval.\n\n3. **API Support**:\n   - API key validation for secure operations.\n   - Endpoints for listing devices, fetching statistics, and updating values.\n\n4. **Database Integration**:\n   - Handles user and device data storage.\n   - Supports dynamic data updates.\n\n5. **Environment Configuration**:\n   - Uses `.env` file for secure storage of environment variables like database credentials.\n\n## Setup Instructions And Infrastructure\n![Infrastructure](./Infrastructure_design/smartx_platform.png)\n### Prerequisites\n\n- Python 3.7+\n- Flask\n- pip\n\n### Installation\n\n1. Clone the repository:\n   ```bash\n   git clone \u003crepository-url\u003e\n   cd \u003crepository-folder\u003e\n   ```\n\n2. Create a virtual environment and activate it:\n   ```bash\n   python -m venv venv\n   source venv/bin/activate  # On Windows: venv\\Scripts\\activate\n   ```\n\n3. Install dependencies:\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n4. Set up the `.env` file with the following variables:\n   ```env\n   DBUSER=\u003cyour-database-username\u003e\n   DBPASSWORD=\u003cyour-database-password\u003e\n   DBHOST=\u003cyour-database-host\u003e\n   DBNAME=\u003cyour-database-name\u003e\n   ```\n\n5. Run the application:\n   ```bash\n   flask run\n   ```\n\n### Folder Structure\n\n```plaintext\n.\n├── app\n│   ├── __init__.py\n│   ├── routes.py  # Defines routing and API logic\n│   ├── database.py  # Handles database connections and queries\n│   ├── models.py  # Defines data models\n│   ├── users.py  # Handles user-related operations\n│   ├── templates/  # HTML templates\n│   └── static/  # Static files (CSS, images, JS)\n├── .env  # Environment variables\n├── requirements.txt  # Python dependencies\n├── README.md  # Project documentation\n└── run.py  # Entry point for the application\n```\n\n## API Endpoints\n\n### User Routes\n\n- `/` - Home page.\n- `/aboutus` - About Us page.\n- `/login` - User login.\n- `/logout/\u003cusername\u003e/\u003csession\u003e` - User logout.\n\n### Dashboard Routes\n\n- `/overview/\u003cusername\u003e/\u003csession\u003e` - User overview page.\n- `/device1/\u003cusername\u003e/\u003csession\u003e` - Device dashboard.\n\n### Profile Management\n\n- `/profile/\u003cusername\u003e/\u003csession\u003e` - User profile page.\n- `/apisettings/\u003cusername\u003e/\u003csession\u003e` - API settings page.\n\n### API Routes\n\n- `/api/\u003capikey\u003e/test` - Test API connection.\n- `/api/\u003capikey\u003e/listdevices` - List devices associated with an API key.\n- `/api/\u003capikey\u003e/deviceinfo/\u003cdeviceID\u003e` - Retrieve specific device information.\n- `/api/\u003capikey\u003e/fieldstat/\u003cfieldname\u003e` - Get field statistics across devices.\n- `/api/\u003capikey\u003e/devicestat/\u003cfieldname\u003e/\u003cdeviceID\u003e` - Get field statistics for a specific device.\n- `/api/\u003capikey\u003e/update/\u003cdata\u003e` - Update device values.\n\n## Example Usage\n\n1. **Login**:\n   - Navigate to `/login` to authenticate.\n\n2. **Dashboard**:\n   - After login, access your dashboard at `/overview/\u003cusername\u003e/\u003csession\u003e`.\n\n3. **API Testing**:\n   - Use the `/api/\u003capikey\u003e/test` endpoint to verify API connectivity.\n\n4. **Device Information**:\n   - Retrieve a list of devices using `/api/\u003capikey\u003e/listdevices`.\n   - Get details for a specific device at `/api/\u003capikey\u003e/deviceinfo/\u003cdeviceID\u003e`.\n\n5. **Statistics**:\n   - Fetch field statistics with `/api/\u003capikey\u003e/fieldstat/\u003cfieldname\u003e`.\n   - Get device-specific statistics at `/api/\u003capikey\u003e/devicestat/\u003cfieldname\u003e/\u003cdeviceID\u003e`.\n\n6. **Update Values**:\n   - Use `/api/\u003capikey\u003e/update/\u003cdata\u003e` to push updates to device data.\n\n## Contributing\n\n1. Fork the repository.\n2. Create a new branch:\n   ```bash\n   git checkout -b feature/your-feature-name\n   ```\n3. Commit changes:\n   ```bash\n   git commit -m \"Add your message here\"\n   ```\n4. Push to your branch:\n   ```bash\n   git push origin feature/your-feature-name\n   ```\n5. Create a pull request.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhima890%2Fsmartx-platform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhima890%2Fsmartx-platform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhima890%2Fsmartx-platform/lists"}