Skip to content

About

A full-stack Typeform-builder built with Next.js, TypeScript, Django REST Framework and PostgreSQL.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypeForm Builder — Full-Stack Conversational Form Assignment

TypeForm Builder is an original full-stack conversational form builder inspired by high-level interaction patterns from Typeform. It covers creator form management, an ordered eight-type builder, autosave, publication, an anonymous one-question-at-a-time respondent flow, strict persistent submissions, and creator response summaries, lists, and detail views.

TypeForm Builder is not affiliated with Typeform. It does not use Typeform code or proprietary assets, and it does not claim exact authenticated-builder parity. The implementation, product wording, visual system, seed data, and architecture are original.

Links

Screenshots

Creator dashboard Complete builder
TypeForm Builder creator dashboard TypeForm Builder complete form builder
Public respondent flow Response detail
TypeForm Builder public respondent flow TypeForm Builder response detail

What works

  • Creator dashboard: list, create, rename, duplicate, soft-delete, publish/unpublish, stable public links, response counts, and Results navigation.
  • Builder: ordered questions/options, drag-and-drop plus keyboard/move controls, all eight required types, live preview, permissive draft autosave, strict publish validation, and protected published edits.
  • Respondent: public no-login route, one question at a time, keyboard navigation, progress, local answer restoration, client/server validation, stale-definition recovery, atomic submission, and a confirmation screen.
  • Results: current-question summary cards, honest historical option-label buckets, newest-first submissions, complete snapshot detail, explicit unanswered values, and historical-version notices.
  • Data: relational SQLite schema for local development and verification, protected historical references, deterministic demo forms/responses, and idempotent create-once seeding.

Required local versions

The verified workspace versions are:

Runtime Verified version
Node.js 24.18.0
pnpm 11.14.0
Python 3.12.10
Django 5.2.16
Django REST Framework 3.17.1

Use Python 3.12 explicitly. Do not let the Windows launcher select Python 3.14 or 3.11 for this project.

First-time setup on Windows PowerShell

Clone the public repository and enter its root directory. backend/.env.example documents the backend runtime variables. Set a secure local development value for the required secret in the current PowerShell session before running Django commands:

git clone https://github.com/rai-manas/Typeform_Builder.git
Set-Location Typeform_Builder
$env:DJANGO_SECRET_KEY="replace-with-a-secure-local-development-key"

# Confirm and create the Python 3.12 backend environment
py -3.12 --version
py -3.12 -m venv backend\.venv
Set-Location backend
.\.venv\Scripts\python.exe -m pip install -r requirements.txt
.\.venv\Scripts\python.exe manage.py migrate
.\.venv\Scripts\python.exe manage.py seed_demo_data

# Install the locked frontend dependencies
Set-Location ..\frontend
pnpm install --frozen-lockfile

If the Windows Python launcher is unavailable, use a python command that python --version confirms is Python 3.12, then run python -m venv backend\.venv from the repository root. Do not create this project environment with Python 3.11 or 3.14.

Dependency versions and licenses were reviewed before installation and are recorded in docs/originality-and-sources.md.

Environment variables

Backend:

  • DJANGO_SECRET_KEY — required; use a secure generated value locally and configure it through the hosting platform in production.
  • DJANGO_DEBUG — optional; defaults to True only when absent for local development and must be false on Railway.
  • DJANGO_ALLOWED_HOSTS — optional comma-separated hostnames; defaults to 127.0.0.1,localhost locally and will contain the Railway backend domain in production.
  • DJANGO_CORS_ALLOWED_ORIGINS — optional comma-separated browser origins; defaults to http://localhost:3000 and will contain the exact Vercel frontend origin after deployment.
  • DJANGO_CSRF_TRUSTED_ORIGINS — optional comma-separated trusted origins; defaults to an empty list and will contain the HTTPS backend/Admin origin on Railway.
  • DATABASE_URL — optional locally; when present, selects PostgreSQL with persistent checked connections and production SSL. When absent, SQLite with IMMEDIATE transactions remains unchanged.

Railway build runtime:

  • RAILPACK_PYTHON_VERSION pins Railway's build/runtime interpreter to the project's verified Python 3.12.10 version.

Frontend:

  • NEXT_PUBLIC_API_BASE_URL — browser-visible Django API base. It defaults in code to http://127.0.0.1:8000/api; Vercel will set it to the future Railway backend URL including /api.

The example files are backend/.env.example and frontend/.env.example. They contain placeholders or local-safe values only. Deployment remains pending.

Run locally

