Skip to content

Latest commit

 

History

History
185 lines (133 loc) · 6.81 KB

README.md

File metadata and controls

185 lines (133 loc) · 6.81 KB

Snkrhub - Track, manage, and organize your sneaker reselling

SnkrHub Frontend CI SnkrHub Backend CI
stars forks open issues license


Table of Contents

About the Project

snkrhubscreenshot

This project was created to learn about Microservices and Kubernetes.

The front end of the project is created with React Native. I chose React Native because I primarily build projects in Next.js so I just wanted to switch it up. There is not much to talk about on the front end as the focus of this project was to learn about Microservices & Kubernetes.

The backend consisted of 3 services, the inventory service, the analytics service and the gateway service. The apis were built with Apollo Federation. I chose this architecture as it allows individual GraphQL apis to be composed into subgraphs which can then be queried from the gateway which acts as a single access point. Having a single access point makes the server more secure, reduces round trips and reduces the complexity of having each service handle concerns such as authorization and SSL.

To be able to deploy the project, I had to learn the basics of Kubernetes. This was the hardest part of the whole project and it took a while to understand what was going on. Once I kinda knew what I was doing, deploying the backend was pretty straight forward. All configurations were defined in yaml files and separated into folders to make it easier to manage of all the configuration. First the databases were deployed, they use Persistent Volumes to keep the data intact even if the pod restarts. After that, the gateway was deployed. It defines an Ingress resource to expose the gateway to the client, the gateway is exposed on the host skrhub.xyz. Then, the configuration which issued a tls certificate for snkrhub.xyz was deployed. Once the gateway was working, the last step was to deploy the subgraphs.

The only major difficulty I had with the deployment was getting tls configured, I followed this guide here.

Tech Stack

Client
Server
Database
DevOps

Getting Started

Prerequisites

Before running this project, make sure you have docker installed. You will also need either XCode or Android studio installed and configured with an emulator (to run the frontend)

Run Frontend Locally

Clone the project

  git clone https://github.com/phoenixbeats01/snkrhub.git

Go to the snkrhub directory

  cd snkrhub/snkrhub

Install dependencies

  yarn install

Start the server

  yarn start

IMPORTANT:

When you are viewing this, the domain snkrhub.xyz may have been taken offline. If so, you will need to configure the app to use the backend gateway locally that we will set up in the next step.

Inside the snkrhub folder, open up the apollo folder.

Open up client.ts.

Replace the client uri with http://localhost:3000/graphql

Run Backend Locally

Go to the backend directory

  cd snkrhub/backend

Run the docker compose command to start up all the services.

  docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d --build

License

Distributed under the MIT License. See LICENSE.txt for more information.