
KasaMukti: Building a Smarter Waste Recovery Ecosystem with AWS Turning waste management challenges into opportunities for sustainable resource recovery
Introduction: The Problem Is Not Just Waste. It Is What Happens Next. Every day, households, farms, and communities generate waste that could potentially become a valuable resource. Organic waste can support composting, recyclable materials can re-enter production cycles, and discarded items can find new uses. Yet, between waste generation and resource recovery, there is often a gap in coordination, information, and access to the right services
Kasa Mukti: Creating A Smarter Waste Recovery Ecosystem with AWS
Turning waste management challenges into an opportunity for sustainable resource recovery
By the Kasa Mukti Team
Introduction: The Problem Is Not Just Waste. It Is What Happens Next.
Households, farming operations, and communities generate waste that could become a valuable**** resource. Organic waste can be utilized for composting. Items that can be reused or recycled find new owners. But between the creation of waste and the recovery of resources, there is often a gap in the information and coordination that is needed.
Citizens may not have the information they need to dispose of certain materials correctly. Farmers can benefit from a source of organic materials to be recovered, but they may not have an easy way to tap into this resource. Municipal teams are responsible for a range of waste management activities, while recovery partners need to find the right sources and materials for their operations.
The challenge is not just in getting the waste collected and processed. It is in connecting the people and information that are necessary to accomplish this goal.
That question guided the creation of the KasaMukti environmental waste management and recovery platform, built with Amazon Web Services (AWS).
We sought to create a foundational experience for citizens, farmers, municipal, and recovery partners to collaborate to create a more sustainable waste management ecosystem.
Part 1: The Real Challenge of Waste Management
When it comes to the challenge of waste management, it is easy to think in terms of collection: identifying the waste, organizing its pickup, and getting it to its next destination. But responsible waste management involves a series of additional steps.
A citizen looking to dispose of electronic waste needs guidance and information. A farmer looking to recover materials that can be utilized for agriculture applications needs to know where to find them and how they can be retrieved. Municipal teams need information to enable their operations, and recovery partners need to identify potential sources of recoverable materials.
Each of these activities represents an opportunity to improve the chances that waste will not be unnecessarily discarded or that materials will not be lost.
KasaMukti recognizes these challenges and seeks to address them:
Citizens and farmers may need guidance in terms of appropriate disposal of various materials.
There are multiple stakeholders in the process of waste management and recovery.
There are opportunities for these stakeholders to collaborate to optimize their operations.
There is a need for better visibility into the processes of waste management and recovery.
Waste management and recovery involve environmental responsibility, but they also require an appropriate level of collaboration among stakeholders.
Part 2: Introduction to KasaMukti
KasaMukti is built around a multi-stakeholder application that seeks to create a connected experience for various waste management and recovery stakeholders.
The application recognizes that these stakeholders have different needs. As a result, KasaMukti provides different sets of features to these user groups, enabling them to engage with the waste management and recovery domain according to their roles and responsibilities.
The main user groups of KasaMukti are as follows:
Citizens
They represent an important aspect of responsible waste management and recovery. KasaMukti provides them with access to the application features that provide the information and support they need to fulfill their responsibilities.
Farmers
They represent an important opportunity for recovery, notably of organic waste that can be utilized for agriculture purposes. The application enables farmers to participate in the waste recovery process.
Municipal workers and officers
They provide critical support and oversight for waste management and recovery efforts. Municipal workers can utilize the application for their operations, while officers can oversee them.
Recovery partners
They play a key role in ensuring the sustainability of waste management by recovering materials, reusing them, or facilitating their repurposing. The application enables recovery partners to identify opportunities and fulfill their responsibilities.
Administrators
They oversee the operations of the application.
With these user groups in mind, KasaMukti was created as a connected application that enables these stakeholders to collaborate to achieve a common goal.
Part 3: Making the Idea a Reality Through an Architectural Design
An idea is only as good as its ability to be realized. And the realization of a promising idea often begins with its architecture. When it comes to a digital application, this architecture is centered around a user experience that enables the engagement of the target audience and the features that fulfill their needs. But to enable that experience, the application also requires supporting elements.
KasaMukti is built on top of AWS Managed Services, thereby relying on AWS to support critical aspects of the application, including user authentication, the management of its application logic, the storage of information, and its data presentation to users.
At the frontend, the React and Vite-based application is complemented by a Python-based backend and a number of critical AWS services. The following section describes how these services fit together to support the application.
- AWS Amplify: Delivering the Frontend Experience
KasaMukti utilizes AWS Amplify Hosting to host the frontend of the application.
The frontend represents the experience that users engage with, and AWS Amplify makes it easier to deliver this experience to end users. More specifically, it enables the deployment of React applications by linking the frontend code to the hosted application.
As part of a hackathon project, this approach offers significant advantages in terms of time investment: instead of spending time on the maintenance of a web server, contributors can invest their time in improving the experience that the application delivers to its users.
- Amazon Cognito: Authenticating Users
As mentioned, KasaMukti serves a number of user groups with potentially different needs. Amazon Cognito is utilized to ensure that authenticated users are provided with the features that are appropriate to their account type.
Amazon Cognito provides the foundational authentication experience and recognizes user groups that represent the different stakeholders. From there, the application utilizes these groups to provide different features to users according to their account type. The application distinguishes between citizens, farmers, municipal workers, municipal officers, recovery partners, and administrators, providing each with a role-aware experience.
An important lesson to mention at this point is that authentication and authorization are not the same. While authentication determines whether a request can be authenticated, authorization defines what an authenticated request can actually do.
- Amazon API Gateway: Connecting the Frontend to the Backend
The frontend needs a way to communicate with the backend. That is the purpose of Amazon Application Programming Interface (API) Gateway, which exposes HTTP API endpoints for the application.
These endpoints are linked to the application backend and route requests from the frontend to the appropriate logic for processing.
In short, Amazon API Gateway defines the contract between the frontend and backend of the application.
At the same time, it also offers significant benefits in terms of authentication and authorization: it is possible to secure the API endpoints, ensuring that only authenticated and authorized requests can actually reach the backend.
- AWS Lambda: Executing the Application Logic
The Python-based application backend relies on AWS Lambda to execute its logic.
AWS Lambda is a serverless computing service that executes code without the need to manage a server directly. In short, it executes the code that powers the application according to well-defined instructions.
This approach was selected for its flexibility: the code executed by AWS Lambda defines much of what the application can do.
As mentioned, KasaMukti is a serverless application, which means that its infrastructure needs do not require the continuous provisioning of resources on a server. This approach offers significant advantages in terms of development and maintenance, particularly at early stages of an application’s growth.
- Amazon DynamoDB: Storing the Application Data
Waste management and recovery require the storage of much information. Amazon DynamoDB provides AWS with a managed NoSQL database that allows the storage of structured data.
This service is utilized to store the structured information required by the application.
As is the case with other AWS services, managing a database at scale can be complex, but it does not need to be: Amazon DynamoDB manages this responsibility, allowing KasaMukti contributors to dedicate their time and effort to the continuous improvement of the application.
- Amazon S3: Storing Files
Many aspects of the application require the storage and retrieval of files, notably images. Amazon Simple Storage Service (Amazon S3) is utilized to store files that are uploaded by users or that the application needs to retrieve.
This approach isolates file storage from the rest of the application logic, which is particularly useful at early stages of development.
Part 4: Bringing It All Together
Individual elements contribute to an overall vision, but the way in which they are combined contributes to its realization. The AWS services that power KasaMukti are no different: they are each important, but the way in which they are integrated is critical to the project’s success. Let’s take a closer look at this architecture to understand how these elements fit together.
The general request flow can be summarized as follows:
A user launches the web application, which is hosted by AWS Amplify.
They are prompted to authenticate by logging in with one of the supported identity providers.
The frontend communicates with the application API, which is exposed by Amazon API Gateway.
Amazon API Gateway authorizes and authenticates the request, relaying it to the appropriate processing logic.
AWS Lambda executes the application’s logic, which reads or writes information from Amazon DynamoDB or Amazon S3, as needed.
The backend returns a response to the frontend, which then updates the UI according to the received information.
This approach separates the application’s concerns: the frontend does not need to worry about the database; the application logic does not need to worry about the frontend’s presence; and the rest of the application can rely on the well-defined API contracts.
Part 5: The Real Lessons of KasaMukti’s Development
Managed services reduce the burden of infrastructure, but they are not a magic solution. Development and operations experience play an important role in the successful realization of a technical project. The lessons learned during the development of KasaMukti are instructive in this regard, providing important insights that go beyond the specific details of the application.
Authentication Is Not Authorization, But Both Are Important
A user logging in with valid credentials is not sufficient: each request to a protected API resource needs to be analyzed and authorized according to the user’s needs and permissions. While this might be confusing at first, it becomes second nature after a few months of development.
The reason for this separation is that users tend to have different permissions based on their user group.
A successful authentication flow does not automatically grant permissions to every API resource.
API Contracts Keep Everything Working Smoothly
The frontend and backend of an application define an API contract. This contract outlines what request methods, request headers, request body formats, and response formatting are supported. Any changes to this contract can be disruptive to the application, particularly when changes are made without end-to-end testing of the updates.
Deployment Configuration Is Part of the Application
A frontend deployment that works locally might not work as expected due to incorrect configuration settings, particularly when it comes to API endpoints and user authentication. Configuration settings need to be treated with the same care as the application code itself.
Debugging Breaks Needs Evidence, Not Assumptions
A failed request can originate from a number of reasons, ranging from an incorrect request method to a missing request header or incorrect user authentication. Debugging such a request requires evidence: checking the request, the API Gateway configuration, and the relevant backend logs to determine what step of the request flow failed.
Finding evidence is more efficient than randomly modifying code in the hopes of fixing an issue.
These lessons represent only a small sample of what development experience has to offer. But they are invaluable to anyone who wants to build a quality application: they are universal, spanning beyond the specifics of the application being built.
Part 6: Why This Architecture Fits an Environmental Platform
Environmental platforms require a certain level of flexibility, particularly when it comes to user groups and their permissions. They also need to be pragmatic: the infrastructure and operations overhead should not overshadow the features and user experience of the application. The lessons of KasaMukti’s development, in combination with the AWS services, allow us to identify a number of architectural benefits that support the requirements of an environmental application.
Less Infrastructure Overhead: Managed Services Reduce the Burden of Operations
As mentioned, KasaMukti is a serverless application that is powered by a number of AWS managed services, from frontend hosting and authentication to database and storage management. The primary benefit of this approach is reduced infrastructure overhead: instead of provisioning and securing application servers, developers can dedicate their time to the improvement of the application.
Separation of Concerns: Every Service Has a Part to Play
The combined use of these services also plays a part in the separation of concerns: the frontend experience, API Gateway, application logic, application database, and storage are all separate components that do not interfere with one another.
Flexibility Without Complexity: Improving Components Without Rewriting the Application
Each component can be improved individually without rewriting the entire application.
Opportunistic Development: New Features Can Benefit From an Existing Backend
The backend of the application can serve as a foundation for additional features, such as more advanced waste classification and recovery matching, analytics and reporting capabilities, and better operational visibility and reporting for municipal stakeholders and recovery partners.
A Foundation for Growth: An Architecture Designed to Grow
This architecture provides the foundation for future improvements and increased adoption. But these improvements cannot be realized unless the application is deployed and utilized by end users.
These points highlight the architectural benefits that KasaMukti derives from its AWS services. But they do not constitute an endorsement of every potential scaling and operations decision. Monitoring, security, cost optimization, and testing are ongoing operations that need to be considered as the platform grows and evolves.
Part 7: The Road Ahead for KasaMukti
KasaMukti is only the beginning of an exciting journey into the environmental domain. There are a number of opportunities for this platform to grow and improve according to the needs of its many stakeholders.
Smarter waste intelligence: Helping Users Better Classify and Manage Waste
KasaMukti can be improved to provide users with opportunities to classify waste and identify the most appropriate courses of action.
Better recovery matching: Helping Users Better Coordinate Their Efforts
KasaMukti can be improved to facilitate the identification of opportunities for municipal stakeholders and recovery partners to coordinate their activities and track their progress.
More effective operational coordination: Helping Municipal Stakeholders and Recovery Partners Better Coordinate Their Efforts
The application can be improved to improve the ability of municipal stakeholders to coordinate their operations and track their progress.
Improved environmental engagement features: Helping Users Better Understand Their Impact
The application can include more features to help users engage with the environmental domain, from participation tracking to education and impact reporting features.
Better visibility and reporting: Helping Stakeholders Better Understand Their Impact
The application can be improved to provide additional dashboards and reports that support the efforts of its stakeholders.
These features represent opportunities for future development and improvement. They are not promises that these features will be delivered in the current iteration of the application. But they are the ideas that we hold dear as we seek to improve KasaMukti in the future.
Conclusion: Technology Should Help in Making Resources Find Their Next Purpose
Waste is not just a challenge: it represents an opportunity for better sustainability and a more circular economy. But it is also a complex challenge that goes beyond the management of resources: it requires a better connection of people, information, and processes.
KasaMukti explores that space, utilizing AWS to create a role-aware application that targets the needs of various stakeholders in the domains of waste management and recovery.
The primary lesson of this endeavor is not that we were able to use a number of cloud services. The lesson is that each of these services plays an important role in addressing a technical challenge.
There is still work to do, and KasaMukti has yet to fulfill its promise as a tool for the better waste management and recovery of our planet’s limited resources.
But the journey has only just begun, and we look forward to continued opportunities to advance in this exciting endeavor.
Acknowledgements
KasaMukti is the result of an environmental technology initiative that leveraged AWS managed services to realize an innovative idea involving a number of stakeholders. We extend our gratitude to AWS for their contributions that enabled us to realize the frontend, backend, authentication, and storage components of this application. The views expressed in this article are our own and do not necessarily reflect the views of Amazon Web Services.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article