Package frameproto provides tools for the Frame Protocol — which is also known as Farcaster Frames, for the Go programming language.
Go to file
Charles Iliya Krempeaux 4e3706a076 frameproto.ActionBody (for the data that is POSTed it) 2024-02-24 15:55:18 -08:00
LICENSE initial commits 2024-02-13 06:39:30 -08:00
README.md initial commits 2024-02-15 09:14:49 -08:00
actionbody.go frameproto.ActionBody (for the data that is POSTed it) 2024-02-24 15:55:18 -08:00
actionbody_test.go frameproto.ActionBody (for the data that is POSTed it) 2024-02-24 14:06:09 -08:00
appendframe.go initial commits 2024-02-14 15:39:14 -08:00
appendframe_test.go initial commits 2024-02-14 15:39:14 -08:00
appendframebutton1.go initial commits 2024-02-15 06:38:13 -08:00
appendframebutton1_test.go initial commits 2024-02-15 06:38:13 -08:00
appendframebutton1action.go initial commits 2024-02-15 08:46:46 -08:00
appendframebutton1action_test.go initial commits 2024-02-15 07:18:41 -08:00
appendframebutton1target.go initial commits 2024-02-15 08:33:53 -08:00
appendframebutton1target_test.go initial commits 2024-02-15 08:33:53 -08:00
appendframebutton2.go initial commits 2024-02-15 06:38:13 -08:00
appendframebutton2_test.go initial commits 2024-02-15 06:38:13 -08:00
appendframebutton2action.go initial commits 2024-02-15 08:46:46 -08:00
appendframebutton2action_test.go initial commits 2024-02-15 07:18:41 -08:00
appendframebutton2target.go initial commits 2024-02-15 08:33:53 -08:00
appendframebutton2target_test.go initial commits 2024-02-15 08:33:53 -08:00
appendframebutton3.go initial commits 2024-02-15 06:38:13 -08:00
appendframebutton3_test.go initial commits 2024-02-15 06:38:13 -08:00
appendframebutton3action.go initial commits 2024-02-15 08:46:46 -08:00
appendframebutton3action_test.go initial commits 2024-02-15 07:18:41 -08:00
appendframebutton3target.go initial commits 2024-02-15 08:33:53 -08:00
appendframebutton3target_test.go initial commits 2024-02-15 08:33:53 -08:00
appendframebutton4.go initial commits 2024-02-15 06:38:13 -08:00
appendframebutton4_test.go initial commits 2024-02-15 06:38:13 -08:00
appendframebutton4action.go initial commits 2024-02-15 08:46:46 -08:00
appendframebutton4action_test.go initial commits 2024-02-15 07:18:41 -08:00
appendframebutton4target.go initial commits 2024-02-15 08:33:53 -08:00
appendframebutton4target_test.go initial commits 2024-02-15 08:33:53 -08:00
appendframeimage.go initial commits 2024-02-14 16:27:07 -08:00
appendframeimage_test.go initial commits 2024-02-14 16:32:48 -08:00
appendframeimageaspectratio.go initial commits 2024-02-15 05:43:18 -08:00
appendframeimageaspectratio_test.go initial commits 2024-02-15 05:43:18 -08:00
appendframeinputtext.go initial commits 2024-02-14 16:29:57 -08:00
appendframeinputtext_test.go initial commits 2024-02-14 16:29:57 -08:00
appendframeposturl.go initial commits 2024-02-14 15:58:51 -08:00
appendframeposturl_test.go initial commits 2024-02-14 16:37:13 -08:00
appendmetapropertycontent.go initial commits 2024-02-15 09:05:53 -08:00
aspectratios.go initial commits 2024-02-15 09:03:28 -08:00
buffersize.go initial commits 2024-02-13 08:48:30 -08:00
buttonactions.go initial commits 2024-02-15 09:10:09 -08:00
errors.go initial commits 2024-02-15 09:43:14 -08:00
framewriter.go initial commits 2024-02-15 09:43:14 -08:00
framewriter_internal.go initial commits 2024-02-15 09:47:09 -08:00
go.mod go.mod and go.sum 2024-02-24 14:10:23 -08:00
go.sum go.mod and go.sum 2024-02-24 14:10:23 -08:00
metaproperties.go initial commits 2024-02-15 09:05:17 -08:00
stringframe.go initial commits 2024-02-15 04:49:04 -08:00
stringframe_test.go initial commits 2024-02-15 04:49:04 -08:00
stringframebutton1.go initial commits 2024-02-15 05:55:17 -08:00
stringframebutton1_test.go initial commits 2024-02-15 05:55:17 -08:00
stringframebutton1action.go initial commits 2024-02-15 08:43:52 -08:00
stringframebutton1action_test.go initial commits 2024-02-15 06:02:52 -08:00
stringframebutton1target.go initial commits 2024-02-15 06:20:17 -08:00
stringframebutton1target_test.go initial commits 2024-02-15 06:20:17 -08:00
stringframebutton2.go initial commits 2024-02-15 05:55:17 -08:00
stringframebutton2_test.go initial commits 2024-02-15 05:55:17 -08:00
stringframebutton2action.go initial commits 2024-02-15 08:43:52 -08:00
stringframebutton2action_test.go initial commits 2024-02-15 06:02:52 -08:00
stringframebutton2target.go initial commits 2024-02-15 06:20:17 -08:00
stringframebutton2target_test.go initial commits 2024-02-15 06:20:17 -08:00
stringframebutton3.go initial commits 2024-02-15 05:55:17 -08:00
stringframebutton3_test.go initial commits 2024-02-15 05:55:17 -08:00
stringframebutton3action.go initial commits 2024-02-15 08:43:52 -08:00
stringframebutton3action_test.go initial commits 2024-02-15 06:02:52 -08:00
stringframebutton3target.go initial commits 2024-02-15 06:20:17 -08:00
stringframebutton3target_test.go initial commits 2024-02-15 06:20:17 -08:00
stringframebutton4.go initial commits 2024-02-15 05:55:17 -08:00
stringframebutton4_test.go initial commits 2024-02-15 05:55:17 -08:00
stringframebutton4action.go initial commits 2024-02-15 08:43:52 -08:00
stringframebutton4action_test.go initial commits 2024-02-15 06:02:52 -08:00
stringframebutton4target.go initial commits 2024-02-15 06:20:17 -08:00
stringframebutton4target_test.go initial commits 2024-02-15 06:20:17 -08:00
stringframeimage.go initial commits 2024-02-15 05:00:36 -08:00
stringframeimage_test.go initial commits 2024-02-15 05:00:36 -08:00
stringframeimageaspectratio.go initial commits 2024-02-15 04:55:39 -08:00
stringframeimageaspectratio_test.go initial commits 2024-02-15 04:55:39 -08:00
stringframeinputtext.go initial commits 2024-02-15 05:12:31 -08:00
stringframeinputtext_test.go initial commits 2024-02-15 05:12:31 -08:00
stringframeposturl.go initial commits 2024-02-15 05:08:45 -08:00
stringframeposturl_test.go initial commits 2024-02-15 05:08:45 -08:00
stringmetapropertycontent.go initial commits 2024-02-15 04:47:11 -08:00
stringmetapropertycontent_test.go initial commits 2024-02-15 04:47:11 -08:00
versions.go initial commits 2024-02-13 18:56:08 -08:00
writeframe.go initial commits 2024-02-15 09:43:14 -08:00
writeframe_test.go initial commits 2024-02-13 18:56:08 -08:00
writeframebutton1.go initial commits 2024-02-15 09:43:14 -08:00
writeframebutton1_test.go initial commits 2024-02-13 11:13:05 -08:00
writeframebutton1action.go initial commits 2024-02-15 09:43:14 -08:00
writeframebutton1action_test.go initial commits 2024-02-13 18:35:55 -08:00
writeframebutton1target.go initial commits 2024-02-15 09:43:14 -08:00
writeframebutton1target_test.go initial commits 2024-02-13 15:19:32 -08:00
writeframebutton2.go initial commits 2024-02-15 09:43:14 -08:00
writeframebutton2_test.go initial commits 2024-02-13 11:14:34 -08:00
writeframebutton2action.go initial commits 2024-02-15 09:43:14 -08:00
writeframebutton2action_test.go initial commits 2024-02-13 18:35:55 -08:00
writeframebutton2target.go initial commits 2024-02-15 09:43:14 -08:00
writeframebutton2target_test.go initial commits 2024-02-13 15:19:32 -08:00
writeframebutton3.go initial commits 2024-02-15 09:43:14 -08:00
writeframebutton3_test.go initial commits 2024-02-13 11:16:05 -08:00
writeframebutton3action.go initial commits 2024-02-15 09:43:14 -08:00
writeframebutton3action_test.go initial commits 2024-02-13 18:35:55 -08:00
writeframebutton3target.go initial commits 2024-02-15 09:43:14 -08:00
writeframebutton3target_test.go initial commits 2024-02-13 15:19:32 -08:00
writeframebutton4.go initial commits 2024-02-15 09:43:14 -08:00
writeframebutton4_test.go initial commits 2024-02-13 11:17:24 -08:00
writeframebutton4action.go initial commits 2024-02-15 09:43:14 -08:00
writeframebutton4action_test.go initial commits 2024-02-13 18:35:55 -08:00
writeframebutton4target.go initial commits 2024-02-15 09:43:14 -08:00
writeframebutton4target_test.go initial commits 2024-02-13 15:19:32 -08:00
writeframeimage.go initial commits 2024-02-15 09:43:14 -08:00
writeframeimage_test.go initial commits 2024-02-13 10:21:48 -08:00
writeframeimageaspectratio.go initial commits 2024-02-15 09:43:14 -08:00
writeframeimageaspectratio_test.go initial commits 2024-02-13 10:29:18 -08:00
writeframeinputtext.go initial commits 2024-02-15 09:43:14 -08:00
writeframeinputtext_test.go initial commits 2024-02-13 09:13:33 -08:00
writeframeposturl.go initial commits 2024-02-15 09:43:14 -08:00
writeframeposturl_test.go initial commits 2024-02-13 09:02:16 -08:00
writemetapropertycontent.go initial commits 2024-02-15 09:43:14 -08:00
writemetapropertycontent_test.go initial commits 2024-02-15 09:43:14 -08:00
writeskeleframe.go initial commits 2024-02-22 15:04:29 -08:00
writeskeleframe_test.go initial commits 2024-02-15 09:23:07 -08:00

