gql-sheets

command module
v0.0.0-...-f09f64d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 15 Imported by: 0

README

gql-sheets

Coverage

About

gql-sheets-demo

This is a small project to power a web-based spreadsheet application.

The backend is in Golang using gqlgen and gorm, and the frontend is in React using Apollo Client.

Features

  • GraphQL API
  • Websocket support for collaborative live updates
  • Automatic versioning & revert
  • Formula support
  • Markdown support
  • Prometheus metrics

Supported Formulas

  • =A1 reference lookup
  • =SUM(A1:A5) sum of range
  • =AVERAGE(A1:A5) average of range
  • =MAX(A1:A5) max of range
  • =MIN(A1:A5) min of range
  • =COUNT(A1:A5) count of range

Local Setup

Backend

Use go 1.20 and go mod download to fetch dependencies.

You can use docker-compose to run a local psql instance, first copy .env.example to .env and fill it out, and then run docker-compose up

You must also manually setup the postgres schema for the time being, see local/postgres/schema.sql for the DDLs to run

Finally, run go run ./server.go to bring up the server.

Frontend

See fe/README.md for more instructions on how to run the frontend.

tl;dr: cd fe && yarn && yarn start

You should run eslint before submitted a PR, yarn lint will run eslint and prettier.

Prometheus

Run local Prometheus + Grafana via docker-compose and configure it to scrape the backend service.

- job_name: app
    scrape_interval: 5s
    static_configs:
      - targets: ['host.docker.internal:8081']

(Note you should also change the docker Grafana to forward to port 3333 instead of 3000)

Gorm gives us a number of neat metrics out of the box:

Screen Shot 2023-07-05 at 5 29 12 PM

Tests

Run the following to run tests & coverage locally (for the golang backend)

$ go test -v ./... -covermode=count -coverprofile=coverage.out &&  go tool cover -func=coverage.out -o=coverage.out && cat coverage.out

Contributing

Contributions are welcome, please fork and submit a PR. Please follow the existing code style and conventions.

License

This project is licensed under the MIT License - see the LICENSE file for details

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
graph
common
@/graph/common/context.go
@/graph/common/context.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL