A simple API which combines projects from a multiple sources into it's own streamlined interface. Built with go. https://hub.docker.com/r/michivonah/projects-api
  • Go 97.2%
  • Dockerfile 2.8%
Find a file
michi.vonah c443457a61
All checks were successful
/ build (push) Successful in 1m37s
/ deploy (push) Successful in 3s
docs: add most important stuff to README
2026-06-28 14:49:45 +02:00
.forgejo/workflows build: use full-qualified action name for Bunny 2026-06-24 21:40:14 +02:00
internal refactor(config): split LoadConfig() into two funcs 2026-06-28 13:02:04 +02:00
.gitignore Initial commit 2026-05-19 20:49:50 +02:00
Dockerfile build: optimize Dockerfile for cross-compilation 2026-06-21 19:01:12 +02:00
go.mod refactor(packages): remove unused go packages from go.mod and go.sum 2026-06-04 09:01:46 +02:00
go.sum refactor(packages): remove unused go packages from go.mod and go.sum 2026-06-04 09:01:46 +02:00
main.go fix(config): always load config 2026-06-28 12:55:56 +02:00
README.md docs: add most important stuff to README 2026-06-28 14:49:45 +02:00

projects-api

projects-api thumbnail

A simple API which combines projects from a Ghost Blog, a YouTube Playlist and a generic JSON file into it's own streamlined interface. Built with go.

Features

  • Built with go for efficiency & simplicity
  • Runs in a container of just 9 MiB size
  • Combines multiple API outputs into one (Ghost, YouTube & generic JSON)
  • 0 external dependencies, just the go standard library

Available API integrations

  • Ghost Content API
  • YouTube Data API v3
  • Generic JSON URL (example format seen below)

Generic JSON URL Format

  • The URL specified for the generic JSON URL should return projects using this pattern/format:
[
    {
        "url": "https://example.com",
        "image": "https://example.com/some-image.webp",
        "title": "Some project title",
        "date": "2024-11-03T00:00:00Z",
        "category": "some-category",
        "icon": "some-icon-name"
    },
    {
        "url": "https://example.com",
        "image": "https://example.com/some-image.webp",
        "title": "Some project title",
        "date": "2024-11-03T00:00:00Z",
        "category": "some-category",
        "icon": "some-icon-name"
    },
    {
        "url": "https://example.com",
        "image": "https://example.com/some-image.webp",
        "title": "Some project title",
        "date": "2024-11-03T00:00:00Z",
        "category": "some-category",
        "icon": "some-icon-name"
    }
]

Configuration

  • The appliaction can be configured via env vars or an .env file in the execution directory
  • The follwing parameters are available
Parameter Default value Definition Example
ALLOWED_ORIGINS "" Defines which URLs should be returned in the HTTP Header Access-Control-Allow-Origin; comma-separated-values alllowed http://localhost,http://localhost:1313,http://localhost:8080
 GHOST_API_KEY ""  API Key for calling the Ghost Content API 0cc92e62dba94b8c4c70774bfb
 GHOST_API_URL ""  Location of your Ghost Content API https://ghost.example.com/ghost/api
GHOST_ALLOWED_AUTHORS ""  Defines the authors which posts are returned by the API (like a filter), comma-separated-values alllowed 02cd090d7cab08ac8e43e065eb
YOUTUBE_API_KEY ""  Your API Key for accessing the YouTube Data API v3 (get key here) AIXXXXXXXXXXXXXXXXXXXXXXXXX_YYYYYYYYYYY 
YOUTUBE_PLAYLIST_ID ""  The ID of the YouTube Playlist which is fetched via the YouTube Data API v3 PL94KYRU3UMF_eA-59jLSb9yBBie9JB819
GENERIC_JSON_URL "" A URL to a JSON file (format as seen above) https://example.com/projects.json
  • If you want to use one of the available API integrations, you have to pass all related env vars for this service. It's possible to skip entire services be leaving it's variables empty.
  • For example you can disable the Ghost API by leaving GHOST_API_KEY, GHOST_API_URL and/or GHOST_ALLOWED_AUTHORS empty. The call's to the Ghost API only are enabled if all of those three variables are defined. The same principal applies to the YouTube & JSON API.

Build

To build the software yourself you need go installed on your system.

Then build like this:

go build -o projects-api .

And run it locally:

projects-api

Deploy yourself via Docker/Podman/OCI

By passing variables

docker run --rm -p 8080:8080 --env ALLOWED_ORIGINS=http://localhost,http://localhost:8080 --env GENERIC_JSON_URL=https://example.com/projects.json -d docker.io/michivonah/projects-api:dev

Docker compose:

services:
    projects-api:
        ports:
            - 8080:8080
        environment:
            - ALLOWED_ORIGINS=http://localhost,http://localhost:8080
            - GENERIC_JSON_URL=https://example.com/projects.json
        image: docker.io/michivonah/projects-api:dev

With env file

docker run --rm -p 8080:8080 -v ./.env:/app/.env -d projects-api