Skip to content

l4u532/openbeta-graphql

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build License

All Contributors

Climbing Route Catalog API

What is this?

OpenBeta Graph API allows other applications to access the OpenBeta climbing database using any standard GraphQL clients.

Endpoint:

We recommend using an online playground to explore the API.

Learn more about GraphQL

Example query

Get all sub-areas at Smith Rock

query Example1 {
  areas(filter: {area_name: {match: "Smith Rock"}}) {
    area_name
    children {
      area_name
      metadata {
        lat
        lng
      }
    }
  }
}

# Result
{
  "data": {
    "areas": [
      {
        "area_name": "Smith Rock",
        "children": [
          {
            "area_name": "Aggro Gully",
            "metadata": {
              "lat": 44.36724,
              "lng": -121.14238
            }
          },
          {
            "area_name": "Angel Flight Crags",
            "metadata": {
              "lat": 44.5672,
              "lng": -122.1269
            }
          },
       ...
        ]
      }
    ]
  }
}

Development

Requirements:

  1. Add '127.0.0.1 mongodb' entry to your /etc/hosts file (or C:\Windows\System32\drivers\etc\hosts on Windows)
127.0.0.1       mongodb
  1. Launch mongodb dev stack: database server and mongo-express (web-based admin console for mongo):
docker compose up -d
  1. Seed your local database with data from staging environment
yarn install
yarn seed-db   # May take a few minutes to download a large database file
  1. Start the GraphQL server
yarn serve

Navigating the codebase

These links explain the structure and key abstractions of our codebase. It's a good place to start before you go spelunking in the code.

Troubleshooting

  • Fix "permissions on /opt/keyfile/keyfile are too open" error This error appears because the keyfile is required to be read-only

    chmod 400 keyfile
  • Fix "error opening file: /opt/keyfile/keyfile: bad file" error This may appear after you update the keyfile to read-only access. The file needs to be owned by the same owner of the mongodb process

    chown 999:999 keyfile

Tips

  • Browse the database: http://localhost:8081

  • GraphQL online playground: https://graphiql-online.com/

  • Bypassing auth when developing locally

    Start up your local server with yarn serve-dev (instead of yarn serve)

    # Run this in open-tacos project
    yarn serve-dev

    This allows the current user to run any Query or Mutation (irrespective of the current user’s UUID)

    (How it works: auth/middleware.ts and auth/permissions.ts are conditionally swapped out on server initialization (server.ts), based on whether the env var LOCAL_DEV_BYPASS_AUTH is set)

  • Full stack development

    Connect your frontend dev env to this local server

    # Run this in open-tacos project
    yarn dev-local
  • Make sure to include .js when importing other files:

    ...
    import { getClimbModel } from '../db/ClimbSchema.js'  // .js is required
    ...

    Why? See this issue for an explanation.

  • MongoDB playground: https://mongoplayground.net/

Questions?

This project is under active development. Join us on Discord!

License

The source code is licensed under the Affero GPL v3.0 license.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Kendra Gibbons
Kendra Gibbons

💻 🤔
Paul Phillips
Paul Phillips

🤔
admanny
admanny

💻
Colin Gale
Colin Gale

💻 🤔
Brendan Downing
Brendan Downing

💻 🤔
Darren Lew
Darren Lew

🤔 💻
Sundev
Sundev

💻 🤔
Siman Shrestha
Siman Shrestha

💻 🤔
Silthus
Silthus

🤔 💻
Bradley Lignoski
Bradley Lignoski

💻 🤔
zkao
zkao

💻 🤔
Nathan Musoke
Nathan Musoke

💻 🤔
Bill Huang
Bill Huang

💻
Klaus
Klaus

💻 🤔
Iacami Gevaerd
Iacami Gevaerd

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

About

The open source rock climbing API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 98.4%
  • Other 1.6%