How angelgpaulin/smart-waste-sorter works
Project Type and Purpose
• This is a full-stack, microservice-style recycling management system.
• It comprises four modules:
• A mobile client (Flutter/Dart)
• A web frontend (Next.js/React)
• A RESTful API backend (NestJS + PostgreSQL)
• An AI classification service (Python + FastAPI + CNN model)
• The goal is to let users scan and classify waste, manage recycling routes, view analytics, and administer the system.
File Structure
• Top-level folders map to modules:
• Recycling_CNN_IA → Python IA microservice
• Recycling_Nest_Backend → NestJS API
• Recycling_Next_Frontend → Next.js web frontend
• reciclaje_app_backend/postgres → PostgreSQL data volume
• IA folder contains: FastAPI app.py, CNN model loader, Dockerfile, docker-compose.yml, helper scripts for dataset processing, static uploads.
• Nest backend is organized by domain modules (auth, users, bin-waste-type, collection, etc.), uses JWT guard/strategy, TypeORM entities, DTOs. Has its own docker-compose.
• Frontend is a Next.js 13 “app” directory structure, global CSS, middleware, API helper, constants.
• PostgreSQL storage under reciclaje_app_backend holds the database state (managed via Docker volume).
README Insights
• Confirms four modules, technology stacks, run instructions, integration points.
• IA runs as a microservice consumed by the mobile or backend.
• Backend exposes REST endpoints for user, route, recycling history management.
• Frontend is an admin/analytics dashboard; mobile app leverages same APIs.
Components
a. Main Components
1. Mobile App (Flutter/Dart)
2. Web Frontend (Next.js/React)
3. API Backend (NestJS/TypeScript)
4. AI Service (FastAPI + CNN model)
5. Database (PostgreSQL)
6. (Optional) GitHub Actions / CI pipeline
b. Relationships & Data Flows
– Mobile App ↔→ Backend API (HTTP/JSON)
– Web Frontend ↔→ Backend API (HTTP/JSON)
– Backend API →→ PostgreSQL (via TypeORM)
– Backend API ↔→ AI Service (HTTP/JSON for image classification)
– Mobile App may call AI Service directly for on-demand classification
– Docker Compose orchestrates Backend + IA + Postgres
– GitHub (.github/CODEOWNERS) triggers CI/CD on push
c. Architectural Patterns & Principles
– Microservices: IA separate from core API
– Modular monolith (NestJS modules per domain)
– MVC‐like layering inside Nest (controllers → services → repositories/entities)
– Infrastructure as code: docker-compose for multi-container setup
d. Key Technologies / Libraries
– NestJS, TypeORM, JWT Auth Guard
– FastAPI, TensorFlow/Keras CNN model (modelo_residuos.h5)
– Next.js 13 (App Directory), React, fetch/axios in lib/api.ts
– Docker, Docker Compose, Git LFS for large model
Detail
• Volume mounts: e.g., Postgres data directory under reciclaje_app_backend/postgres.
• External dependencies (OpenAI API key for IA, Git LFS).