https://github.com/lukehedger/graphql-go-postgres-elasticsearch
Go GraphQL API + Postgres database + Elasticsearch
https://github.com/lukehedger/graphql-go-postgres-elasticsearch
elasticsearch go graphql postgresql
Last synced: 3 months ago
JSON representation
Go GraphQL API + Postgres database + Elasticsearch
- Host: GitHub
- URL: https://github.com/lukehedger/graphql-go-postgres-elasticsearch
- Owner: lukehedger
- Created: 2019-02-28T10:53:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-28T10:54:09.000Z (over 7 years ago)
- Last Synced: 2025-08-31T09:41:49.902Z (10 months ago)
- Topics: elasticsearch, go, graphql, postgresql
- Language: Go
- Size: 10.7 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GraphQL x Go x Postgres x Elasticsearch
Simple skeleton for a Go GraphQL API connected to a Postgres database and Elasticsearch cluster.
## Contributing
### Requirements
- Go v1.11
```sh
brew install go
```
- Postgres v11
```sh
brew install postgresql
```
- ElasticSearch v6.6
```sh
brew install elasticsearch
```
### Setup
Build Go module:
```sh
go build ./...
```
### Run
Start the Elasticsearch cluster:
```sh
elasticsearch
```
Start the GraphQL server:
```sh
go run server/server.go
```
Try some operations:
```graphql
query sayHello {
hello(id:"1")
}
query searchFor {
search(query:"luke") {
id
name
}
}
```
## Architecture
- `db.go` - Database setup and connection
- `model.go` - Application type definitions
- `resolver.go` - Resolve API operations, with access to database and Elasticsearch cluster
- `schema.graphql` - GraphQL schema in SDL
- `server/server.go` - Serve GraphQL API
- `util/schema.go` - Transform SDL to parseable string