No description
  • Go 92.8%
  • Dockerfile 7.2%
Find a file
2026-10-16 16:58:30 -04:00
fonts Initial commit for figlet Cloud Run service 2026-09-14 11:28:40 -04:00
.gitignore Initial commit for figlet Cloud Run service 2026-09-14 11:28:40 -04:00
api.go add api doc 2026-10-16 16:58:30 -04:00
Dockerfile Switch to lukesampson/figlet for proper FIGlet smushing support 2026-09-14 11:39:43 -04:00
go.mod Switch to lukesampson/figlet for proper FIGlet smushing support 2026-09-14 11:39:43 -04:00
go.sum Switch to lukesampson/figlet for proper FIGlet smushing support 2026-09-14 11:39:43 -04:00
LICENSE Initial commit for figlet Cloud Run service 2026-09-14 11:28:40 -04:00
main.go add api doc 2026-10-16 16:58:30 -04:00
main_test.go Switch to lukesampson/figlet for proper FIGlet smushing support 2026-09-14 11:39:43 -04:00
mise.toml Initial commit for figlet Cloud Run service 2026-09-14 11:28:40 -04:00
README.md add api doc 2026-10-16 16:58:30 -04:00
Taskfile.yaml add api doc 2026-10-16 16:58:30 -04:00

figlet

A lightweight HTTP service that converts text strings into ASCII art banners. The service runs on Google Cloud Run and renders text using lukesampson/figlet with full FIGlet smushing and kerning rules across embedded FIGlet fonts.

A live instance is available at https://figlet.proto-hype.net.

API Usage

Send an HTTP GET request to the root endpoint (/) or pass the target string in the URL path. Responses return plain text with Content-Type: text/plain; charset=utf-8.

An HTTP OPTIONS request to / returns API usage documentation with Allow: GET, OPTIONS.

Query Parameters

Parameter Type Default Description
text (or t) string figlet Input text to render into ASCII art. Maximum allowed length is 64 characters.
font (or f) string slant FIGlet font used for rendering. Available options: slant, standard, shadow, small, smslant, block.

Included Fonts

The service embeds the following FIGlet fonts:

  • slant (default): Slanted letters with diagonal strokes and standard smushing.
  • standard: The classic full-size FIGlet font.
  • shadow: Glyphs styled with drop shadows.
  • small: Compact letters suitable for longer strings.
  • smslant: Compact slanted font.
  • block: Bold, rectangular block letters.

Query GET /fonts to view the list of available fonts directly from the service.

Query GET /api to view API documentation and accepted options directly from the service.

Examples

Render default text using the primary slant font:

curl -s https://figlet.proto-hype.net

Example response:

    _____       __     __ 
   / __(_)___ _/ /__  / /_
  / /_/ / __ `/ / _ \/ __/
 / __/ / /_/ / /  __/ /_  
/_/ /_/\__, /_/\___/\__/  
      /____/              

Render custom text via the text query parameter:

curl -s "https://figlet.proto-hype.net?text=Hello"

Example response:

    __  __     ____    
   / / / /__  / / /___ 
  / /_/ / _ \/ / / __ \
 / __  /  __/ / / /_/ /
/_/ /_/\___/_/_/\____/ 
                       

Render custom text directly via the URL path:

curl -s https://figlet.proto-hype.net/CloudRun

Example response:

   ________                ______            
  / ____/ /___  __  ______/ / __ \__  ______ 
 / /   / / __ \/ / / / __  / /_/ / / / / __ \
/ /___/ / /_/ / /_/ / /_/ / _, _/ /_/ / / / /
\____/_/\____/\__,_/\__,_/_/ |_|\__,_/_/ /_/ 
                                             

Select an alternative font using the font parameter:

curl -s "https://figlet.proto-hype.net?text=Go&font=block"

Example response:

                    
  _|_|_|            
_|          _|_|    
_|  _|_|  _|    _|  
_|    _|  _|    _|  
  _|_|_|    _|_|    
                    
                    

List available fonts:

curl -s https://figlet.proto-hype.net/fonts

Example response:

Available fonts:
- block
- shadow
- slant (default)
- small
- smslant
- standard

Display API documentation:

curl -s https://figlet.proto-hype.net/api
# or
curl -s -X OPTIONS https://figlet.proto-hype.net/

Example response:

FIGlet HTTP API

Endpoints:
  GET /                    Render ASCII art banner (default text: "figlet")
  GET /<text>              Render ASCII art banner for <text> in path
  GET /fonts               List available fonts
  GET /api                 Display this API documentation

Query Parameters:
  text, t                  Input text to render (default: "figlet", max length: 64 characters)
  font, f                  FIGlet font name (default: "slant", case-insensitive)

Available Fonts:
  block, shadow, slant (default), small, smslant, standard

Examples:
  curl https://figlet.proto-hype.net/
  curl https://figlet.proto-hype.net/HelloWorld
  curl "https://figlet.proto-hype.net/?text=Hello&font=standard"
  curl https://figlet.proto-hype.net/fonts
  curl https://figlet.proto-hype.net/api

Errors

  • 400 Bad Request (text exceeds maximum length of 64 characters): Returned when input text length exceeds 64 characters.
  • 400 Bad Request (unknown font "<name>". Available fonts: ...): Returned when an unsupported font name is provided.

Local Development

Prerequisites:

  • Go 1.25 or newer (can be managed with mise)
  • Docker (optional, for container builds)
  • Task (optional, for task automation)

Tooling Setup with mise

Install required CLI tools defined in mise.toml:

mise install

Running Locally

Run the server with the Go toolchain:

go run .

The server binds to port 8080 by default. Override the port using the PORT environment variable:

PORT=9090 go run .

Running Tests

Execute unit tests covering font loading, smushing, parameter handling, and length limits:

go test -v ./...

Building the Container

Build the container image using the multi-stage Dockerfile:

docker build -t figlet .
docker run -p 8080:8080 figlet

Deployment

The project configures deployment to Google Cloud Run via Taskfile.yaml.

Configuration

Create a .env file in the project root with target Google Cloud parameters:

PROJECT_ID=your-gcp-project-id
REGION=us-east4
DOMAIN=proto-hype.net

Available Tasks

Run task --list to view all defined commands:

  • task login: Authenticates Google Cloud CLI (gcloud) and configures default project and compute regions.
  • task setup: Enables the required Google Cloud APIs (run.googleapis.com, cloudbuild.googleapis.com, artifactregistry.googleapis.com).
  • task deploy: Builds the source code with Google Cloud Build and deploys an unauthenticated Cloud Run service.
  • task map-domain: Creates a custom domain mapping for <SERVICE_NAME>.<DOMAIN>.
  • task logs: Streams real-time service logs from Cloud Run.
  • task test: Executes test requests against the mapped domain endpoint.

License

This project is licensed under the MIT License. See LICENSE for details.