Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/remorses/mongoke
https://github.com/remorses/mongoke
cloud containers database docker docker-compose existing-databases generated graphql jwt kubernetes microservice mongodb mongodb-database schema serverless
Last synced: 2 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/remorses/mongoke
- Owner: remorses
- Archived: true
- Created: 2019-08-25T10:19:46.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-07T12:55:48.000Z (over 4 years ago)
- Last Synced: 2024-05-02T02:10:41.387Z (9 months ago)
- Topics: cloud, containers, database, docker, docker-compose, existing-databases, generated, graphql, jwt, kubernetes, microservice, mongodb, mongodb-database, schema, serverless
- Language: Python
- Homepage: https://mongoke.now.sh/docs/
- Size: 6.43 MB
- Stars: 216
- Watchers: 5
- Forks: 12
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
mongoke
Instantly serve your MongoDb database via graphql
[**Docs**](https://mongoke.now.sh/docs/) • [**Examples**](https://github.com/remorses/mongoke/tree/master/examples)
## Features
- **Powerful Queries**: Pagination, filtering, relation, relay-style connections built-in and generated in a bunch of seconds
- **Works with existing databases**: Point it to an existing MongoDb database to instantly get a ready-to-use GraphQL API
- **Authorization via Jwt**: Every collection can be protected based on jwt payload and document fields
- **Horizontally Scalable**: The service is completely stateless and can be replicated on demand
- **Apollo Federation**: The service can be easily glued with other graphql servers to handle writes and more complicated logic.
- **Resilient Idempotent Configuration**: One YAML Configuration as the only source of truth, relations, authorization and types in one file## Quickstart:
## Using Docker compose
The fastest way to try Mongoke is via docker-compose.
### 1. Write the configuration to describe the database schema and relations
The ObjectId scalar is already defined by default, it is converted to string when sent as json
```yml
# ./mongoke.yml
schema: |
type User {
_id: ObjectId
username: String
email: String
}
type BlogPost {
_id: ObjectId
author_id: ObjectId
title: String
content: String
}types:
User:
collection: users
BlogPost:
collection: postsrelations:
- field: posts
from: User
to: BlogPost
relation_type: to_many
where:
author_id: ${{ parent['_id'] }}
```### 2. Run the `mongoke` image with the above configuration
To start the container mount copy paste the following content in a `docker-compose.yml` file, then execute `docker-compose up`.
```yml
# docker-compose.yml
version: '3'services:
mongoke:
ports:
- 4000:80
image: mongoke/mongoke
environment:
DB_URL: mongodb://mongo/db
volumes:
- ./mongoke.yml:/conf.yml
mongo:
image: mongo
```### 3. Query the generated service via graphql or go to [http://localhost:4000/graphiql](http://localhost:4000/graphiql) to open graphiql
```graphql
{
User(where: { username: { eq: "Mike" } }) {
_id
username
posts {
nodes {
title
}
}
}BlogPostNodes(first: 10, after: "Post 1", cursorField: title) {
nodes {
title
content
}
pageInfo {
endCursor
hasNextPage
}
}
}
```---
## Tutorials
Check out the /examples directory in this repo
Please help the project making new tutorials and submit a issue to list it here!