# Crafatar [](https://travis-ci.org/crafatar/crafatar/) [](https://coveralls.io/r/crafatar/crafatar) [](https://codeclimate.com/github/crafatar/crafatar)
[](https://david-dm.org/crafatar/crafatar) [](https://david-dm.org/crafatar/crafatar#info=devDependencies) [](https://inch-ci.org/github/crafatar/crafatar)
Crafatar serves Minecraft avatars based on the skin for use in external applications.
Inspired by Gravatar (hence the name) and Minotar.
Image manipulation is done by [lwip](https://github.com/EyalAr/lwip). 3D renders are created with [node-canvas](https://github.com/Automattic/node-canvas) / [cairo](http://cairographics.org/).
# Contributions welcome!
There are usually a few [open issues](https://github.com/crafatar/crafatar/issues).
We welcome any opinions or advice in discussions as well as pull requests.
Issues tagged with [](https://github.com/crafatar/crafatar/labels/help%20wanted) show where we could especially need your help!
# Examples
| | | | |
| :---: | :---: | :---: | :---: |
|  |  |  |  |  |
|  |  |  |  |  |
|  |  |  |  |  |
|  |  |  |  |  |
## Usage / Documentation
Please [visit the website](https://crafatar.com) for details.
## Contact
* You can [follow](https://twitter.com/crafatar) us on twitter
* Open an [issue](https://github.com/crafatar/crafatar/issues/) on GitHub
# Installation
## Manual
- Install [nodejs](https://nodejs.org/) 12 (LTS)
- Install `redis-server`
- Run `npm install`
If that fails, it's likely because because of `node-canvas` dependencies. Follow [this guide](https://github.com/Automattic/node-canvas/wiki#installation-guides) to install them.
- Run `npm start`
Crafatar is now available at http://0.0.0.0:3000.
## Docker
Download the docker image from [releases](https://github.com/crafatar/crafatar/releases) (docker hub coming soon™️).
```sh
docker load -i crafatar-docker.tar
mkdir /path/to/crafatar-images
```
```sh
docker network create crafatar
docker run --net crafatar -d --name redis redis
docker run --net crafatar -v /path/to/crafatar-images:/crafatar/images -e REDIS_URL=redis://redis -p 3000:3000 crafatar:2.1.0
```
## Environment variables
| Variable | Default | Description |
| :- | :- | :- |
| `BIND` | `0.0.0.0` | Hostname to listen on |
| `PORT` | `3000` | Port to listen on |
| `DEBUG` | `false` | Enable verbose debug logging |
| `REDIS_URL` | `redis://127.0.0.1:6379` | URI of the redis server |
| `EPHEMERAL_STORAGE` | | If set, redis is flushed on start* |
\* Use this to avoid issues when you have a persistent redis database but an ephemeral storage
# Tests
```sh
npm test
```
If you want to debug failing tests:
```sh
# show logs during tests
env VERBOSE_TEST=true npm test
```
It can be helpful to monitor redis commands to debug caching errors:
```sh
redis-cli monitor
```