Create a JSON API using Hono
In this project we'll first create a JSON API using Hono and we'll use it to handle a collection of data. We'll use a Postgres database for persisting data.
hono postgres kysely

Let’s start this project by defining the requirements.

Let’s imagine this scenario: we’re told by our client that they want us to build an API to power an e-commerce marketplace store.

The e-commerce store will be a very big website and they have users, “sellers”, signing up to sell products.

Users can create products, add a picture and a description, set a price tag, and put the products on sale on the store.

Then people, “clients”, can visit the store and place orders.

Products will be digital, so we’ll have to handle that aspect too. And clients will receive a download link when they buy.

Because the budget is limited (I’m making stuff up) we have to set some limitations to what the store can do.

Let’s say:

  • clients can only buy one product a time (no “shopping cart”)
  • no payments involved at the moment (only free products) - I know, kinda weird, but we’ll leave payments for another project
  • clients will see the download link after they buy, and that’s it
  • we won’t have API authentication at this time (maybe in the future)

We’re not going to build the store, just the API. But this kind of information is essential in designing the API. We’re not sure yet how the API will be affected, but we’ll take that into consideration.