Form Endpoints
Deta Micros can be used to easily deploy form endpoints and the form data can be stored easily with Deta Base.
In this guide, we are going to deploy a Deta Micro that offers a form endpoint for a simple contact form and stores the information in a Deta Base.
The guide assumes you have already signed up for Deta and have the Deta CLI installed.
The contact form will store a name
, email
and a message
.
- JavaScript
- Python
We are going to deploy an express
app for the form endpoint.
Create a directory
express-form
and change the current directory to it.Create an empty
index.js
file (we will add the code that handles the logic later).Initialize a
nodejs
project withnpm init
.You can skip the
-y
flag, if you want to fill the details about the pacakge interactively through npm's wizard.Install
express
locally for your project.Create a new
nodejs
micro withdeta new
. This will create a newnodejs
micro for you and automatically installexpress
as a dependecy.Your micro's
endpoint
will be different from the output shown above. Thisendpoint
will be the form endpoint.You can also see that the
http_auth
isenabled
by default. We will disable thehttp_auth
so that form data can be sent to the micro.This is only for the tutorial, we recommended that you protect your endpoint with some authentication.
Open
index.js
and add aPOST
endpoint for the form usingexpress
.Update
index.js
to add logic to save the form data to a Deta Base.Deploy the changes with
deta deploy
Your endpoint will now accept form POST
data and save it to a database.
You can use Deta Base's UI to easily see what data has been stored in the database. Navigate to your project
and click on your base name under bases
in your browser to use the Base UI.
Here's an example view of the UI.

We are going to deploy a flask
app for the form endpoint.
Create a directory
flask-form
and change the current directory to it.Create an empty
main.py
file (we will add the code that handles the logic later).Create a
requirements.txt
file and addflask
as a dependency for your project.Create a new
python
micro withdeta new
. This will create a newpython
micro for you and automatically installflask
as a dependecy.Your micro's
endpoint
will be different from the output shown above. Thisendpoint
will be the form endpoint.You can also see that the
http_auth
isenabled
by default. We will disable thehttp_auth
so that form data can be sent to the micro.This is only for the tutorial, we recommended that you protect your endpoint with some authentication.
Open
main.py
and add aPOST
endpoint for the form usingflask
.Update
main.py
to add logic to save the form data to a Deta Base.Deploy the changes with
deta deploy
.
Your endpoint will now accept form POST
data and save it to a database.
You can use Deta Base's UI to easily see what data has been stored in the database. Navigate to your project
and click on your base name under bases
in your browser to use the Base UI.
Here's an example view of the UI.
