Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
A

avatars-api-middleware

> 编程语言
Open source

The express middleware for our avatars service

747 stars0 likes0 views
WebsiteGitHub

About

The express middleware for our avatars service

adorable-avatars

What is it?

This repository contains the express middleware that can be used to host your own avatars service!

Check out our website for more info on (and an interactive demo of) what this service does.

How do I use it?

First, you'll need the adorable-avatars package:

bash
npm install adorable-avatars --save

Then, use the router middleware within your application:

javascript
// your_server.js
import express from 'express';
import avatarsMiddleware from 'adorable-avatars';

const myApp = express();
myApp.use('/myAvatars', avatarsMiddleware);

That's it! Your server now includes the avatars endpoints!

Endpoints

Assuming your server lives at myserver.com, and you've configured the middleware as above, you now have the following endpoints:

  • myserver.com/myAvatars/:id
    • returns an avatar for the provided id.
    • id can be anything (email, username, md5 hash, as long as it's a valid URI)
    • defaults to 400px
  • myserver.com/myAvatars/:size/:id
    • returns an avatar for the provided id at the specified size
    • size cannot exceed 400px
  • myserver.com/myAvatars/face/:eyes/:nose/:mouth/:color/:size?
    • Allows you to generate a custom avatar from the specified parts and color, and size
    • e.g. myserver.com/myAvatars/face/eyes1/nose2/mouth4/DEADBF/300
  • myserver.com/myAvatars/list
    • returns JSON of all valid parts for the custom endpoint above
    • myserver.com/myAvatars/:size?/random
      • returns a random avatar, different each time
      • e.g. myserver.com/myAvatars/300/random

Development

If you're developing locally, you'll first need to bootstrap (assumes nvm):

bash
# use correct node version
nvm use

# install dependencies
npm install

Then, there are several npm scripts that will be useful:

bash
# run the unit tests
npm test

# run both a dev server and eslint
npm run dev

# run a dev server
npm run dev:server

# run eslint
npm run dev:lint

# compile the application
npm run build

Contributing

Please read the contributors' guide

Open-source Contributors

  • Kevin Altman twitter @itg github @itsthaguy: Creator of Adorable Avatars, service, site, and artwork.
  • Ryland Herrick github @rylnd: Programmer extraordinaire!
  • twitter @missingdink: Illustrated the very first avatars! Check them out!

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言