Formrecevr is a simple and lightweight from receiver backend primarily designed for (but not limited to) static websites.

Formrecevr

Badge tests Docker pulls Go report

Formrecevr (pronunced "Form receiver") is a simple and lightweight from receiver backend primarily designed for (but not limited to) static websites. It is inspired by formspree.io but it is simpler, self-hosted and doesn't have a frontend.

Features

  • Easy setup: Just create your docker-compose.yml and you're good to go!
  • Powerful templating: Use Go templating (just like in Hugo) to compose customized content
  • Shoutrrr integration: You can use a wide variety of services to reveive your form submissions
  • Flexible delivery: Thanks to the use of shoutrrr and templating, you can use data from the form as a receiver

Setup

The official installation method is using Docker:

  1. Create a folder for installation:
    mkdir /opt/formrecevr && cd /opt/formrecevr
  2. Create the file docker-compose.yml with this content:
    version: "3.7"
    services:
      formrecevr:
        image: dorianim/formrecevr
        restart: always
        ports:
          - 5081:8088
        volumes:
          - ./config:/config
  3. Adjust the port (default 5081) to your needs
  4. Start the formrecevr:
    docker-compose up -d
  5. Done! You can reach your formrecevr on localhost:80
  6. Adjust your config.yml in /opt/formrecevr/config/config.yml
  7. [OPTIONAL] Adjust your templates in /opt/formrecevr/config/templates
  8. [OPTIONAL] To setup ssl/https, please use a reverse proxy like nginx

Configuration

The configuration is stored in /config/config.yml in the container by default. It is reloaded live, so changes do not require a container restart to become effective.
A fully populated config could look like this:

forms:
  - id: "Example"
    enabled: true
    targets:
    - enabled: true
      template: default.html
      shoutrrrurl: 'telegram://someToken@telegram/?channels={{ .params.someChannel }}'
      params:
        someKey: someChannel
    - enabled: false
      template: email.html
      shoutrrrurl: 'smtp://username:password@host:port/?from=fromAddress&to=recipient1&to={{ .mailFromFrom }}'
      
  - id: "Example2"
    enabled: true
    targets:
    - enabled: true
      template: default.html
      shoutrrrurl: 'slack://token:token@channel/'
listen:
  host: 0.0.0.0
  port: 8088

Fields

  • listen contains settings for the webserver
  • forms contains a list of form blocks

The form block

  • id: The ID of the form. I suggest using something like uuidgen to create a random ID
  • enabled: If the form is enabled. It will not work when this is set to false
  • targets: Contains a list of target blocks

The target block

  • enabled: If the target is enabled. It will be skipped when set to false
  • template: The name of the template which is used for the body. See templates
  • shoutrrrurl: The shoutrrr URL to use for form submissions. Additional information on how to get the URLs can be found here
  • params: Additional parameters which are also passed to the templating engine as .params. . This can be useful when using the same template for multiple targets.

Templates

Templates have to be stored in /config/templates by default. The templates are processed by the go templating engine and have access to all of its functionality, like range loops and if conditions.

Variables

Templates can use all submited form fields in the root context. In addition to that, they have access to the params defined for their target inside the .params key.
For testing, you can use {{ . }} to see all avaiable data.

Functions

There are two additional functions wich can be used:

  • join: Joins a list of strings with a delimiter, eg. {{ join .someListParameter "," }}
  • print: Prints one or more strings or string lists without any delimiter, eg. {{ print .someString .someStringList }}

Routes / API

There are currently two routes available

  • /api/v1/healthcheck (GET): Should return 200 if everything is OK
  • /f/:formID (POST): Accepts form data for configured formIDs. It currently supports application/x-www-form-urlencoded and multipart/form-data

Implementation

I recommend to use the javascript fetch() API to submit your form. An example of this can be found in examples/form-xhr-fetch.html

Owner
Dorian Zedler
Qt developer and open-source enthusiast.
Dorian Zedler
Similar Resources

Backend for Workery application server implemented in Golang

workery-server Backend for Workery application server implemented in Golang. This is a rewrite of the workery-django project. Development Goals: Rewri

Dec 14, 2022

Lightweight go web server that provides a searchable directory index.

autoindex Lightweight go web server that provides a searchable directory index. Optimized for handling large numbers of files (100k+) and remote file

Jan 5, 2023

Ciak is a lightweight media server written in go

 Ciak is a lightweight media server written in go

Ciak allows you to show and stream your personal media tv series, movies, etc with a simple and clean web ui. The server also provide on the fly video encoding in order to stream non standard formats such as avi, mkv...

