Oouhammmourachid /
Public
ouhammmourachid / forms-backend
PublicPoint any HTML form at /f/{slug}: submissions are stored, spam is caught by a honeypot, and you get an email for each one.
- Automation
- 0 deploys
- 0 forks
Forms Backend for static sites
Point any HTML form at /f/{slug}: submissions are stored, spam is caught by a honeypot, and you get an email for each one.
What you get
POST /f/{slug}accepts HTML form posts, JSON and multipart- Email notification for every submission
- Honeypot field (
_gotcha) marks bot submissions as spam - Optional redirect to a thank-you page after submitting
- Each user manages their own forms and sees only their submissions
Collections
forms
| Field | Type | Notes |
|---|---|---|
name (required) | text | |
slug (required) | text | Used in the URL: /f/{slug} |
owner (required) | relation → users | Set by a hook to the signed-in user |
notify_email | Where to send notifications | |
redirect_url | url | Thank-you page (optional) |
disabled | bool | Stop accepting submissions |
| Action | Who can do it |
|---|---|
| List / view | owner = @request.auth.id |
| Create | signed-in users |
| Update | owner = @request.auth.id |
| Delete | owner = @request.auth.id |
submissions
Written by the /f/{slug} route only.
| Field | Type | Notes |
|---|---|---|
form (required) | relation → forms | |
data | json | The submitted fields |
ip | text | |
user_agent | text | |
spam | bool | Honeypot was filled in |
| Action | Who can do it |
|---|---|
| List / view | form.owner = @request.auth.id |
| Create | superusers only |
| Update | superusers only |
| Delete | form.owner = @request.auth.id |
Hooks
All hooks are in pb_hooks/main.pb.js and commented.
Setup
- Set SMTP in Settings for email notifications.
- Turn on Rate limiting in Settings to slow down abuse of the public endpoint.
Quick start
<form action="https://YOUR-INSTANCE.pocketshub.com/f/contact" method="POST">
<input name="email" type="email" required>
<textarea name="message" required></textarea>
<input name="_gotcha" style="display:none" tabindex="-1" autocomplete="off">
<button>Send</button>
</form>
Notes
- Create the form record first (in the dashboard or with the SDK), with slug
contact.
License
MIT
2 collections, 1 relation. Hover a collection to trace its relations