From the cloned repository root, open two PowerShell windows.

Backend:

Set-Location backend
$env:DJANGO_SECRET_KEY="replace-with-a-secure-local-development-key"
.\.venv\Scripts\python.exe manage.py runserver 127.0.0.1:8000

Frontend:

Set-Location frontend
pnpm dev

Open http://localhost:3000/forms. Use localhost, not 127.0.0.1, for the frontend because CORS deliberately permits only http://localhost:3000.

Useful routes:

Route Purpose
/forms Creator dashboard
/forms/{formId}/build Builder
/forms/{formId}/responses Summary and newest-first responses
/forms/{formId}/responses/{submissionId} Snapshot response detail
/f/{slug} Public respondent flow
http://127.0.0.1:8000/admin/ Separate Django Admin login

The architecture deliberately names creator result routes /responses, matching the approved architecture document, rather than the later checkpoint prompt's fallback /results wording.

Demo data

Run the seed command at any time:

Set-Location backend
.\.venv\Scripts\python.exe manage.py seed_demo_data

On a fresh database it creates two published original demos with stable slugs, five questions each, three submissions each, and coverage of all eight question types. Re-running the command preserves an existing reserved demo rather than overwriting edits or appending duplicates. See docs/seed-data.md.

Verification

Backend:

Set-Location backend
.\.venv\Scripts\python.exe manage.py check
.\.venv\Scripts\python.exe manage.py makemigrations --check --dry-run
.\.venv\Scripts\python.exe manage.py migrate --check
.\.venv\Scripts\python.exe manage.py test

Frontend:

Set-Location frontend
pnpm typecheck
pnpm lint
pnpm test
pnpm build

The final Checkpoint 7 pass found 78 backend tests and 106 frontend tests passing. The backend deployment-preparation pass now finds 89 backend tests, including settings, health, SQLite transaction, and PostgreSQL lock-routing coverage. The production frontend build includes the dashboard, builder, public form, response overview, and response-detail routes.

Repository structure

Typeform_Builder/
├── backend/
│   ├── config/
│   └── forms_app/
├── frontend/
│   ├── app/
│   ├── features/
│   └── lib/
├── docs/
├── .gitignore
└── README.md

Architecture in one minute

Next.js client components
        |
        | native fetch through frontend/lib/api.ts only
        v
Django REST Framework API
        |
        | explicit services + short transactions
        v
SQLite relational schema (local development and verification)
  • Next.js App Router files stay thin; interactive state lives in feature components.
  • Browser requests go directly to Django. There are no Next.js API proxies, Server Actions, server-component API reads, Redux, or a general cache layer.
  • DRF denies unannotated endpoints by default. Every local assignment endpoint explicitly opts into AllowAny with no session authentication.
  • Django Admin remains separate with normal session authentication and CSRF.
  • Local development and verification use SQLite. Its IMMEDIATE transactions let a submission reserve the writer before revision validation and snapshot creation.
  • The planned production deployment will use PostgreSQL. Definition mutations and public submissions then acquire the same Form-row select_for_update() lock inside their atomic transaction; SQLite deliberately does not use that API.
  • PostgreSQL deployment and production migration have not yet been completed. Mocked routing tests verify that PostgreSQL paths request the row lock, but they do not replace a live database concurrency test.

The detailed rationale is in docs/architecture-proposal.md, and a beginner-oriented file walkthrough is in docs/code-tour.md.

Relational schema

The five models are:

  • Form: creator-owned definition, draft/published lifecycle, stable slug, fixed preset key, soft deletion, and monotonic definition revision.
  • Question: ordered active/archived question with one of eight controlled types.
  • QuestionOption: ordered active/archived multiple-choice or dropdown option.
  • Submission: accepted form title and definition-revision snapshot.
  • Answer: one row for every active submitted question, including unanswered optional questions, with protected references and wording/order/type/required/value snapshots.

Protected references and snapshots serve different jobs: protected foreign keys preserve identity; snapshots preserve what the respondent actually saw. Full form versioning is intentionally not introduced.

API outline

The local API base is http://127.0.0.1:8000/api.

  • GET /health/ returns {"status":"ok"} without authentication or database mutation.
  • Creator definition endpoints cover forms, lifecycle, questions, options, and reorder operations.
  • GET /public/forms/{slug}/ returns a published public-safe definition.
  • POST /public/forms/{slug}/submissions/ strictly validates and atomically persists a complete response.
  • GET /forms/{formId}/submissions/ returns newest-first snapshot previews.
  • GET /forms/{formId}/submissions/{submissionId}/ returns every persisted snapshot answer.
  • GET /forms/{formId}/summary/ returns current-question counts and supported aggregates.

