https://github.com/paihari/vending-machine-golang-graphql
Account Vending Machine. Creates Child Accounts, IAM Users, Tag, Policies, Stores the state in DB
https://github.com/paihari/vending-machine-golang-graphql
account db-design graphql iam oci pgsql policies tags
Last synced: 7 days ago
JSON representation
Account Vending Machine. Creates Child Accounts, IAM Users, Tag, Policies, Stores the state in DB
- Host: GitHub
- URL: https://github.com/paihari/vending-machine-golang-graphql
- Owner: paihari
- Created: 2023-02-24T12:47:50.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-05-09T11:05:25.000Z (5 months ago)
- Last Synced: 2025-05-09T12:23:05.660Z (5 months ago)
- Topics: account, db-design, graphql, iam, oci, pgsql, policies, tags
- Language: Go
- Homepage:
- Size: 386 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ง Vending Machine POC โ Go + GraphQL
A proof-of-concept (POC) microservice that models a vending machine backend using **Golang**, **GraphQL**, and **PostgreSQL**. This application is cloud-ready and includes modules to simulate multi-cloud scenarios (AWS, OCI).
---
## ๐ Overview
This project allows users to query and mutate vending machine inventory and simulate user interactions via a GraphQL API. It's useful as a base for learning GraphQL server-side development in Go, infrastructure integration (OCI/AWS), and database schema management.
---
## ๐งฑ Tech Stack
- **GoLang** โ Backend language
- **GraphQL** โ API query language (via gqlgen)
- **PostgreSQL** โ Relational database
- **Docker** โ Containerized deployment
- **Fly.io** โ (Optional) For deployment
- **AWS / OCI modules** โ For cloud resource emulation---
## ๐ Folder Structure
```
vending-machine-golang-graphql/
โโโ awscompose/ # AWS simulation logic
โโโ base/ # DB helper and init logic
โโโ ocicompose/ # OCI simulation logic
โโโ graph/
โ โโโ schema.graphqls # GraphQL schema
โ โโโ resolver.go # Root resolver
โ โโโ model/ # Auto-generated models
โโโ documentation/ # Setup guides & images
โโโ Dockerfile # Docker build script
โโโ server.go # Main Go entrypoint
โโโ docker-compose.yml # Orchestration
```---
## ๐ Setup Guide
### ๐ฆ Dependencies
- Go 1.18+
- PostgreSQL
- gqlgen (`go install github.com/99designs/gqlgen@latest`)### ๐งช Local Dev Setup
```bash
git clone https://github.com/your-org/vending-machine-golang-graphql.git
cd vending-machine-golang-graphql
go run ./server.go
```Open your browser at: [http://localhost:8080](http://localhost:8080)
GraphQL Playground will be available.
---
## โ๏ธ Presetup (Cloud + DB)
- ๐ [Cloud Setup](./documentation/CLOUD-SETUP.md)
- ๐๏ธ [DB Setup](./documentation/DB-SETUP.md)---
## ๐ป Sample Queries
### Query Example
```graphql
query {
items {
id
name
price
}
}
```### Mutation Example
```graphql
mutation {
addItem(input: {
name: "Coca-Cola",
price: 1.5
}) {
id
name
}
}
```More examples in:
- `sample-scripts-query.gql`
- `sample-scripts-mutations.gql`---
## โ๏ธ Author
Built with Simplificare