https://github.com/bilbottom/ecom-application
An e-commerce application built with Go.
https://github.com/bilbottom/ecom-application
go
Last synced: over 1 year ago
JSON representation
An e-commerce application built with Go.
- Host: GitHub
- URL: https://github.com/bilbottom/ecom-application
- Owner: Bilbottom
- Created: 2024-05-08T10:19:02.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-08T21:05:51.000Z (over 1 year ago)
- Last Synced: 2025-01-31T07:57:33.575Z (over 1 year ago)
- Topics: go
- Language: Go
- Homepage:
- Size: 76.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
[](https://go.dev/)
[](https://shields.io/badges/git-hub-last-commit)
[](https://github.com/Bilbottom/ecom-application/actions/workflows/tests.yml)
# E-commerce Application
An e-commerce application built with Go.
This is from the following YouTube tutorial:
- https://youtu.be/7VLmLOiQ3ck
The corresponding repository is:
- https://github.com/sikozonpc/ecom
## Commands
I'm on Windows (and the YouTube tutorial is not), so I can't add a Makefile. Instead, since I'm using GoLand, I am just adding run configurations.
However, the corresponding commands still need to be documented somewhere, so here they are:
```shell
# build & run
go build -o bin/ecom main.go
go run main.go
# ...alternatively, run via Docker
docker compose up --detach
docker compose down --volumes # when you're done
# test
go test ./...
```
## Database
The database is PostgreSQL on port `5432`. After spinning up the Docker containers, you can connect to it using the following credentials:
- `DB_HOST`: `postgres`
- `DB_PORT`: `5432`
- `DB_USERNAME`: `postgres`
- `DB_PASSWORD`: `postgres`
### Analytics
This project uses DuckDB for analytics. Using version `>=1.1` we can hook DuckDB up to the PostgreSQL instance with:
```
install postgres;
load postgres;
attach 'host=localhost port=5432 dbname=postgres user=postgres password=postgres' as backend (
type postgres,
schema 'ecom',
read_only
);
use backend.ecom;
/* Check that it works */
show tables;
```
Copies of the tables can easily be made into a local DuckDB instance while the app is up so that the data can be queried without needing the Docker containers running.