README.md

go-frameproto

Package frameproto provides tools for the Frame Protocol — which is also known as Farcaster Frames, for the Go programming language.

The specification for the Frame Protocol is at: https://docs.farcaster.xyz/reference/frames/spec

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/sourcecode.social/reiver/go-frameproto

GoDoc

Explanation

The Frames Protocol, also known Farcaster Frames, is a simple web-based technology used for making applications.

It uses HTML without really using HTML, so that Frames Protocol applications work with clients that don't support the Frames Protocol. The fall-back being OpenGraph.

Really, a Frames Protocol application is mostly made up of images and buttons on the client-side (that are specified using HTML <meta> element) with a back-end that gets HTTP POSTed to, which can return a new "page" with an image and buttons, and so on and so on.

This choice of just being mostly images and buttons actually makes the Frames Protocol simpler to create a viewer from scatch. No need to implement all Web technologies. No need to worry about security and privacy holes that Web technologies introduce.

Although the Frames Protocol could be used outside of Farcaster, at the time of writing, Farcaster clients (such as Warpcast) are the only major (client-side) platform to support it.

(The server-side of the Frames Protocol, which is called a Frame Server, is an just HTTP resource — which some might loosely call an HTTP (or HTTPS) URL.)

Enough talking — let's look at some code. Here is the client-side of a Frames Protocol application:

<meta property="fc:frame" content="vNext" />
<meta property="fc:frame:image" content="https://example.com/path/to/image.png" />
<meta property="og:image" content="https://example.com/path/to/image.png" />

It is just HTML.

Although this would need to be embedded into an HTML document, so really it would be something more like this:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="utf-8" />

<meta property="fc:frame" content="vNext" />
<meta property="fc:frame:image" content="https://example.com/path/to/image.png" />
<meta property="og:image" content="https://example.com/path/to/image.png" />

</head>
<body>
</body>
</html>

This package provides you tools for creating this.

For example:

func ServeHTTP(responseWriter http.ResponseWriter, request *http.Request) {

	// ...

	frameproto.WriteFrame(responseWriter, frameproto.VersionVNext)
	frameproto.WriteFrameImage(responseWriter, frameImageURL)

	// ...
}


Import

To import package frameproto use import code like the follownig:

import "sourcecode.social/reiver/go-frameproto"

Installation

To install package frameproto do the following:

GOPROXY=direct go get https://sourcecode.social/reiver/go-frameproto

Author

Package frameproto was written by Charles Iliya Krempeaux