{"id":14968854,"url":"https://github.com/dashibase/dashibase-insert","last_synced_at":"2025-10-26T05:30:47.770Z","repository":{"id":41473543,"uuid":"509537711","full_name":"Dashibase/dashibase-insert","owner":"Dashibase","description":"Notion-like form builder powered by Vue, Tailwind and Supabase","archived":false,"fork":false,"pushed_at":"2022-10-29T05:51:50.000Z","size":1037,"stargazers_count":143,"open_issues_count":0,"forks_count":9,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-31T15:53:25.336Z","etag":null,"topics":["form","frontend","notion","supabase","tailwind","vue","webdev"],"latest_commit_sha":null,"homepage":"","language":"Vue","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Dashibase.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-01T17:28:16.000Z","updated_at":"2025-01-29T07:32:35.000Z","dependencies_parsed_at":"2023-01-19T23:33:21.070Z","dependency_job_id":null,"html_url":"https://github.com/Dashibase/dashibase-insert","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dashibase%2Fdashibase-insert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dashibase%2Fdashibase-insert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dashibase%2Fdashibase-insert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dashibase%2Fdashibase-insert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dashibase","download_url":"https://codeload.github.com/Dashibase/dashibase-insert/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238264684,"owners_count":19443389,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["form","frontend","notion","supabase","tailwind","vue","webdev"],"created_at":"2024-09-24T13:40:42.556Z","updated_at":"2025-10-26T05:30:47.218Z","avatar_url":"https://github.com/Dashibase.png","language":"Vue","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg width=\"150\" src=\"./assets/dashibase-logo.png\"/\u003e\n\u003ch1 align=\"center\"\u003e\u003cb\u003eDashibase Insert\u003c/b\u003e\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n  Notion-esque form-builder for Supabase users.\n    \u003cbr /\u003e\n    \u003ca href=\"https://dashibase.com/insert\"\u003e\u003cstrong\u003eBuild your form now 📜\u003c/strong\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\nDesign your next form with a beautiful Notion-esque UI, integrated with your Supabase project.\n\nInspired by Notion and Tally, built with Vue, Tailwind and Supabase.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets/dashibase-insert.png\" style=\"border-radius: 10px;\" /\u003e\n  \u003cbr /\u003e\n  \u003cbr /\u003e\n  \u003ca href=\"https://dashibase.com/insert\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/It's%20free!-Sign%20up-%2322c55e\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://twitter.com/dashibase\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Twitter-00acee?logo=twitter\u0026logoColor=white\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://discord.gg/CqgZGh4ZA8\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Discord-5865F2?logo=discord\u0026logoColor=white\" /\u003e\n  \u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/github/license/dashibase/dashibase-insert\" /\u003e\n  \u003cbr /\u003e\n\u003c/p\u003e\n\n**We have a [hosted version](https://dashibase.com/insert) you can use for free!**\n\nBut we also open-sourced our code, warts and all, for folks interested in how we coded up a Notion-like interface with Vue (see `src/components/editor` for the relevant components) or wishing to self-host (see below for instructions).\n\nContributions welcome!\n\n**Have suggestions for what to work on next? Join our [Discord](https://discord.gg/qwMRgaChRx) and let us know!**\n\n---\n\n## Features\n\n- [x] Notion-esque UI - navigate with keyboard shortcuts or rearrange blocks and components\n- [x] Integrated with Supabase\n- [x] Automatically detect required columns based on table schema\n- [x] Automatically detect input types based on PostgreSQL data types\n- [x] Embed forms on your own sites and supports logged-in users and RLS (for hosted version)\n- [x] Add a password to restrict access to forms\n\n## Getting Started with Self-hosting\n\n**0. Set up your Supabase**\n\nIf you don't have a Supabase project yet, [head over](https://supabase.com) and create one.\n\nThen you'll need to create a table to store metadata about your forms.\n\nThe simplest way to do this would be to just run the following SQL snippet in the Supabase SQL Editor.\n\n```sql\nCREATE TABLE forms (\n  id uuid DEFAULT uuid_generate_v4(),\n  \"user\" uuid REFERENCES auth.users NOT NULL,\n  supabase_url text NOT NULL,\n  supabase_anon_key text NOT NULL,\n  table_id text NOT NULL,\n  title text DEFAULT '' NOT NULL,\n  blocks json DEFAULT '[]'::json NOT NULL,\n  button_label text DEFAULT 'Submit' NOT NULL,\n  -- Optional password_hash if setting password is supported, see Step 4\n  password_hash text NOT NULL,\n\n  PRIMARY KEY (id)\n)\n```\n\n**1. Clone this repository, go to the root directory and install packages**\n\n```bash\ngit clone https://github.com/dashibase/dashibase-insert\ncd dashibase-insert\nnpm i\n```\n\n**2. Configure environment variables**\n\nCreate a `.env` file with the following variables.\n\n```\nVITE_SUPABASE_URL=\u003cYOUR SUPABASE URL\u003e\nVITE_SUPABASE_ANON_KEY=\u003cYOUR SUPABASE ANON KEY\u003e\nVITE_TABLE_ID=forms\n```\n\n**3. Test it locally**\n\n```bash\nnpm run dev\n```\n\nBy default, this conjures a version of Dashibase Insert without embed or password support.\n\nYou should be able to log in with an account in your own Supabase project, then create and view forms.\n\n**4. Enable password setting**\n\nSetting a password entails more work for a few reasons:\n\n- We need something to hash the password on the backend when it is set - with Dashibase Insert, we use a Postgres trigger\n- We need something to validate the password on the backend when the form is requested - with Dashibase Insert, we use AWS Lambda\n\nThe following is sample code to create a possible Postgres function to run before the `forms` table is updated or inserted. Here we concat the password with the form ID and then hash that with SHA256.\n\n```sql\nCREATE FUNCTION hash_password()\nRETURNS trigger\nLANGUAGE plpgsql\nAS\n$$\nBEGIN\n  IF (OLD.password_hash IS DISTINCT FROM NEW.password_hash) THEN\n    IF NOT (NEW.password_hash = '') THEN\n      NEW.password_hash=digest(NEW.password_hash||NEW.id, 'sha256');\n    END IF;\n  END IF;\n  RETURN NEW;\nEND;\n$$;\n```\n\nThen the function can be added as a trigger with the following code.\n\n```sql\nCREATE TRIGGER hash_password BEFORE INSERT OR UPDATE ON forms\n  FOR EACH ROW EXECUTE FUNCTION hash_password();\n```\n\nHere is a sample of what the serverless function to validate passwords may look like. (If you are using AWS Lambda, see [here](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-package.html) for details about how to deploy Node.js Lambda functions with packages.)\n\n```js\nexports.handler = async (event) =\u003e {\n  const Supabase = require('@supabase/supabase-js')\n  const hash = require('hash.js')\n  const supabaseUrl = process.env.SUPABASE_URL\n  const supabaseAnonKey = process.env.SUPABASE_ANON_KEY\n  const supabase = Supabase.createClient(supabaseUrl, supabaseAnonKey)\n  await supabase.auth.signIn({\n    email: process.env.SUPABASE_EMAIL,\n    password: process.env.SUPABASE_PASSWORD,\n  })\n  const form_id = JSON.parse(event.body).form_id\n  const password = JSON.parse(event.body).password\n  let { data, error } = await supabase\n    .from(process.env.TABLE_ID)\n    .select('title,blocks,supabase_url,supabase_anon_key,password_hash,button_label,table_id')\n    .eq(\"id\", form_id)\n    .single()\n  if (error) {\n    return {\n      statusCode: 401,\n      body: JSON.stringify('No form found'),\n      headers: {\n        'Access-Control-Allow-Origin': '*',\n      },\n    }\n  }\n  if (data.password_hash) {\n    if (!password) {\n      // If password is required but not supplied, return 403  \n      return {\n        statusCode: 403,\n        body: JSON.stringify('Password required'),\n        headers: {\n          'Access-Control-Allow-Origin': '*',\n        },\n      }\n    } else {\n      // If password is supplied, run SHA256 on password concat with form ID,\n      // or whatever you did previously with your Postgres trigger\n      const password_hash = hash.sha256().update(password + form_id).digest('hex')\n      if (password_hash === data.password_hash.slice(2)) {\n        // If it matches, hurray return 200 with form details\n        return {\n          statusCode: 200,\n          body: JSON.stringify({\n            'title': data.title,\n            'blocks': data.blocks,\n            'supabase_url': data.supabase_url,\n            'supabase_anon_key': data.supabase_anon_key,\n            'table_id': data.table_id,\n            'button_label': data.button_label,\n          }),\n          headers: {\n            'Access-Control-Allow-Origin': '*',\n          },\n        }\n      } else {\n        // Otherwise return a 403\n        return {\n          statusCode: 403,\n          body: JSON.stringify('Incorrect password'),\n          headers: {\n            'Access-Control-Allow-Origin': '*',\n          },\n        }\n      }\n    }\n  }\n  // If password is not required, just return the form details   \n  return {\n    statusCode: 200,\n    body: JSON.stringify({\n      'title': data.title,\n      'blocks': data.blocks,\n      'supabase_url': data.supabase_url,\n      'supabase_anon_key': data.supabase_anon_key,\n      'table_id': data.table_id,\n      'button_label': data.button_label,\n    }),\n    headers: {\n      'Access-Control-Allow-Origin': '*',\n    },\n  }\n};\n```\n\nAfter setting these up, you can add your Serverless URL to your `.env` file and enable password setting.\n\n```\nVITE_LAMBDA_URL=\u003cYOUR LAMBDA URL\u003e\nVITE_ENABLE_PASSWORD=true\n```\n\nThen test it locally with the following.\n\n```bash\nnpm run dev\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdashibase%2Fdashibase-insert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdashibase%2Fdashibase-insert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdashibase%2Fdashibase-insert/lists"}