How mounseflit/ni-ma works
Project type and purpose
• This is a multi‐repo, full-stack IoT/ML system for real-time illegal-logging detection.
• Forest Sensors (Arduino devices) capture audio, a Data API ingests events, an ML Service classifies sounds, alerts go out via Twilio, and a React Console visualizes events. There’s also a static Landing Page for marketing.
File structure
• Top-level directories:
• Sensor: forest-sensor.ino for hardware code.
• Back-End: Node.js/Express ingestion service (server/server.js), uses Firebase Admin SDK (secret.sample/firebase-admin-sdk.json), IBM Cloud Foundry manifest.
• ML: Python microservice (Django/Flask style with manage.py, server/routes, services/Detector.py), Swagger UI (public/swagger-ui), containerized via Dockerfile, IBM Cloud Foundry manifest.
• Front-End: React app (src/), Firebase client (src/firebase.js), hosted on Surge/static.
• Landing Page: static HTML/CSS/JS marketing site with an embedded AI demo (ai/CODE.py, model files).
README for additional insights
• Architecture described in text:
1. Forest Sensors → raw alerts DB
2. Data Server → ML-Service classification
3. Chainsaw alerts → DB + Twilio SMS/Call
4. Alerts → Forest Console map
a. Main components
• Forest Sensor Devices (Arduino)
• Data Ingestion API (Node.js/Express)
• ML Classification Service (Python + Docker + Swagger)
• Database (Firebase Realtime DB or Firestore)
• Notification Service (Twilio)
• Web Console (React + Firebase client)
• Landing Page (Static site)
• Cloud Platform (IBM Cloud Foundry)
b. Relationships & data flow
1. Sensor captures audio → POST to Data API
2. Data API writes raw event to DB and/or invokes ML Service (REST call)
3. ML Service fetches or receives raw data → runs Detector → returns classification
4. On “chainsaw” → Data API persists classified alert to DB → invokes Twilio API → SMS/Call to responders
5. React Console subscribes to DB events via Firebase SDK → renders markers on map
6. Landing Page is a separate static site for marketing/demo
c. Architectural patterns & principles
• Microservices: separate Data API & ML Service
• Event-driven: DB as pub/sub for real-time updates
• RESTful APIs between components
• Containerization for ML, managed on Cloud Foundry
• Single-page React app with secure Firebase integration
d. Key technologies
• Hardware: Arduino C++
• Data API: Node.js, Express, Firebase Admin SDK
• ML Service: Python (Flask/Django), Docker, Swagger UI
• Database: Firebase Realtime Database / Firestore
• Notification: Twilio REST API
• Frontend: React, Firebase JS SDK
• Hosting: IBM Cloud Foundry, Surge (static sites)
Detail
• Repository as a separate component.
• Deployment boundaries (IBM Cloud Foundry).
• Service-to-service calls (API ↔ ML), and third-party integrations (Firebase Admin, Twilio).