Twilio hackathon: Buy Food Locally
Tags: twiliohackathon, devjournal, java, react
Published: 2020-04-09 17:58:46

---
title: Twilio hackathon: Buy Food Locally
published: true
description: My submission to the Twilio x DEV Hackathon!
tags: twiliohackathon, devjournal, java, react
---

[Comment]: # Buy food from local vendors. I am trying to bring more features to a situation I found locally, and add the possibility to vendors to create an account and add their products and to safely order food, with a phone number as an identifier. This is a demo project only.

[Reminder]: # (Make sure you've submitted the Twilio CodeExchange agreement: https://ahoy.twilio.com/code-exchange-community)

[Important]: # (By making a submission, you agree to the competition's terms: https://www.twilio.com/legal/twilio-dev-hackathon-terms)


## What I am building
Buy food from local vendors. I am trying to bring more features to a situation I found locally, and add the possibility to vendors to create an account and add their products and to safely order food, with phone number and email as an identifier. This means: 
- a web application for vendors to register themselves, and for customers to order food.

## Demo Link
https://buyfoodlocallyfrontend.herokuapp.com/

## Link to Code
Backend: https://github.com/gabrielaradu/BuyLocalServerSide
Frontend: https://github.com/gabrielaradu/BuyLocalFrontend

## How I built it (what's the stack? did I run into issues or discover something new along the way?)
Backend: Java 11, SpringBoot, Flyway, Hibernate, Postgresql, Twilio APIs: ServerSide, SMS, Phone Number Validation 
JavaScript, ES6, React.js, CSS, Html

## Additional Resources/Info 
Progress Gists:
9.04.2020 ->
Working on my idea for #twiliohackathon hackathon (from home clearly).
Today: new vendor account v1. No password yet, need to update db structure in next ticket. This is the code if you want to take a look: https://tinyurl.com/untyhz8
Must create test profile to stop mucking my db.

10.04.2020 -> 1.Created CRUD endpoints for products.
PR here https://tinyurl.com/uo553tu
Code coverage 100%. I do wonder how long I can keep it this high.
WIP to validate a vendor account phone nr using Twilio SDK.

11.04.2020 -> Verify Vendor Account.
Added possibility to verify a number, send an SMS with a code to that number and create endpoint which checks if the message code matches what is in the database.
PR: https://tinyurl.com/uy5y9a6

13.04.2020 -> Added possibility to create a password after vendor verified their account. Working on security still.
Difficult to concentrate today.

14.04.2020 -> Finished adding JWT, attach a password to a vendor account and login endpoint. Fixed existing failing tests and add some more unit and integration. Two tests that use Test Twilio Creds fail.
PR: https://tinyurl.com/rl4tzah

Need to move to create Frontend client now.
17.04.2020 -> Show list of products
PR: https://github.com/gabrielaradu/BuyLocalFrontend/pull/1
No tests, and weird-looking UI. Need to fix this.

24.04.2020 ->
Finally did the user story for ordering products from two vendors.
Step 1: add your customer phone number. That's how you will get payment link and info about order.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8rmyylrz1tx49wsq1vwr.PNG)

Next, choose what you want to buy. Dummy data (flyway migrations on backend) has two vendors.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/zch1y1kxphokksskqi17.PNG)

Vendor clicks the accept or denies order and customer will receive an automatic SMS with the final response.

A confirmation dialogue will appear if all is good on the server side. By this time, vendors received SMS messages with #twilio API with the customer order.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/rf29u0vv4wqwzsncw2sj.PNG)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/7ll4q41vzz8jjy5g7rcp.PNG)

On the server-side I have implemented logic to create a vendor account and verify it (by SMS of course) using #twilio API, for this demo #twiliohackathon project I think it's enough. I need to redo and add more tests now.

I enjoyed this challenge a lot, reminded that I want to do better on Frontend and enjoy tests more.

Happy Coding.