npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jrstnly/ccb

v0.12.0

Published

A Node.js library for accessing the Church Community Builder v2 API

Readme

Node CCB library

NodeJS library for accessing the Church Community Builder v2 API

CCB v2 API Documentation

This library is currently in an alpha state and should be carefully tested and not actively updated in production. Updates may and likely will introduce breaking changes. This library will be updated as needed for my projects or as time allows. Pull requests are welcome if certain required features are missing.

Getting started

Initialize and Connect

The connect() method will return a promise that resolves with {type:'success'} on successful connection or {type:'redirect',data:'URLToRedirectTo'} if a client authorization code is required. After redirection back to the application, the authorization code can be updated using the updateAuthorizationCode() method. If you already have an authorization code, it can also be passed into the connect function directly using the code key in the connect parameters object.

In order to remain deployment agnostic, getting and saving the auth token data is left up to the user through the dataGetter and dataSetter parameters. In the sample I am using lowdb but any simple object store should work.

const dataGetter = (): AuthData => {
	return db.data || defaultAuthData;
}
const dataSetter = async (data: AuthData) => {
	db.data = data;
	await db.write();
}

try {
	await db.read()
	db.data ||= defaultAuthData;

	const ccb = new CCB();
	const connection = await ccb.connect({
		church:process.env.CCB_CHURCH || '',
		client:process.env.CCB_CLIENT || '',
		secret:process.env.CCB_SECRET || '',
		redirectUri: process.env.CCB_REDIRECT_URI || '',
		dataGetter:dataGetter,
		dataSetter:dataSetter
	});
} catch(e) {
	console.log(e);
}

Full Sample Code

Methods

Initialization

connect(options: Config): Promise<Response>

Attempts to connect to the CCB API and returns a promise that resolves with {type:'success'} on successful connection or {type:'redirect',data:'URLToRedirectTo'} if a client authorization code is required.

const connection = await ccb.connect({
	church:process.env.CCB_CHURCH || '',
	client:process.env.CCB_CLIENT || '',
	secret:process.env.CCB_SECRET || '',
	redirectUri: process.env.CCB_REDIRECT_URI || '',
	dataGetter:dataGetter,
	dataSetter:dataSetter
});

Authorization

updateAuthorizationCode(code: string): Response

Updates and saves the client authorization code into the library and database for generating auth tokens.

ccb.updateAuthorizationCode(process.env.CCB_CODE || '');

Individual

individual(id: string | number).get(): Promise<individual>

Returns a promise that resolves with the data of the individual requested.

const individual = await ccb.individual('1').get();
individual(id: string | number).updatePhoto(image: string | Readable): Promise<individual>

Returns a promise that resolves with the data of the individual that was updated.

const individual = await ccb.individual('1').updatePhoto('https://path.to/new/image.jpg');

Individuals

individuals.get(params:Record<string, string>): Promise<individuals>

Returns a promise that resolves with a paginated list of the search results or a paginated list of all individuals if no parameters passed.

const individual = await ccb.individuals.get({name: 'Partial Name'});
individuals.add(individual:Record<string, string>): Promise<individual>

Returns a promise that resolves with the data of the individual that was created.

const individual = await ccb.individuals.add({
	first_name: "Test",
	last_name: "Individual",
});

Family

family(id: string | number).get(): Promise<family>

Returns a promise that resolves with the data of the family requested.

const family = await ccb.family('1').get();
family(id: string | number).addMember(individual:Record<string, string>): Promise<individual>

Returns a promise that resolves with the data of the individual that was created.

const individual = await ccb.family('1').addMember({
	first_name: "Test",
	last_name: "Child",
	family_position: "CHILD"
});

Types

Config

	{
		church: 'village', // CCB subdomain of your church. Required.
		client: '5a69aef2...', // CCB API UID from when you signed up for APIv2 access. Required.
		secret: 'e5c3cc06...', // CCB API Secret from when you signed up for APIv2 access. Required.
		code: 'e9fa51ea...', // Client authorization code received after completion of the first OAuth step. Not required if redirectURI parameter is set.
		redirectURI: 'https://example.net/oauth/redirect/', //Your redirect url provided to CCB when you signed up for APIv2 access. Not required if code parameter is set.
		dataGetter: () => { return data; }, // Function to retrieve auth data from storage. Can return promise that resolves with AuthData or AuthData directly. Required.
		dataSetter: (data) => { storage.write(data) } // Function to save AuthData to storage. Can return a promise for synchronous writes. Required.
	}

Response

	{
		type: 'success', // Can be 'success', 'error', or 'redirect'.
		data: {}, // Response data from function. Can be any data type.
		msg: 'An error occurred.', // Optional message included in response. Usually only set when type is 'error'.
	}