
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
apollo-couchbase
Advanced tools
A framework for building an Apollo GraphQL API backed by Couchbase.
A framework for building GraphQL APIs with the Apollo GraphQL server backed by Couchbase.
The main inspiration for this framework is Ruby On Rails which was a game-changer when it came. But, Ruby On Rails has five huge sub-optimalities that
Apollo On The Couch aims to fix:
With Apollo On The Couch you get all of the benefits with the Ruby On Rails approach and all of the above mentioned sub-optimalities fixed out-of-the-box with amazing developer and devops experience all the way from startup to millions of operations per second.
Apollo On The Couch
Server Projectnpx create-apollo-couchbase-server@latest my-server
Set the username and password of your Couchbase user.
COUCHBASE_USER=username
COUCHBASE_PASSWORD=password
Choose if you'd like to activate access control and if you want to require a JWT token to be sent as an authorization header in all requests.
AUTH=true
AUTH_ALL=false
AUTH_TOKEN_ISSUER=https://<Your Identity Provider>
AUTH_TOKEN_AUDIENCE=<Your client id>
In apollo-couchbase
, the GraphQL schema and resolvers are structured in units called resources
. A resource will typically be similar to a REST resource, with CrUD operations, but it can really be whatever kind of group of functions that makes sense for your purposes.
If you want your resource to be similar to a typical REST resource you can use the scaffolding script, generate-resource
, to generate a new resource. This script will generate resources with scaffold resolvers and schema files that you can edit to fit your purposes. You can also choose to create your resources manually if you want a different structure.
To create a resource using the scaffolding script, follow these steps:
npm run generate-resource <resourceNameInPlural>
E.g
npm run generate-resource products
The new resource files are located at /src/graphql/resources/<resourceNameInPlural>
. With directories for the resolvers and a schema file called schema.graphql.
Specify the properties you want to expose on the resource.
E.g.
type ProductContent {
name: String!
price: Float
quantity: Int
tags: [String!]
}
input ProductContentInput {
name: String!
price: Float
quantity: Int
tags: [String!]
}
input ProductContentPatchInput {
name: String
price: Float
quantity: Int
tags: [String!]
}
input ProductsListFiltersInput {
name: String
}
Notice that there is no exclamation mark in the ProductContentPatchInput
input, since you probably don't want to require any field to be included when patching records.
This script with create a collection in Couchbase if it didn't already exist and a primary index on that collection.
After editing a schema file you need to run the generate-graphql-types script to update the Typescript types:
npm run generate-graphql-types
Now, you are ready to start the server.
npm run dev
This project is licensed under the ISC License. See the LICENSE file for details.
FAQs
A framework for building an Apollo GraphQL API backed by Couchbase.
The npm package apollo-couchbase receives a total of 0 weekly downloads. As such, apollo-couchbase popularity was classified as not popular.
We found that apollo-couchbase demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.