Click here to see the "buggy" versions 🐛
TinyHat.Me is an up and coming startup that provides an API to allow users to try on tiny hats via a REST API. The startup is looking to you to ship some awesome new features! While we have a frontend working to serve tiny hats from a database, the startup is looking to add some exciting new features. Today, as the newest backend engineer at TinyHat.Me, you are going to be learning how the microservices work, as well as fix a few outstanding bugs from our customers!
Follow instructions here to install minikube.
minikube start
Clone this repository and cd into root directory.
kubectl apply -f kube-local
To test the API directly:
minikube service -n default --url gateway-service
To interact with the API through the frontend:
minikube service -n default --url frontend-service
minikube delete
Click here to access the S3 console.
Click Create bucket.
- Name your bucket in the
Bucket namefield. (Example:tinyhats) - Edit the Public Access settings to match the configuration below:

Create bucket.
On the S3 console, click on the newly created S3 bucket by identifying it with the name you assigned it to. (Example: tinyhats)
- Click on
Permissionsand scroll down toBucket policy. - Click
Editand paste the below policy in the editor, remembering to replacetinyhatswith your bucket name
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AddPerm",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::tinyhats/*"
}
]
}
- Click
Save changes. If you configured your bucket correctly, you should see the labelsPublicly accessibleand Access labeled asPublic.
Ensure you have a running cluster and
kubectlconfigured. Obtain your AWS ID and Secret. Export these into environment variables.
export S3_ID=[your S3 ID]
export S3_SECRET=[your S3 secret]
Clone this directory. Change directory (cd) into the kube folder and run the below command to apply your S3 secrets and deploy the Kubernetes resources.
for f in *.yaml; do envsubst < $f | kubectl apply -f -; done
Using kubectl get pods --watch, monitor when the pods are finished deploying. Use kubectl get services to copy the URI of the gateway-service or frontend-service for testing.
api.tinyhat.me?number=2?number(optional): How many hats you want!
api.tinyhat.meReturns a random tinyhat on Bob Ross.
api.tinyhat.me/santaReturns a specific hat style on Bob Ross.
api.tinyhat.me/api/hatsReturns a JSON object of all hats' image links and style identifiers.
api.tinyhat.mePOST with multipart/form-data: image with face
Returns a random tinyhat on your POSTed image.
api.tinyhat.me/santaPOST with multipart/form-data: image with face
Returns a specific hat style on your POSTed image.
api.tinyhat.me/addPOST with multipart/form-data: image with hat andnameattribute
Adds the image to the admin page to queue for approval.



