DEV Community

Conlin Durbin
Conlin Durbin

Posted on • Updated on

Setting up a `npx username` card!

I recently saw this awesome post from bnb on Twitter:

The community response has been awesome and I quickly knew I wanted to make my own:

Today, I wanted to show everyone the process of making one.

First, let's clone the repo:

git clone
Enter fullscreen mode Exit fullscreen mode

Now, we need to edit some stuff. First, let's open up the package.json and update some of the details. First, change the package name:

name: <your username>
Enter fullscreen mode Exit fullscreen mode

This will let you publish to npm and get your card with npx <your_username>.

You can also update the description and author fields to reflect your information.

If we run npm run dev, we'll see that Tierney's information shows up. Let's make it your card.

Open up build.js:

'use strict'

// Pull in our modules
const chalk = require('chalk')
const boxen = require('boxen')
const fs = require('fs')
const path = require('path')

// Define options for Boxen
const options = {
  padding: 1,
  margin: 1,
  borderStyle: 'round'

// Text + chalk definitions
const data = {
  name: chalk.white('               Tierney Cyren'),
  handle: chalk.white('bitandbang'),
  work: chalk.white('Senior Cloud Developer Advocate at Microsoft'),
  opensource: chalk.white('Node.js Community Committee ') +''),
  twitter: chalk.gray('') + chalk.cyan('bitandbang'),
  npm: chalk.gray('') +'~bnb'),
  github: chalk.gray('') +'bnb'),
  linkedin: chalk.gray('') +'bitandbang'),
  web: chalk.cyan(''),
  npx:'npx') + ' ' + chalk.white('bitandbang'),
  labelWork: chalk.white.bold('       Work:'),
  labelOpenSource: chalk.white.bold('Open Source:'),
  labelTwitter: chalk.white.bold('    Twitter:'),
  labelnpm: chalk.white.bold('        npm:'),
  labelGitHub: chalk.white.bold('     GitHub:'),
  labelLinkedIn: chalk.white.bold('   LinkedIn:'),
  labelWeb: chalk.white.bold('        Web:'),
  labelCard: chalk.white.bold('       Card:')

// Actual strings we're going to output
const newline = '\n'
const heading = `${} / ${data.handle}`
const working = `${data.labelWork}  ${}`
const opensourcing = `${data.labelOpenSource}  ${data.opensource}`
const twittering = `${data.labelTwitter}  ${data.twitter}`
const npming = `${data.labelnpm}  ${data.npm}`
const githubing = `${data.labelGitHub}  ${data.github}`
const linkedining = `${data.labelLinkedIn}  ${data.linkedin}`
const webing = `${data.labelWeb}  ${data.web}`
const carding = `${data.labelCard}  ${data.npx}`

// Put all our output together into a single variable so we can use boxen effectively
const output = heading + // + data.handle
               newline + newline + // Add one whole blank line
               working + newline + // data.labelWork +
               opensourcing + newline + newline + // data.labelOpenSource + data.opensource
               twittering + newline + // data.labelTwitter + data.twitter
               npming + newline + // data.labelnpm + data.npm
               githubing + newline + // data.labelGitHub + data.github
               linkedining + newline + // data.labelLinkedIn + data.linkedin
               webing + newline + newline + // data.labelWeb + data.web
               carding // data.labelCard + data.npx

fs.writeFileSync(path.join(__dirname, 'bin/output'),, options)))
Enter fullscreen mode Exit fullscreen mode

Play around with the data const and add your information. For me it would look like this:

const data = {
  name: chalk.white('Conlin Durbin'),
  handle: chalk.greenBright.bold('wuz'),
  work: chalk.white('Frontend software engineer at Lessonly'),
  twitter: chalk.redBright(''),
  github: chalk.redBright(''),
  linkedin: chalk.redBright(''),
  web: chalk.redBright(''),
  npx: chalk.white('npx wuz'),
  labelWork: chalk.white.bold('      Work:'),
  labelTwitter: chalk.white.bold('   Twitter:'),
  labelGitHub: chalk.white.bold('    GitHub:'),
  labelLinkedIn: chalk.white.bold('  LinkedIn:'),
  labelWeb: chalk.white.bold('       Web:'),
  labelCard: chalk.white.bold('      Card:')
Enter fullscreen mode Exit fullscreen mode

You can play with the colors as much as you like - check out the chalk package for more options.

Once you are done, run npm run dev again. If everything looks good, we are ready to publish to NPM.

If you don't have an NPM account, go make one! Once you have you account set up, run npm login and follow the prompt to login to your account. Once that is done, go ahead and run an npm publish. Make sure your have changed the package name.

If everything is set up right, you should see a success message! Try running npx <your_username>.

Once you get it done, take a screenshot and send it to me here or on Twitter - I'd love to see it!

Top comments (22)

worie profile image
Wojciech Połowniak

Thanks for a guide how to set it up. But I'm curious - perhaps someone can answer - what's the motivation behind this? I mean this seems like a bussinecards by-developers-for-developers, but how do you guys find it useful? You use npm package XYZ, check the author, and check his/hers bussines card like this? Because I suppose companies and recruiters will still favor other media to look for developers. It's cool and all but I probably don't understand its usecase fully.

panta82 profile image

Yeah, I can't imagine HR people / recruiters typing anything in terminal as part of their workflow. Just an in-joke among developers, I guess.

bnb profile image
Tierney Cyren

Made my day. Thank you for writing this, Conlin ❤️

ben profile image
Ben Halpern

Made my day to see you show up to comment Tierney 😄

bnb profile image
Tierney Cyren


wuz profile image
Conlin Durbin

I loved the idea! Thanks for all you do for the community!

asdofindia profile image
Akshay S Dinesh

How did running random code from the internet become a fad?

lmorchard profile image
Les Orchard

Well, I mean, it's not any worse than the old curl | sh trick used for bunches of projects over the last decade or two. (Not that that trick is all that advisable, either.)

roborich5 profile image
Rich Howell

My thoughts exactly.

benenewton profile image
Ben Newton

This reminds me of cracked games on Apple //s back in the 80s. I think if you could run this at the end of a build script to show who built the package you’re using, we’re right back to the messages put in the splash screens of cracked games. This is pretty cool in that respect.

wuz profile image
Conlin Durbin

Ooh I really like this idea. You could add a npm script to package.json that just runs this. Something like npm run author which could just call npx wuz or whatever your card is. I might start doing this!

benenewton profile image
Ben Newton
nickytonline profile image
Nick Taylor • Edited

Super fun article! I saw @bnb 's tweet but hadn't got around to making mine yet. Thanks for the instructions. The only thing I'd mention is enabling 2FA for your npm account if people are new to publishing to npm.

Looking forward to your next post!

4rontender profile image
Rinat Valiullov

I made it too. Really cool! Thanks for article.

lauragift21 profile image
Gift Egwuenu

Awesome post Conlin. Now I'm going to create mine 😁

viniciuskneves profile image
Vinicius Kiatkoski Neves

Thanks! Really easy to follow and fun to play with :p

I would just suggest people to fork it to their on account and commit all the changes before publishing to NPM.

depapp profile image
depa panjie purnama

thanks @bnb @wuz

rbuitragoc profile image
Rick Buitrago

Though this could be really helpful to enrich the look and feel:

themindfuldev profile image
Tiago Romero Garcia

Thanks @wuz ! Just created mine!

natashadecoste profile image

✌️✌️ stuff like this is keeping coding cool ✌️✌️

joelgregory11 profile image
Joel Gregory

I loved the idea! Thanks for all you do for the community!