No description
Find a file
2025-03-03 11:16:56 -07:00
cmd/dev_server feat: add collector footer support 2025-02-06 14:24:38 -07:00
db feat: randomize question options 2025-03-03 11:16:56 -07:00
handlers feat: randomize question options 2025-03-03 11:16:56 -07:00
internal feat: randomize question options 2025-03-03 11:16:56 -07:00
routers/frmchi fix: do not support non-shortcode URLs 2025-02-13 15:47:53 -07:00
static feat: optionally require hidden values when displayed 2025-02-20 07:56:45 -07:00
types feat: randomize question options 2025-02-21 18:06:01 -07:00
ui feat: randomize question options 2025-02-21 18:06:01 -07:00
utils initial commit 2024-12-16 17:01:53 -07:00
chore: code cleanup 2025-01-25 08:40:52 -07:00
.air.toml initial commit 2024-12-16 17:01:53 -07:00
.envrc initial commit 2024-12-16 17:01:53 -07:00
.gitignore chore: use reflex instead of air 2025-01-25 08:39:54 -07:00
.ignore feat: alternative styling for single choice questions 2025-02-19 11:48:11 -07:00
env.sample feat: form deletion, create drafts from existing 2024-12-20 14:33:14 -07:00
flake.lock feat: alternative styling for single choice questions 2025-02-19 11:48:11 -07:00
flake.nix feat: randomize question options 2025-02-21 18:06:01 -07:00
frm.go feat: randomize question options 2025-03-03 11:16:56 -07:00
frm_test.go feat: add a NOOP db interface to make internal.Q() safe 2025-02-13 14:11:25 -07:00
go.mod chore(deps): update templ to 0.3.833 2025-02-13 12:49:41 -07:00
go.sum chore(deps): update templ to 0.3.833 2025-02-13 12:49:41 -07:00
README.md feat: draft forms 2024-12-19 09:50:49 -07:00
sqlc.yaml feat: add short urls 2025-01-14 09:46:22 -07:00
types.go support form submission receiver 2025-01-23 07:31:12 -07:00

frm

frm is an embeddable HTML form builder for Go. Its goal is to be embeddable within any net/http-comptabile http router.

This is a work in progress and not production-ready

Concepts

Workspaces

frm's design is oriented around the concept of "workspaces". Workspaces may represent users or tenants within your application. As such, every interaction with frm must be workspace-aware.

Draft forms

"Drafts" are created to edit existing forms. When drafts are saved, they replace the form they were drafted from. Edits are always performed on drafts, such that edits do not go live until the user decides.

Drafts are cleaned up from the database periodically.

Usage

chi

frm mounts to a chi.Router instance and uses the WorkspaceIDUrlParam name to look up the workspace that requests belong to.

Example

const chiUrlParamName = "frm_workspace_id"
f, err := frm.New(frm.Args{
	PostgresURL:         os.Getenv("POSTGRES_URL"),
	WorkspaceIDUrlParam: chiUrlParamName, // name of the chi URL parameter name
})
if err != nil {
	panic(err)
}
err = f.Init(context.Background())
if err != nil {
	panic(err)
}
frmchi.Mount(chiRouter, fmt.Sprintf("/frm/{%s}", chiUrlParamName), f)

This mounts frm to a router at /frm/{frm_workspace_id}.

Inspiration

This project is heavily inspired by opnform. OpnForm is very good, and if you don't have an embeddable in Go requirement, then you should consider OpnForm instead.