Inspiration

In Nairobi, many estates already hand households colour-coded liners: green for food waste, blue for recyclables, black for everything else. On paper, that's all a city needs for composting. In practice, households sort for a few weeks, never hear what happened to their waste, and stop. A single plastic bag in a green liner can spoil a whole batch of compost, and nobody finds out until it's too late.

I kept asking one question: what if every household could see its own impact, and get paid for it? If people can see that their 4.2 kg became compost and a share of the sale came back to them, sorting stops being a chore and becomes a habit. That idea became TakaSmart.

What it does

TakaSmart is one web app with three roles:

  • Residents see their verified kilograms, pickup history with photo proof, and compost credits, and redeem credits for compost, seedlings or bill discounts. They can ask Taka, an AI assistant, "where does this go?" in English or Kiswahili, or with a photo.
  • Collectors scan each liner's QR code, weigh it, flag wrong items with one tap and take a photo, even with no signal.
  • Estate managers track participation and contamination, run credit payouts, approve rewards, print QR stickers and download monthly impact reports.

Every pickup also triggers a message: a thank-you with the estate's progress, or a friendly sorting tip. Mistakes never cost money. The first flag gets a tip, and later ones a warning.

How I built it

  • Frontend and backend: Next.js 16 (React 19, TypeScript) with Tailwind CSS 4, designed mobile-first for low-cost Android phones.
  • Database: PostgreSQL on Supabase with Prisma 7: 21 tables, migrations and an audit log.
  • AI: Claude answers questions grounded in the estate's own sorting rules, and falls back to a rule-based matcher when the AI isn't available, so the app never goes silent.
  • Messaging: English and Kiswahili templates sent through a pluggable channel (a simulator today, Africa's Talking SMS when switched on).
  • Offline: a service worker and an on-phone queue let collectors keep recording without signal.
  • Infrastructure: Vercel hosting, daily cron jobs for reminders and photo clean-up, and GitHub Actions running tests, type checks and builds on every pull request.

The credit model

Each period, a share $p$ of the net compost revenue $R$ becomes a pool:

$$ P = p \cdot R, \qquad p = 15\% $$

Each household $h$ earns in proportion to its verified (uncontaminated) weight $g_h$:

$$ c_h = \left\lfloor P \cdot \frac{g_h}{\sum_j g_j} \right\rfloor $$

All money is stored in whole cents and rounded down, so the total paid out can never exceed the pool. The remainder carries over to the next period:

$$ \text{carry-over} = P - \sum_h c_h \;\ge\; 0 $$

For the impact messages, the estimated compost yield from $W$ kg of organics is shown as a range, $[0.15\,W,\ 0.35\,W]$, until real figures come from the composting plant.

Challenges I ran into

  • Never paying twice. Phones retry, people double-tap, and offline queues resend. Every pickup carries a unique ID generated on the phone, so the same pickup is saved once no matter how many times it arrives. The credit ledger is append-only, enforced by a database trigger, and a payout can only run once per estate and period.
  • Working offline. Making a pickup form work with no signal meant caching the page and its scripts with a service worker, queuing pickups on the phone, and syncing them safely when signal returns, including the photos.
  • A bug that signed people out on its own. The demo kept ending by itself. Next.js was prefetching a "sign out" link in the background. Turning it into a button fixed it, and taught me to treat links as possible side effects.
  • Time zones. Reminders run at "18:00 the evening before collection" in Nairobi, while servers run on UTC and scheduled jobs only fire once a day. All the date logic lives in one tested module.
  • Privacy. To follow Kenya's Data Protection Act, residents accept a versioned privacy notice at first sign-in, can turn messages off or delete their data, photos are deleted after 30 days, and exports never include phone numbers.
  • Two languages. Kiswahili runs through the screens, the messages and the AI assistant, not just a translated menu.

What I learned

  • Trust is a feature. Showing people their own numbers changes behaviour more than reminders do.
  • Money code needs integers, idempotency and an audit trail from day one, not as an afterthought.
  • Designing for weak signal and cheap phones makes the app better for everyone.
  • An AI assistant is most useful when it is grounded in local rules and has an honest fallback when it isn't sure.
  • Splitting work into small, reviewable pull requests with automated checks made a large build manageable.

What's next

  • A pilot with 50 to 100 households in one Nairobi estate
  • Real SMS and WhatsApp delivery
  • Official sorting rules and real compost yield data from the composting partner
  • Native-speaker review of the Kiswahili text
  • Bringing the model to other cities that face the same problem

Built With

Share this project:

Updates

Submission history