Pepic is a small app that helps me to upload, store, convert and serve pictures or videos on your server.

I use it as media proxy for my pet-projects and on my blog. Pepic can convert, resize and optimize media files in-flight to save you monies and bandwidth. Internally it uses ffmpeg for videos and vips for images, which means it's quite fast and supports JPG, PNG, GIF, WEBP, SVG, HEIF, TIFF and wide range of video formats.

It's not meant to be used by anyone else except me. Use it only if you're brave. Scroll down this README for better alternatives.

πŸ€– How to run it locally

This command starts a local server on localhost:8118. Useful for development.

go run main.go serve --config ./etc/pepic/config.yml

⚠️ If you're getting invalid flag in pkg-config error, run export CGO_CFLAGS_ALLOW="-Xpreprocessor" in advance

🐳 Running in Docker

  1. Get Docker

  2. Clone the repo

git clone
cd pepic
  1. Build and run the app
docker build .
docker run -p 8118:8118 -v ${PWD}/uploads:/app/uploads $(docker build -q .)
  1. Go to http://localhost:8118 and try uploading something. You should see uploaded images or videos in the data directory (./uploads) after that.

  2. Try to resize an image by adding a number of pixels to its URL. For example: https://localhost:8118/file.jpg -> https://localhost:8118/500/file.jpg

  3. Check out the etc/pepic/config.yml file. Some stuff is turned off by default. You can tweak them for yourself and rebuild the docker again (step 3) to apply them.

🚒 Production Usage

⚠️ If you plan to host anything bigger than a blog, always put it behind CDN. CloudFlare offers a free one if you don't hate big corporations :D

Let's say, you want to host it on

1. Modify config/config.yml to your taste
  port: 8118  # internal host and port, leave it as it is
  base_url: ""
  secret_code: "secretpass"
  max_upload_size: "500M"
2. Build and run production docker

Don't forget to mount upload volume to store files on host (or you can lose those files when container will be killed).

docker run -p 8118:8118 -v /host/dir/uploads:/app/uploads $(docker build -q .)

If you prefer docker-compose, you can use it too. Check out the included docker-compose.example.yml. You can easily transform it into your favourite k8s config or whatever is fashionable this summer.

πŸ‘ Don't forger to periodically backup the /host/dir/uploads directory just in case :)

3. Use nginx or your other favourite proxy

Just proxy all calls from the domain ( to pepic backend ( It can handle static files too.

server {
    listen 80;

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;

😍 Contributions

Contributions are welcome.

Open an Issue if you want to report a bug and propose an idea.

βœ… TODO

  • Tests :D
  • Upload by URL
  • Crop, rotate and other useful transformations (face blur? pre-loader generator?)
  • Live conversion by changing file's extension
  • Set format and quality during the upload (using GET/POST params?)

πŸ€” Alternatives

After reading all this, you probably realized how bad it is and looking for other alternatives. Here's my recommendations:

πŸ‘©β€πŸ’Ό License

It's MIT.

Contact me if you have any questions β€”


Expand β–Ύ Collapse β–΄


The Go Gopher

There is no documentation for this package.

Source Files