# [Barretthousen](https://barretthousen.com)

[![Build Status](https://ci.vdhsn.com/api/badges/Barretthousen/barretthousen/status.svg?ref=refs/heads/trunk)](https://ci.vdhsn.com/Barretthousen/barretthousen)
Search and get alerts for items across the most popular auction sites.

Built with microservice architecture and various fancy tools for learning purposes

### Links

- [Keybase Team Chat](keybase://team/barretthousen)
- [Source](https://git.vdhsn.com/Barretthousen/barretthousen)
- [User's Site](https://barretthousen.com)
- [Admin Panel](https://admin.barretthousen.com)
- [(Staging) User's Site](https://beta.barretthousen.com)
- [(Staging) Admin Panel](https://beta.admin.barretthousen.com)

## Technology

This project is for fun and learning so there are a lot of tools at play:

Infra
- [Tilt](https://tilt.dev): local development env orchestration
- [Ctlptl](https://github.com/tilt-dev/ctlptl): Automate local kubernetes clusters for local dev
- [Docker]()
- [Postgres]():
- [Traefik]():
- [Kustomize]():
- [Helm]():

Backend
- [Go]()
- [goose](): Go SQL db migration tool
- [Sqlc](https://sqlc.dev/): Generate Go code to query SQL databases from migrations in a type safe way
- [Buf](): Nice frontend for protoc and .proto libraries
- [Protobufs]():

Frontend
- [Typescript]():
- [SvelteKit](https://kit.svelte.dev/):
- [TailwindCSS]():


- [Diagram (use diagrams.net)](./doc/bh_design.drawio)

![Diagram](./doc/bh_design_overview.svg)

### Services

> [Auction terms glossary](https://auctionsneapolitan.com/Auction-Terms-Glossary.html)

- [Web-client](./src/web-client/)
Frontend site that users access to browse upcoming auctions and subscribe for updates to their searches

- [Admin-client](./src/admin-client/)
Enables site administrators to kicks off scrape and email jobs in Runner and Ringman, and view status on current/past jobs.

- [Catalog](./src/catalog/)
API for searching upcoming auctions.

- [Runner](./src/runner/)
Scrapes sites for upcoming auctions.
Transforms the data into a suitable shape and stores it for use by the frontend.

- [Ringman](./src/ringman/)
Manages email subscriptions and sending emails to users about upcoming auctions.

- [Proxy-web](./src/proxy-web/)
Proxies JSON HTTP API requests for the web client to GRPC based services downstream

- [Proxy-admin](./src/proxy-admin/)
Proxies JSON HTTP API requests for the admin client to GRPC based services downstream


## Contributing

You will need the following prereqs installed:
- Docker
- Make
- [asdf](https://asdf-vm.com/guide/getting-started.html)


Everything you need is in the makefile:

```sh
# install asdf tools, sqlc, buf
make setup

# generate protobufs and sql boilerplate
make gen

# spin up a k8s cluster, build and deploy services locally w/ hot reloading - be patient this takes a few minutes first run
make dev

# build production docker images for the backend microservices, optionally push to the respective env
make build-backend-image SERVICE=[catalog, runner, proxy-web, proxy-admin] [ENV=[beta, prod]]

# build client docker image for web frontends, optionally push to the respective env
make build-client-image SERVICE=[web-client, admin-client] [ENV=[beta, prod]]

# acceptance tests
make acceptance-test SERVICE=[runner,catalog] ORIGIN=[beta.barretthousen.com,beta.admin.barretthousen.com]
```


For how to deploy [read me](./doc/deployment.md).