Jan 3, 2023

A simple http-web server logging incoming requests to stdout with simple http-interface.

A simple http-web server logging incoming requests to stdout with simple http-interface.

http-cli-echo-logger A simple http-web server logging incoming requests to stdout with simple http-interface. Run locally go run ./cmd/main.go Default

Jul 18, 2022

Simple webhook delivery system powered by Golang and PostgreSQL

postmand Simple webhook delivery system powered by Golang and PostgreSQL. Features Simple rest api with only three endpoints (webhooks/deliveries/deli

Dec 22, 2022

Oogway is a simple web server with dynamic content generation and extendability in mind supporting a Git based workflow.

Oogway Oogway is a simple web server with dynamic content generation and extendability in mind supporting a Git based workflow. It's somewhere in betw

Nov 9, 2022

A very simple Golang server handling basic GET and POST requests

GOLANG SERVER INTRO As a true Blockchain enthusiast, I had to learn Solidity and Golang to participate to several projects. This repository consists o

Nov 17, 2021

A simple SHOUTcast server.

DudelDu DudelDu is a simple audio/video streaming server using the SHOUTcast protocol. Features Supports various streaming clients: VLC, ServeStream,

Nov 20, 2022

Heart 💜A high performance Lua web server with a simple, powerful API

Heart 💜A high performance Lua web server with a simple, powerful API

Heart 💜 A high performance Lua web server with a simple, powerful API. See the full documentation here. Overview Heart combines Go's fasthttp with Lu

Aug 31, 2022
Comments
  • Consolidate config dir structure

    Consolidate config dir structure

    The structure of the configdir has to consolidated. It should look like this:

    • config
    • config/config.yml
    • config/templates
    • config/tempaltes/default.html

    There should only be one env variable FORMRECEVR_CONFIG_PATH which specifies the root path.

Fileserver: A simple static fileserver

Fileserver A simple static fileserver. Serves requests to local files in a directory of your choosing so that you can preview files in your browser. B

May 26, 2022
Opinionated boilerplate Golang HTTP server with CORS, OPA, Prometheus, rate-limiter for API and static website.
Opinionated boilerplate Golang HTTP server with CORS, OPA, Prometheus, rate-limiter for API and static website.

Teal.Finance/Server Opinionated boilerplate HTTP server with CORS, OPA, Prometheus, rate-limiter… for API and static website. Origin This library was

Nov 3, 2022
Fishserver is designed to quickly add HTTP handlers to HTTP servers. It supports registration of various HTTP
Fishserver is designed to quickly add HTTP handlers to HTTP servers. It supports registration of various HTTP

Fishserver is designed to quickly add HTTP handlers to HTTP servers. It supports registration of various HTTP. Handler interface types such as Gin Engine, Go's built-in HTTP. HandlerFunc, or http.ServeMux. The HTTP server can be configured quickly with options and can be used for test cases.

Nov 1, 2021
Static Content Web Server

Static Content Web Server The main purpose of the project is to develop static server that can be used with modern javascript frameworks (React, vue.j

Dec 17, 2021
A feature flag solution, with only a YAML file in the backend (S3, GitHub, HTTP, local file ...), no server to install, just add a file in a central system and refer to it. 🎛️
A feature flag solution, with only a YAML file in the backend (S3, GitHub, HTTP, local file ...), no server to install, just add a file in a central system and refer to it. 🎛️

??️ go-feature-flag A feature flag solution, with YAML file in the backend (S3, GitHub, HTTP, local file ...). No server to install, just add a file i

Dec 29, 2022
The Zuri Core is an open-source API that serves as the backend and backbone of Zuri Chat
The Zuri Core is an open-source API that serves as the backend and backbone of Zuri Chat

The Zuri Core is an open-source API that serves as the backend and backbone of Zuri Chat

Dec 26, 2022
⚡ A fast, lightweight, and secure chat protocol, client and server, written in Go.

⚡ A fast, lightweight, and secure chat protocol, client and server, written in Go.

Oct 27, 2022
✨ A lightweight HTTP server based on GO, will try to detect your OS and architecture and return as SHELL script. ✨
✨ A lightweight HTTP server based on GO, will try to detect your OS and architecture and return as SHELL script. ✨

✨ A lightweight HTTP server based on GO, will try to detect your OS and architecture and return as SHELL script. ✨

Dec 14, 2022
Web server for running Brainfuck on the backend

Brainfuck Web Server Web server for running Brainfuck on the backend Run go run . <brainfuck file> The server will start on port 8080 by default. You

Oct 25, 2021