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 🙏

© 2024 – Pkg Stats / Ryan Hefner

buzzfont

v1.0.1

Published

Your Own Powerful Google Fonts API

Downloads

3

Readme

BuzzFont

Make your own Google Fonts API with some extra features

  • Search by any font quality.
  • Get PNG previews of each font.
  • Generate server side renders of the any text with any font.
  • Automitically updated once a day.
  • Server Agnostic

Examples

  • Get all serif fonts, ordered by popularity.
http://localhost:3000/types?name=serif&orderBy=popularity&dir=desc
  • Search for a specific font by name.
http://localhost:3000/search?name=roboto
  • Get all fonts, alphabetically ordered.
http://localhost:3000/search?orderBy=family&dir=asc

Quick Start

1. Clone this repository:

git clone https://github.com/ClickSimply/buzzfont.git

2. NPM Install

cd buzzfeed && npm i

3. Update Server Details

Open the sample-server.js file and upate the details at the top.

const PORT = 3000;
const PUBLIC_URL = `http://localhost:${PORT}`;
const APIKEY = "YOUR GOOGLE KEY HERE";

4. Run Server

node sample-server.js

The script will generate preview URLs for every font available (over 800), then will start the express server. The example queries above will work from here.

Roll Your Own

The library itself doesn't have any expressJS or other server code. It just handles the indexing of the fonts and other cool stuff.

You can easily embed the library in your own project. The "sample-server.js" file shows a full working example of the script working with express, a smaller example is below.

1. Install BuzzFont

npm i buzzfont --save

2. Integrate With Your App

const BuzzFont = require("buzzfont").BuzzFont;
const express = require("express");
const http = require("http");

const PORT = 3000;
const PUBLIC_URL = `http://localhost:${PORT}`;
const APIKEY = "YOUR GOOGLE KEY HERE";

const fontDB = new BuzzFont({
    apiKey: APIKEY,
    baseURL: PUBLIC_URL,
    ready: () => {
        const app = express();

        // Serve the preview images
        app.use("/previews", express.static("./previews"));

        // Once initilized, the library exposes fontDB.nSQL() as a nanoSQL store containing the fonts
        // Read about how to use nanosql here https://github.com/ClickSimply/Nano-SQL/wiki/2.-Query

        // Handle queries with nanosql
        app.get("/search", (req, res) => { 

            fontDB.nSQL()
                .query("select")
                .where(["family", "LIKE", req.query.name])
                .exec().then((rows) => {
                    res.send(rows).end();
                });

        });

        // Run Server
        http.createServer(app).listen(PORT, () => {
            console.log("Server listening on %d", PORT);
        });
    }
});