All expected API failures use {code, message, field_errors, question_errors}. The complete shapes and validation matrix are in docs/api.md.

Important correctness rules

  • Draft definitions may be temporarily incomplete; publish validates the complete active form.
  • Published forms permit wording/required/option-label/reorder edits, but structural changes require unpublishing.
  • Every successful definition/public-availability mutation increments definition_revision exactly once.
  • The respondent submits the accepted revision. A stale revision returns HTTP 409 before any row is created; the UI retains compatible answers and requires an explicit reload/review.
  • A successful submission creates exactly one Answer for every active question in the accepted definition.
  • Response detail always renders snapshots. Summary choice/dropdown rows remain separate for the same option ID when historical labels differ.

User journeys to demonstrate

  1. Create a draft from /forms, open it, add/edit/reorder questions, and observe autosave state.
  2. Preview all required controls, finish the definition, publish it, and copy its stable /f/{slug} link.
  3. Complete the public form using keyboard or pointer controls, submit, and see the confirmation state.
  4. Return to the dashboard, confirm the increased count, open Results, inspect aggregate cards, then open a complete response.
  5. Unpublish a form and confirm its historical responses remain inspectable; republishing preserves the slug.

Assumptions and limitations

  • This is a local demo with one server-resolved creator. It is intentionally not production authentication; anyone who can reach the local assignment API can mutate demo data.
  • No pagination is needed at the approved assignment scale.
  • Text/email/number summaries show counts only; no speculative sentiment, word cloud, or numeric analytics are invented.
  • Previous/next response navigation is omitted because it would add list context to an otherwise simple deterministic detail route.
  • Fixed Paper/Ink respondent presets satisfy the required visual scope. There is no creator-editable theme system.
  • Branching, integrations/webhooks, team collaboration, payments, file upload, advanced ending customization, CSV export, partial-response tracking, and dark mode remain documented optional/placeholders rather than implemented features.
  • Authenticated Typeform builder evidence was unavailable. The UI is audited and Typeform-inspired, but no claim of exact or close builder parity is made.
  • Visual tokens remain original and adjustable; they are not Typeform proprietary values.

Originality

No Typeform clone repository, copied implementation, dashboard template, proprietary asset, logo, font, or private source was used. The project uses original wording, CSS, seed records, state helpers, and architecture. Official public/Help Center material informed only high-level interaction observations documented in docs/typeform-audit.md.

Delivery status

The GitHub repository is public, and the verified local TypeForm Builder implementation is complete. Environment-aware Django settings, PostgreSQL dependencies, database-aware locking, static handling, and deployment configuration are prepared for review. Deployment using Vercel for the Next.js frontend and Railway for the Django backend and PostgreSQL database is complete.

Pending Railway deployment values

Create one Railway PostgreSQL service and one backend service from this repository. For the backend service, use these exact project settings:

Railway setting Value
Service root directory /backend
Config file path /backend/railway.json
Build command python -m pip install -r requirements.txt && python manage.py collectstatic --noinput
Pre-deploy command python manage.py migrate --noinput
Start command gunicorn config.wsgi:application --bind 0.0.0.0:$PORT
Health-check path /api/health/

Configure these Railway service variables before the first deployment:

Variable Production value
DJANGO_SECRET_KEY A newly generated secret value; never commit it.
DJANGO_DEBUG false
DJANGO_ALLOWED_HOSTS The Railway backend hostname only, without scheme or path.
DJANGO_CORS_ALLOWED_ORIGINS The exact future Vercel HTTPS origin.
DJANGO_CSRF_TRUSTED_ORIGINS The Railway backend HTTPS origin used for Admin/CSRF.
DATABASE_URL Railway's PostgreSQL reference variable, normally ${{Postgres.DATABASE_URL}}.
RAILPACK_PYTHON_VERSION 3.12.10

Railway supplies PORT; do not set it manually. The checked-in configuration never seeds on deployment. After the first successful migration, run this once from the Railway backend service shell or command runner if demo content is wanted:

python manage.py seed_demo_data

The seed command is idempotent for its two reserved demo slugs, but production data should still be backed up before any manual data operation. Vercel deployment remains a later phase; set NEXT_PUBLIC_API_BASE_URL there to the final Railway URL ending in /api only after the backend domain is live.

About

A full-stack Typeform-builder built with Next.js, TypeScript, Django REST Framework and PostgreSQL.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages