# Formivo: full public content This file contains the complete text of Formivo's public articles, integration guides and competitor comparisons. Canonical pages are linked for each section. ## Product definition Formivo is a form backend for developers and agencies. Each form exposes one public POST endpoint that accepts JSON, urlencoded and multipart bodies without an API key. Submissions are stored, validated, rate-limited and quota-enforced, then read in a dashboard by the workspace owner or by client viewers with per-form read-only access. ## Managing form leads across several client websites URL: https://formivo.faizyab.me/blog/manage-form-leads-for-multiple-clients Published: 2026-11-26 · 7 min read · Category: Clients Description: A workflow for freelancers and agencies: one endpoint per site, one pipeline you control, read-only client access and a handoff that does not depend on forwarding email. Give every client site its own form endpoint, keep the leads in one workspace you control, share only the relevant form with each client as a read-only view, and keep a single status workflow so nothing depends on forwarded email. The first client site is easy: the form posts somewhere, the lead arrives, you reply. The fourth site is where the system shows its seams. Leads live in three inboxes, one client has the owner's address in a CC, and nobody can say whether the enquiry from Tuesday was answered. This is not a tooling problem with a clever shortcut. It is an ownership problem. The fix is to make ownership explicit at each layer: the site, the endpoint, the pipeline and the client's view. ### One site, one endpoint Create one form per client site, named after the site rather than the client's mood that week. The name is internal, so use the domain or project name you will recognise in six months. Each form gets its own endpoint and its own submission history. Do not reuse one endpoint across sites to save a form slot. The submission rows become indistinguishable, the client view cannot be scoped, and a plan change that pauses one form takes down every site at once. ### Keep the pipeline in one place Your workspace holds every form, so the submissions list is the one place where Tuesday's enquiries exist together. Filter by form to work one client, or leave the filter off to see the whole book. Use the same six statuses everywhere: new, read, contacted, qualified, converted and archived. The names are boring on purpose. A shared vocabulary is what makes an archive count comparable across a web design project and a maintenance retainer. ```text Form: acme-redesign Status: new → work rows, set read or archived Form: all forms Status: qualified → follow-ups that need a proposal ``` ### Share the form, not the workspace When a client wants to see their own leads, invite them to that form. They get a read-only view of the submissions for that form and nothing else: no other client's forms, no workspace settings, no billing. Read-only is a feature, not a limitation. It keeps one person responsible for the pipeline and avoids two people moving the same lead into different statuses. If a client needs the data in their own tool, export a CSV on a paid plan. > Seats are per client account: A client account uses one seat however many of your forms you share with it. The Free plan includes one, Lite three, Pro ten and Agency fifty. Revoking a form permission frees the seat for a different client. ### Do not build the handoff on email Forwarding every submission to a client's inbox feels like a handoff, but it splits the record. The client replies from their inbox, the reply is not attached to the submission, and your copy of the thread is now partial. Formivo does not send submission emails in the current release, which forces a better habit: give the client the dashboard view and agree on when you check in. The stored row stays the source of truth, and the status reflects a decision rather than a read receipt. ### A setup checklist 1. Create one form per site and name it after the site. 2. Point the form at the endpoint and send one real test submission. 3. Set the same six statuses as your default working vocabulary. 4. Invite the client to that form only, then confirm what they can see. 5. Decide the review rhythm: weekly for an active project, monthly for a retainer. 6. Archive spam immediately so new means new. None of this requires the client to learn a new tool. They open a link, sign in with the address you invited, and read their leads. You keep the pipeline, the export and the ability to revoke access when the engagement ends. --- ## What actually happens when a form posts to an endpoint URL: https://formivo.faizyab.me/blog/how-a-form-endpoint-works Published: 2026-11-24 · 6 min read · Category: Fundamentals Description: Follow one submission from the browser to the database: what the endpoint accepts, which checks run in order, and what each response means. A form endpoint is a single POST URL. It identifies the form, checks status, limits, size and structure, stores the submission inside a transaction that also counts usage, then returns a status the browser or script can act on. Most form tutorials stop at the action attribute. The interesting part starts after the browser sends the request: a useful endpoint has an order of operations, and every failure has a distinct status code. Take a plain HTML form pointed at a Formivo endpoint. One submission touches five steps, in this order. ### 1. The browser builds a request ```html
``` The method matters. A form without method="POST" defaults to GET, and the endpoint answers 405 rather than storing anything. Form-encoded is the default Content-Type; JSON and multipart without files also work. ### 2. The form is identified and checked The path carries the form id. An unknown id returns 404, so a truncated copy-paste fails loudly and quickly. A paused form returns 409 even though the id is valid — the difference tells you whether to check the URL or the form's status. ### 3. Abuse and size limits run before storage 1. Rate limits stop a single form, a single IP, or one IP hitting one form from flooding intake. 2. The body is capped at 256 KB, 100 fields and five levels of nesting. 3. The origin rule, when a form lists allowed domains, rejects browser requests from other sites. 4. A filled honeypot field is accepted and discarded, so a bot learns nothing from the response. These checks are deliberately cheap and happen before a row exists. Rejecting early is what keeps a public write endpoint from becoming a storage problem. ### 4. Storage and usage commit together The monthly allowance is checked in the same transaction that inserts the submission. Either the row and the usage counter both move, or neither does. That is why a traffic spike cannot push a workspace past its plan and why a request that hits the cap returns 409 with nothing stored. > Why the form id is public: The id is an address, not a password. It allows writes only: the endpoint never lists submissions and never returns anyone else's. The protections that matter are status, limits, validation and origin rules. ### 5. The response tells you what to do next ```json { "success": true, "leadId": "9d1f2c4a-7b3e-4f1a-9c2d-1a2b3c4d5e6f", "message": "Submission received." } ``` An HTML form with _redirect sends the visitor to your thank-you page after success; without it, Formivo's own confirmation appears. A fetch-based form keeps the user on the page and decides what to show based on the status code. ### The shortest possible test ```bash curl -X POST "https://formivo.faizyab.me/api/f/YOUR_FORM_ID" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: first-check" \ -d '{ "name": "Ada", "email": "ada@example.com" }' ``` Open the form's submissions immediately afterwards. If nothing appears, the response code is the first clue: 404 for a wrong id, 409 for a paused form or exhausted quota, 429 for rate limiting, 4xx for a malformed body. That is the whole contract. Once it is clear, the integration guides for HTML, React and Next.js are variations on the same four lines. --- ## How to add a contact form to a static site URL: https://formivo.faizyab.me/blog/contact-form-on-a-static-site Published: 2026-11-06 · 5 min read · Category: Integration Description: A static site cannot receive a POST request on its own. Here is the shortest working path: one action attribute, one redirect, one honeypot field. A static site has no server, so the form must post to a hosted endpoint. Change the form's action to that endpoint, keep method="POST", and the hosting platform never needs to run code. Static hosting platforms serve files. They do not execute a script when a visitor submits a form, which is why a contact form is usually the first thing that breaks when a site moves to Netlify, Vercel, Cloudflare Pages or GitHub Pages. The fix is smaller than most tutorials suggest. Your markup stays static; the request goes somewhere else. ### The two attributes that matter ```html
``` Each name attribute becomes a key in the stored submission. A form that omits method defaults to GET, which the endpoint rejects with 405, so method="POST" is not optional. ### Send the visitor back to your site Without extra configuration the visitor sees a Formivo thank-you page. That works, but it breaks the illusion that the form is part of your site. Add a hidden redirect field to keep them where they were. ```html ``` > Redirect targets are absolute: A relative value such as /thanks cannot be resolved by the endpoint, because it does not know your site. Use the full URL, including https://. ### Add a honeypot before you publish Static forms are scraped within days. A hidden field that people never see but naive bots fill will remove most automated submissions without asking a real visitor to solve anything. ```html ``` - Position the field off screen instead of using display:none, because some bots skip hidden inputs. - Remove it from the tab order with tabindex="-1" and hide the wrapper from screen readers. - Keep the field name exactly _gotcha: the endpoint treats a filled value as a bot and discards the request. ### What about a framework build step? Astro, Eleventy, Hugo and Next.js static export all produce HTML in the end. If the page ships a form element, the same two attributes work. A client-side framework only changes whether you also want an inline success message instead of a redirect. | Host | Form works as-is? | Notes | | --- | --- | --- | | Netlify | Yes | Do not enable Netlify Forms for the same form; pick one receiver. | | Vercel | Yes | No serverless function is needed for this approach. | | GitHub Pages | Yes | Cannot run server code at all, which is fine here. | | Cloudflare Pages | Yes | A Pages Function works too, but is not required. | ### Checklist before you ship 1. action points at the endpoint and method is POST. 2. Every input has a label and a meaningful name attribute. 3. _redirect points at a real page that thanks the visitor. 4. A honeypot field is present and reachable by bots but not by people. 5. Submit the form once from the deployed site, not only locally. --- ## Form backend vs building your own endpoint URL: https://formivo.faizyab.me/blog/form-backend-vs-custom-backend Published: 2026-11-05 · 6 min read · Category: Fundamentals Description: Cost, control and maintenance compared between a hosted form backend and your own API route, including the cases where building it yourself is the right call. Build your own when submissions must join internal data or drive business logic. Use a hosted backend when the job is to receive, keep and share form data reliably. The endpoint is ten lines, the surrounding operations are not. This is a build-versus-buy decision, and most comparisons are dishonest because they compare a hosted product's price with an imaginary five-minute implementation that never needs maintenance. ### What building it yourself really includes 1. The handler: parse three content types, validate, insert, respond. 2. Rate limiting that works across instances and deployments. 3. Spam handling, which starts as nothing and becomes a project. 4. Email delivery: provider, sending domain, SPF/DKIM, bounces. 5. Storage, retention and deletion requests. 6. Access control for whoever needs to read the data. 7. Monitoring, because a silent failure means lost leads. ### Side by side | Dimension | Hosted form backend | Your own endpoint | | --- | --- | --- | | Time to first submission | Minutes | Hours to days | | Spam controls | Included | You build and tune them | | Data location | Vendor | Your infrastructure | | Custom logic | Limited to what the product exposes | Unlimited | | Cost model | Per submissions/plan | Compute, database, email, on-call | | Client access | Usually a product feature | You build it | | Failure mode | Vendor outage | Your outage | ### When self-hosting wins - The submission must create records in your domain model immediately. - You already run the infrastructure and the email pipeline. - Data residency or contractual rules forbid a third party. - The form is internal and has no abuse surface. ### When a hosted backend wins - Static sites, landing pages, docs sites and client microsites. - Small teams without on-call, or agencies with dozens of client forms. - Any project where the form is not the product. ### A pragmatic middle path Keep your own service as the system of record for business actions, and send the marketing form to a hosted backend first. When a lead matters, forward it to your API with a webhook or a scheduled job. You get the operational safety of the hosted path and the control of your own domain logic. > Migration cost is real: Whatever you choose, keep the integration thin: one URL, one payload shape. If moving later requires rewriting frontend components, the architecture was the problem, not the vendor. Formivo's whole design assumes the endpoint is boring: POST, validate, store, deliver. If you need more than that, you probably need your own service, and that is a legitimate answer, not a lost sale. --- ## How to share form submissions with clients (without sharing your account) URL: https://formivo.faizyab.me/blog/share-form-submissions-with-clients Published: 2026-11-04 · 6 min read · Category: Clients Description: Why emailing CSV exports and sharing logins both fail, and how per-form read-only access with revocable invitations works in practice. Give each client their own account with read access to only the forms you choose, revocable at any time. Never share your workspace login, and treat emailed CSV files as a leak waiting to happen. If you build websites for other people, the submission data is not yours. Your client wants to read their leads; you want to keep control of the platform. Most workflows solve this badly. ### The three usual approaches | Approach | What breaks | | --- | --- | | Forward every notification email | No history, no search, and the client cannot log in | | Share your dashboard login | Full access to every client, no audit trail, impossible to revoke | | Email a CSV each month | Stale by the next day, and the file is unencrypted in an inbox | ### Per-form, read-only access The alternative is a distinct account type: a client account with no workspace, no billing, and read access only to the specific forms you invite them to. They can see submissions, filter, search and export if your plan allows it, and nothing else exists for them to click. 1. You open the form's Clients tab and invite the client's email address. 2. They receive a single-use link that expires in seven days. 3. On acceptance, their account is created as a client, never as a developer with a workspace. 4. They land in a portal listing only their shared forms. 5. You can revoke the permission at any time; the next request fails immediately. ### What the client can and cannot do | Capability | Client viewer | | --- | --- | | Read submissions for shared forms | Yes | | Filter, search, view a submission | Yes | | Export CSV (paid workspace) | Yes | | Change lead status | No | | Edit the form or its endpoint | No | | See other clients' forms | No | | Invite anyone | No | Every one of those rows is enforced on the server and mirrored in the database policies, not decided by hiding buttons. ### Practical rules for agencies - Invite a role address (`leads@client.com`) rather than an individual, so staff changes do not lock you out. - Revoke when a project ends; keep the data, drop the access. - Use one form per purpose, not one form for everything. Permissions are per form. - Tell the client what they can export before they ask. > Revocation is immediate: Access checks run per request against the permission row. Revoking writes a timestamp; the next page load or API call is refused, with no session to expire and no cache to purge. The point is simple: the client gets their data without getting your account. That separation is the difference between a favour and a maintained workflow. --- ## Honeypots versus CAPTCHAs for form spam URL: https://formivo.faizyab.me/blog/honeypots-versus-captchas Published: 2026-11-03 · 6 min read · Category: Security Description: CAPTCHAs ask every visitor to prove they are human. A honeypot asks only the bots. Here is where each one works, and why the strongest setup uses several cheap layers. A honeypot is a hidden field that bots fill and people never see, so it costs legitimate visitors nothing. A CAPTCHA challenges every visitor, including people using screen readers or slow connections, so it belongs after cheaper filters, not before them. Every contact form eventually receives something that is not a customer. The question is not whether to filter, but what the filter costs the people you actually want to hear from. ### What a honeypot actually does A honeypot is an input a person cannot see or reach. A generic spam bot fills every field it finds. If the hidden field arrives with a value, the request is dropped. - Cost to a legitimate visitor: nothing visible. - Cost to you: one hidden input and one server-side check. - Weakness: a bot that reads CSS and skips hidden fields, or a human paid to submit by hand. That weakness is why a honeypot is a first filter, not the only filter, and why the field should be hidden with positioning rather than display:none. ### What a CAPTCHA costs A CAPTCHA interrupts everyone to stop some. The interruption is small on a fast desktop and considerably larger on a slow connection, in a screen reader, or for someone filling the form in a hurry on a phone. There are cases where that trade is right: a public form that is being flooded right now, or a sign-up that creates a costly resource. It is rarely right as the first and only defence on a contact form. ### Layers, cheapest first 1. Server-side validation: reject malformed bodies before anything else runs. 2. Honeypot: drop obvious automation for free. 3. Rate limits: cap per form, per IP and per form per IP, so a flood cannot finish. 4. Origin rules: refuse browser requests from sites you did not authorise. 5. Quota: cap what one workspace can store per month. 6. CAPTCHA: add it only if the layers above are still not enough. Formivo implements the first five on every plan. The sixth is a decision for your own form, because it runs on your page. ### What not to do - Do not block an entire IP range because one address misbehaved: offices, schools and mobile carriers share addresses. - Do not silently delete suspicious submissions without a record, because you will eventually delete a real lead. - Do not publish your filtering rules in a visible error message; it teaches the next bot how to pass. > Measure before adding friction: If the spam you receive is a handful of rows per week, a honeypot and rate limits are enough. Add a CAPTCHA when the volume is actually hurting, not because a checklist said so. ### A practical default Honeypot on, rate limits untouched, allowed domains set to the sites you own, monthly quota reviewed when a form gets attention. That combination costs visitors nothing and removes the bulk of automated submissions. --- ## Form submission security: what actually protects a public endpoint URL: https://formivo.faizyab.me/blog/form-submission-security Published: 2026-11-02 · 8 min read · Category: Security Description: A public form endpoint is unauthenticated by design. Here is what genuinely protects it, and which popular measures are theatre. Assume anyone can POST to the endpoint. Then make the endpoint safe for anonymous writes: strict size and shape limits, shared rate limits, quota enforcement, no read access from the public path, and storage scoped by ownership rather than by request parameters. A contact form endpoint is reachable by the entire internet, including curl. Any security model that depends on the browser behaving is not a security model. ### The threat model, briefly - Flooding: filling your database or your quota. - Injection: values that break a downstream consumer, spreadsheet or email template. - Enumeration: discovering which form ids exist and are active. - Data exposure: reading submissions through the write path. - Privilege confusion: a viewer of one form reaching another's data. ### What works 1. Body caps enforced while reading, not only from Content-Length. 2. Field count, name length, value length and nesting depth limits. 3. Rate limits stored in a shared database, keyed on a trustworthy IP. 4. Atomic quota checks in the same transaction as the insert. 5. Write-only public path: no GET, no listing, no ids leaked beyond the caller's own submission. 6. Authorization on every read derived from the session and the ownership chain, never from a query parameter. 7. Output encoding everywhere the data is rendered, including CSV exports. ```http HTTP/1.1 409 Conflict Content-Type: application/json Cache-Control: no-store { "success": false, "error": { "code": "QUOTA_EXCEEDED", "message": "This form has reached its monthly submission limit." } } ``` Note what is absent: no table names, no SQL, no stack trace, no indication of which validation happened first. Errors are for the integrator, not the attacker. ### What is theatre | Measure | Why it does not protect you | | --- | --- | | A secret in the HTML | It is in the page source; it is a form id with extra steps | | Hiding the field names | Bots read the form markup they are about to submit | | Client-side validation | Bypassed by one curl command | | `X-Frame-Options` on the endpoint | Framing is a page concern, not an API one | | Obscure endpoints | Security by URL guessing; logs find them | ### Authorization is a separate system Spam protection keeps garbage out; authorization keeps data in. They are enforced in different places. In Formivo, the database has row-level security policies so a workspace member can only select submissions for forms their workspace owns, and a client viewer only for forms they hold an active permission on. The server checks the same rules before querying, because a service-role connection bypasses RLS by design. > The test that catches real bugs: Create two accounts, two forms and one submission in each. Then request the other account's submission id with the first account's session. If you get data instead of 404, you have an IDOR, the most common SaaS data leak. ### Operational hygiene - Log operational signals (rate limit hit counts), not payloads. - Never log raw tokens, emails or message bodies. - Keep audit records for access grants and revocations. - Set retention deliberately; deleted data cannot leak. None of this makes an endpoint unhackable. It makes anonymous writes bounded, reads authenticated and cross-tenant access a server-side impossibility rather than a frontend convention. --- ## What a client should see in a form dashboard URL: https://formivo.faizyab.me/blog/form-dashboard-for-clients Published: 2026-10-30 · 5 min read · Category: Clients Description: Sending a CSV every Friday is not a client portal. Here is the access model that works: one permission per form, read-only by default, revocable in one click. A client should see the submissions of the forms you explicitly shared, read-only, and nothing else: no other clients, no workspace settings, no billing. Access should be one revocable permission per form rather than a shared login. Agencies usually start by emailing a spreadsheet. It works for one client and one form. By the fourth client it becomes a weekly copy, paste and accidental-recipient problem. ### Three models, three failure modes | Model | What breaks | | --- | --- | | Shared login | You cannot revoke one person, and every action looks like the same user. | | CSV by email | The data lives in inboxes forever, outside any retention or deletion policy. | | Per-form permission | Requires a real access model, which is exactly why it holds up. | ### What the client portal should contain - The forms shared with them, and only those. - Read access to submissions, with the timestamp and values. - A clear empty state before their first form is shared. - No editing, no deleting, no invitations: one owner of the data. Read-only is not a limitation to apologise for. It keeps one person responsible for lead status, which is what prevents two people from marking the same lead contacted and losing track of it. ### Why the permission must be a row A link with a token is easy to build and hard to control: it gets forwarded, bookmarked and pasted into a group chat. A permission row ties access to an authenticated account, so revoking it takes effect immediately, including for a session that is already open. ```text permission(id, form_id, client_user_id, granted_at, revoked_at) revoked_at IS NULL -> access granted now revoked_at IS SET -> access gone, row kept for history ``` ### Onboarding a client in practice 1. Create the form and confirm it receives a real submission. 2. Invite the client by the address they actually use, not a guess. 3. Let the invitation link create their account; do not send them through developer signup. 4. Ask them to open the portal and confirm they see the form. 5. When the engagement ends, revoke the permission instead of deleting the account. > One address, one identity: If a client already has an account under a different address, the invitation belongs to a different user. Revoke it and invite the address they sign in with. ### What to keep for yourself Notifications, status changes, exports and the ability to invite further viewers stay with the workspace owner. That split lets you hand over visibility without handing over control. --- ## How to prevent contact form spam (without CAPTCHA everywhere) URL: https://formivo.faizyab.me/blog/prevent-contact-form-spam Published: 2026-10-29 · 7 min read · Category: Security Description: Layered spam defence for public forms: honeypots, rate limits, origin allow-lists, idempotency and content checks, and when a CAPTCHA is actually worth the friction. Layer cheap, invisible controls first: honeypot fields, per-IP rate limits, origin allow-lists and idempotency. Add a CAPTCHA only for the traffic that survives those, because a CAPTCHA taxes every real visitor to stop a minority of bots. Spam is not a single problem. There are crawlers that parse every form on the internet, targeted bots that solve your specific challenge, and humans paid to submit junk. Each needs a different lever. ### Layer 1: Honeypots (free, invisible) ```html ``` Naive bots fill every input. Formivo answers honeypot submissions with a success response and stores nothing, so the bot has no signal that it failed. ### Layer 2: Rate limits that survive scaling In-memory counters reset with every cold start and diverge across instances. Limits need to live in a shared store. Formivo keeps fixed windows in Postgres and enforces three per submission: per form, per IP, and per form+IP. > Trust the right header: A rate limiter is only as honest as its client IP. If you read the leftmost `x-forwarded-for` entry, an attacker rotating a fake value gets an unlimited number of buckets. Prefer platform-set headers or the rightmost proxy hop. ### Layer 3: Origin allow-lists If a form is only used on one site, restricting accepted origins removes a large class of drive-by abuse. Be clear about what this is: a browser control, not authentication. A server-side script can send any `Origin` it likes, which is why rate limits and quotas still matter. ### Layer 4: Idempotency Double clicks and retry loops create duplicate leads that look like spam to whoever has to clean them up. Send an `Idempotency-Key` (or `_idempotency_key`) generated once per form fill; retries then return the original submission instead of inserting a second one. ### Layer 5: Content heuristics - Reject submissions whose only URL appears in a link-heavy message. - Treat identical bodies from the same IP within minutes as one submission. - Flag free-mail addresses only if your funnel genuinely needs it. Usually it does not. ### When a CAPTCHA is worth it | Signal | Action | | --- | --- | | Honeypot catches most bots | No CAPTCHA needed | | Bots solve your challenge and submit | Add a provider CAPTCHA (Turnstile, hCaptcha) | | Humans submit junk | Moderation queue, not a CAPTCHA | A CAPTCHA should be the last layer, because it costs you real conversions and adds a third-party dependency to your form's critical path. ### A checklist for launch day 1. Honeypot field present and hidden accessibly (not `display:none` only). 2. Rate limits in a shared store, keyed on a trustworthy IP. 3. Origin allow-list set if the form has one known home. 4. Quota configured so a flood cannot cost you money silently. 5. An alert path: someone should notice a spike in the same day. --- ## How to stop duplicate form submissions URL: https://formivo.faizyab.me/blog/stop-duplicate-form-submissions Published: 2026-10-27 · 5 min read · Category: Integration Description: Duplicates come from three places: a double click, a retried request after a timeout, and a refreshed thank-you page. Each needs a different fix. Disable the submit button to stop double clicks, and send a stable Idempotency-Key header so a retried request returns the original result instead of creating a second submission. A refreshed thank-you page needs a redirect after POST, not another request. Two identical leads in a dashboard look like a spam problem. They are usually three separate reliability problems wearing the same clothes. ### Cause one: the double click A slow response invites a second click. The fix is in the UI: disable the button when the submit handler starts and re-enable it only after a failure. ```javascript form.addEventListener("submit", async (event) => { event.preventDefault(); const button = form.querySelector("button[type=submit]"); button.disabled = true; try { await send(); } finally { button.disabled = false; } }); ``` ### Cause two: the retry after a timeout A request can succeed on the server and still fail on the client, for example when the network drops before the response arrives. Retrying is correct behaviour, but without a key it creates a duplicate. ```javascript const idempotencyKey = crypto.randomUUID(); async function send(values) { return fetch(endpoint, { method: "POST", headers: { "Content-Type": "application/json", "Idempotency-Key": idempotencyKey, // reused across retries }, body: JSON.stringify(values), }); } ``` > Generate the key once: A key created inside the retry loop is a new key on every attempt, which defeats the purpose. Create it when the visitor starts the submission, then reuse it until that submission is finished. ### Cause three: the refresh If a successful POST renders a page directly, pressing refresh re-sends the request. The standard answer is the same one the web has used for decades: redirect after a successful POST, so the browser's last request is a GET. - Native form: set _redirect so the visitor lands on a plain page. - JavaScript: replace the form with a success state instead of navigating. - Framework: redirect from the action once it succeeds. ### What deduplication cannot fix Two genuinely different visitors with the same values are two leads. Formivo does not merge submissions by content, because that would silently discard real ones. It only guarantees that one retried request does not become two rows. | Symptom | Cause | Fix | | --- | --- | --- | | Two rows, same values, same second | Double click | Disable the button | | Two rows minutes apart | Retry without a key | Idempotency-Key | | New row on refresh | Rendered response | Redirect after POST | --- ## Connecting a React form to a backend URL: https://formivo.faizyab.me/blog/react-form-backend Published: 2026-10-26 · 6 min read · Category: Integration Description: A complete React form with controlled inputs, client validation, a real POST request and accessible error handling. No form library required. Keep form state in React, validate on submit, POST JSON to the endpoint with fetch, and render the response as a status message. The backend validates again; client validation is only for speed of feedback. React makes form state explicit, which is both the benefit and the trap: it is easy to write a form that validates only in the browser and trusts its own output. ### The form ```tsx import { useState } from "react"; type Status = { kind: "idle" } | { kind: "sending" } | { kind: "sent" } | { kind: "error"; message: string }; export function ContactForm() { const [status, setStatus] = useState({ kind: "idle" }); async function handleSubmit(event: React.FormEvent) { event.preventDefault(); const form = event.currentTarget; const data = Object.fromEntries(new FormData(form)); if (typeof data.email !== "string" || !data.email.includes("@")) { setStatus({ kind: "error", message: "Enter a valid email address." }); return; } setStatus({ kind: "sending" }); try { const response = await fetch("https://formivo.faizyab.me/api/f/YOUR_FORM_ID", { method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json" }, body: JSON.stringify(data), }); const body = await response.json(); if (!response.ok) throw new Error(body?.error?.message ?? "Submission failed"); form.reset(); setStatus({ kind: "sent" }); } catch (error) { setStatus({ kind: "error", message: (error as Error).message }); } } return (
``` Field names become the JSON keys you see in the dashboard, so name them for the reader, not the database: `email`, not `field_2`. ### Step 3: Decide what the visitor sees | You want | Do this | The endpoint returns | | --- | --- | --- | | A branded confirmation page | Nothing extra | HTML thank-you page, 200 | | Your own thank-you page | Add `_redirect` with an https URL | 303 redirect | | Stay on the page, show a message | Submit with fetch() and `Accept: application/json` | 201 with `{ success, leadId }` | > Redirects are validated: `_redirect` only accepts http and https. Anything else is ignored, which prevents open-redirect abuse through your form. ### Step 4: Read the submissions Submissions appear in the workspace immediately: filter by form, search across name, email, message, subject and phone, set a lead status, and export when the plan allows it. There is nothing to poll and no mailbox to keep clean. ### Step 5: Add a little abuse control - Add a hidden honeypot field (`_gotcha`). Submissions that fill it are answered with success and stored nowhere. - Set an origin allow-list if the form should only accept posts from your domain. - Keep rate limits on: per form, per IP and per form+IP are enforced in the database. ### Common mistakes 1. Leaving `method` off the form. The browser then sends GET and nothing is stored. 2. Using `enctype="text/plain"`; only urlencoded and multipart are supported. 3. Naming two inputs the same on purpose, then expecting one value. 4. Blocking the submit button before the response returns, so a slow network looks broken. That is the whole integration. One attribute, one form name, and a dashboard you can hand to a client without exposing your infrastructure. --- ## What is a form backend? URL: https://formivo.faizyab.me/blog/what-is-a-form-backend Published: 2026-10-06 · 6 min read · Category: Fundamentals Description: A form backend receives, validates, stores and delivers the data behind an HTML form. Here is what it replaces, what it does not do, and how to choose one. A form backend is the server-side half of a form: it accepts the POST request, validates and stores the data, filters abuse, and delivers submissions somewhere you can read them. It replaces the custom endpoint you would otherwise write, deploy and maintain. Every HTML form has two halves. The markup in the browser collects values; something on the server has to accept them. On a static site, a marketing page, or a prototype, that second half is usually the reason a form never ships. ### What a form backend actually does - Accepts the HTTP request the browser sends. Form-encoded, multipart or JSON. - Validates structure and size before anything is stored. - Applies abuse controls: rate limits, spam filtering, origin checks. - Stores the submission durably, scoped to the right owner. - Delivers it: dashboard, email notification, webhook or export. That list is short, but each line is a production concern. Validation that is too loose lets malformed data into your database; rate limiting is the difference between a contact form and a free spam relay; storage needs ownership rules so one client never sees another's leads. ### What it is not A form backend is not a form builder. It does not style your inputs, manage your layout, or replace your design system. You keep the form you already have and change one attribute, the action URL. ```html
``` ### Why teams use one instead of writing an endpoint 1. The endpoint has to exist everywhere: preview deployments, staging, production. 2. Email delivery needs a domain, a provider and bounce handling. 3. Spam arrives within days of going live, and filtering is an arms race. 4. Someone has to own the data: retention, exports, deletion requests. 5. Client-facing access is a separate feature most teams never get to. A small Express handler is easy to write and hard to keep. The handler is ten lines; the operational surface around it is the project. ### How Formivo implements it Each form gets one public endpoint, identified by its form id. There is no API key to embed in HTML, because a key in client-side markup is not a secret anyway. Protection comes from the parts that can actually be enforced on the server: a 256 KB body cap, field and nesting limits, per-form and per-IP rate limits stored in the database, an optional browser-origin allow-list, honeypot fields, idempotency keys, and monthly quota checks that run in the same transaction as the insert. Submissions are write-only from the public side. Reading them requires a signed-in workspace member, and the database enforces the same boundary with row-level security rather than trusting the application layer. > Rule of thumb: If your form needs to notify a human and keep a record, you need a backend. If it needs to trigger business logic, keep your own service and post to it. ### When you should build your own - The submission must join data you already own inside your database. - You need file processing, payments or multi-step state machines. - Compliance requires the data to stay in your own infrastructure. Otherwise a hosted backend removes a service from your on-call rotation. The rest of this blog covers the concrete integrations: HTML, React, Next.js, PHP and the security decisions around each. --- # Integration guides ## HTML form backend (HTML guide) URL: https://formivo.faizyab.me/guides/html Description: Point any HTML form at a Formivo endpoint with two attributes, then choose between a built-in confirmation page and your own redirect. Requirements: - A form in your HTML - A form id from the Formivo dashboard Steps: 1. Create a form in Formivo and copy its endpoint. 2. Set the form's action to the endpoint and keep method="POST". 3. Name every field; the names become the submission's keys. 4. Add `_redirect` if you want the visitor to land on your own page. ```
``` Response: Without `_redirect` the visitor gets a branded confirmation page (200). With it, a 303 redirect to your URL. Errors return an HTML page explaining what to fix. Troubleshooting: - Submissions never arrive: The form is missing method="POST", so the browser sends GET. - 413 Payload Too Large: The body exceeds 256 KB; remove large hidden fields. - 415 Unsupported Media Type: Use the default enctype or multipart/form-data; text/plain is rejected. - 403 Forbidden: The form has an origin allow-list and your site is not on it. --- ## JavaScript form backend (JavaScript guide) URL: https://formivo.faizyab.me/guides/javascript Description: Send JSON with fetch, handle 201, 409 and 429 correctly, and keep the form usable while the request is in flight. Requirements: - Any page with a form - A form id Steps: 1. Intercept the submit event and prevent the default navigation. 2. Post FormData as JSON with Accept: application/json. 3. Show success or the server's error message in an aria-live region. 4. Re-enable the button in a finally block. ``` const form = document.querySelector("form"); const status = document.querySelector("[data-status]"); form.addEventListener("submit", async (event) => { event.preventDefault(); const button = form.querySelector("button[type=submit]"); button.disabled = true; status.textContent = "Sending…"; try { const response = await fetch("https://formivo.faizyab.me/api/f/YOUR_FORM_ID", { method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json", // one key per form fill: retries never create a duplicate lead "Idempotency-Key": crypto.randomUUID(), }, body: JSON.stringify(Object.fromEntries(new FormData(form))), }); const body = await response.json(); if (!response.ok) throw new Error(body?.error?.message ?? "Submission failed"); form.reset(); status.textContent = "Thanks. Your message was sent."; } catch (error) { status.textContent = error.message; } finally { button.disabled = false; } }); ``` Response: 201 with { success: true, leadId } on create, 200 when an idempotency key replays, 409 for a paused form or exhausted quota, 429 with Retry-After. Troubleshooting: - CORS error in the console: The form's origin allow-list does not include your site. - Duplicate leads: Disable the button during the request and send an Idempotency-Key. - response.json() throws: A redirect was followed; do not send `_redirect` with fetch. --- ## React form backend (React guide) URL: https://formivo.faizyab.me/guides/react Description: A production-shaped React form: uncontrolled inputs, submit-time validation, a real POST and accessible feedback. Requirements: - React 18+ - A form id Steps: 1. Keep inputs uncontrolled unless a value drives rendering. 2. Capture event.currentTarget before awaiting. 3. Post JSON and branch on response.ok. 4. Announce errors with role="alert". ``` import { useState } from "react"; export function ContactForm() { const [state, setState] = useState<"idle" | "sending" | "sent" | "error">("idle"); async function onSubmit(event: React.FormEvent) { event.preventDefault(); const form = event.currentTarget; const payload = Object.fromEntries(new FormData(form)); setState("sending"); const response = await fetch("https://formivo.faizyab.me/api/f/YOUR_FORM_ID", { method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json" }, body: JSON.stringify(payload), }).catch(() => null); if (!response?.ok) { setState("error"); return; } form.reset(); setState("sent"); } return (
{state === "sent" &&

Thanks. We will reply shortly.

} {state === "error" &&

Could not send. Please try again.

}
); } ``` Response: 201 on success. Treat any non-2xx as a failure and keep the entered values. Troubleshooting: - Values disappear: You reset the form before the request finished. - Stale event in React 17+: Use event.currentTarget, captured before the first await. --- ## Next.js form backend (Next.js guide) URL: https://formivo.faizyab.me/guides/nextjs Description: Three App Router patterns for forms: plain HTML action, client fetch, and a server action that forwards to Formivo. Requirements: - Next.js App Router - A form id Steps: 1. Marketing page: use a plain HTML form with the endpoint as action. 2. App page: client component with fetch and a status state. 3. Server action: forward FormData server-side when you need to enrich it. ``` // app/contact/actions.ts "use server"; export async function sendContact(formData: FormData) { const response = await fetch("https://formivo.faizyab.me/api/f/YOUR_FORM_ID", { method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json" }, body: JSON.stringify(Object.fromEntries(formData)), }); return { ok: response.ok }; } // app/contact/page.tsx import { sendContact } from "./actions"; export default function ContactPage() { async function action(formData: FormData) { "use server"; await sendContact(formData); } return (
); } ``` Response: Server actions return whatever you return; the endpoint itself answers 201 or an error code. Troubleshooting: - Hydration error after submitting: Do not return JSX from an action; return data and render it. - Endpoint exposed in the bundle: Use a server action; NEXT_PUBLIC_ variables are public. --- ## Vue form backend (Vue guide) URL: https://formivo.faizyab.me/guides/vue Description: A Vue 3 Script Setup form with fetch, loading state and inline error handling. Requirements: - Vue 3 - A form id Steps: 1. Use v-model for the fields you want reactive. 2. Post JSON from the submit handler. 3. Store the result in a ref and render it. ```