···11# Lively Forms
2233-Lively Forms is a Typeform-inspired conversational form builder built with Next.js, Auth.js, Prisma, PostgreSQL, Tailwind, Framer Motion, and dnd-kit.
33+Lively Forms is a conversational form builder inspired by Typeform. It lets creators build multi-step forms, publish them publicly, collect anonymous responses, and review/export submissions across personal or shared organization workspaces.
44+55+## Features
66+77+### Form building
88+- Master-detail form builder with block reordering
99+- Supported block types:
1010+ - text
1111+ - short text
1212+ - long text
1313+ - single choice
1414+ - multiple choice
1515+ - number
1616+ - link
1717+ - agreement
1818+ - date
1919+- Required questions
2020+- Type-specific validation:
2121+ - text regex validation
2222+ - number min/max and integer-only rules
2323+ - link validation
2424+ - date validation
2525+ - agreement validation
2626+- Publish / unpublish controls
2727+- Shareable public form slugs
2828+- Custom completion title, message, and optional follow-up link
2929+3030+### Branching and flow logic
3131+- Forward-only branching between later blocks
3232+- Default next target when no branch rule matches
3333+- Operator-based conditions by block type:
3434+ - equals / not equals
3535+ - is empty / is not empty
3636+ - contains
3737+ - contains any
3838+ - greater / greater-or-equal / less / less-or-equal
3939+- Builder-side branching validation with publish blockers and advisory warnings
4040+- Branch-aware public runner with visited-path navigation and recalculated progress
4141+- Submission validation only for blocks actually visited in the chosen route
4242+4343+### Responses
4444+- Anonymous public submissions
4545+- Response list and response detail views
4646+- Branched response review with visited and skipped route context
4747+- CSV and XLSX response export
4848+4949+### Workspaces and collaboration
5050+- Personal workspace
5151+- Organization workspaces
5252+- Organization owner administration
5353+- Invite links for joining organizations
5454+- Shared form management inside organizations
5555+5656+### Creator experience
5757+- Google sign-in for creators
5858+- Dashboard grid and table views with sorting
5959+- Profile settings for name, avatar, and locale
6060+- Light / dark / system theme preference
6161+- Localized UI in English and Russian
462563## Stack
664765- Next.js App Router
866- TypeScript
967- Tailwind CSS
1010-- shadcn/ui-style local primitives
6868+- Auth.js (`next-auth`) with Google OAuth
6969+- Prisma + PostgreSQL
7070+- dnd-kit
1171- Framer Motion
1212-- dnd-kit
1313-- Auth.js (`next-auth`) with Google OAuth for creators
1414-- Prisma + PostgreSQL
7272+- Bun for package management
1573- Podman Compose for local Postgres
16741717-## Local setup
1818-1919-### 1. Install dependencies
7575+## Quick start
20762177```bash
2278bun install
2323-```
2424-2525-### 2. Start Postgres with Podman
2626-2727-```bash
2828-bun run db:up
2929-```
3030-3131-This uses `compose.yaml` and starts a local Postgres container on `localhost:5432`.
3232-3333-### 3. Create local env file
3434-3535-```bash
3679cp .env.example .env
3737-```
3838-3939-Fill in:
4040-- `AUTH_SECRET`
4141-- `AUTH_GOOGLE_ID`
4242-- `AUTH_GOOGLE_SECRET`
4343-- `NEXTAUTH_URL` (keep `http://localhost:3000` for local dev)
4444-4545-Generate a secret, for example:
4646-4747-```bash
4848-openssl rand -base64 32
4949-```
5050-5151-### 4. Configure Google OAuth for local development
5252-5353-Yes — Google OAuth can work locally, but you must create your own OAuth client in Google Cloud and allow localhost.
5454-5555-In Google Cloud Console:
5656-5757-1. Open **APIs & Services → Credentials**
5858-2. Create an **OAuth 2.0 Client ID**
5959-3. Choose **Web application**
6060-4. Add these local settings:
6161-6262-**Authorized JavaScript origins**
6363-- `http://localhost:3000`
6464-6565-**Authorized redirect URIs**
6666-- `http://localhost:3000/api/auth/callback/google`
6767-6868-Then copy the generated values into `.env`:
6969-7070-```env
7171-AUTH_GOOGLE_ID="your-client-id"
7272-AUTH_GOOGLE_SECRET="your-client-secret"
7373-```
7474-7575-If these values are missing or wrong, Google will show:
7676-- `Error 401: invalid_client`
7777-- `The OAuth client was not found`
7878-7979-### 5. Run Prisma migration
8080-8181-```bash
8080+bun run db:up
8281bun run prisma:migrate
8383-```
8484-8585-### 6. Start the app
8686-8787-```bash
8882bun run dev
8983```
90849185Open `http://localhost:3000`.
8686+8787+You must also configure Google OAuth for local development. See [docs/deployment.md](docs/deployment.md).
92889389## Useful commands
9490···9995bun run db:up
10096bun run db:down
10197bun run db:logs
9898+bun run db:reset
10299bun run prisma:generate
103100bun run prisma:migrate
104101bun run prisma:studio
105102```
106103107107-## Product surfaces
104104+## Docs
108105109109-### Creator app
110110-- `/dashboard`
111111-- `/forms/[id]/edit`
112112-- `/forms/[id]/responses`
113113-- `/forms/[id]/responses/[responseId]`
114114-115115-### Public app
116116-- `/f/[slug]`
117117-118118-## Current v0 scope
119119-120120-- Creator Google sign-in
121121-- Owned form dashboard
122122-- Master-detail builder
123123-- Block types:
124124- - text
125125- - short text
126126- - long text
127127- - single choice
128128- - multiple choice
129129-- Publish / unpublish
130130-- Anonymous public submissions
131131-- Responses list and detail views
106106+- [Development](docs/development.md)
107107+- [Deployment and environment setup](docs/deployment.md)
132108133109## Notes
134110135135-- Creator auth is used only for creating, editing, publishing, and reviewing forms.
136136-- Public respondents do not log in.
111111+- Creator authentication is only required for building, publishing, and reviewing forms.
112112+- Public respondents do not sign in.
137113- Responses are stored anonymously.
138138-- Editing a published form updates the live public form immediately in v0.
114114+- Editing a published form updates the live form immediately.
+114
docs/deployment.md
···11+# Deployment and environment setup
22+33+This project is a Next.js app backed by PostgreSQL and Auth.js with Google OAuth.
44+55+## Required environment variables
66+77+Copy `.env.example` to `.env` and provide values for:
88+99+```env
1010+DATABASE_URL="postgresql://..."
1111+AUTH_SECRET="replace-with-a-long-random-string"
1212+AUTH_GOOGLE_ID="your-google-client-id"
1313+AUTH_GOOGLE_SECRET="your-google-client-secret"
1414+NEXTAUTH_URL="http://localhost:3000"
1515+```
1616+1717+Generate a strong auth secret, for example:
1818+1919+```bash
2020+openssl rand -base64 32
2121+```
2222+2323+## Local development setup
2424+2525+### 1. Install dependencies
2626+2727+```bash
2828+bun install
2929+```
3030+3131+### 2. Start PostgreSQL
3232+3333+```bash
3434+bun run db:up
3535+```
3636+3737+This uses `compose.yaml` and starts Postgres on `localhost:5432`.
3838+3939+### 3. Run Prisma migrations
4040+4141+```bash
4242+bun run prisma:migrate
4343+```
4444+4545+### 4. Start the app
4646+4747+```bash
4848+bun run dev
4949+```
5050+5151+## Google OAuth setup
5252+5353+Create your own Google OAuth client in Google Cloud Console.
5454+5555+### Local OAuth settings
5656+5757+Use these values during local development:
5858+5959+**Authorized JavaScript origins**
6060+- `http://localhost:3000`
6161+6262+**Authorized redirect URIs**
6363+- `http://localhost:3000/api/auth/callback/google`
6464+6565+If these values are missing or incorrect, Google sign-in will fail.
6666+6767+### Production OAuth settings
6868+6969+For a deployed environment, replace `localhost` with your real domain.
7070+7171+Example:
7272+7373+**Authorized JavaScript origins**
7474+- `https://your-domain.example`
7575+7676+**Authorized redirect URIs**
7777+- `https://your-domain.example/api/auth/callback/google`
7878+7979+Set `NEXTAUTH_URL` to the same public base URL.
8080+8181+## Production deployment checklist
8282+8383+1. Provision a PostgreSQL database.
8484+2. Set the required environment variables.
8585+3. Configure Google OAuth for the production domain.
8686+4. Install dependencies:
8787+8888+ ```bash
8989+ bun install
9090+ ```
9191+9292+5. Run production database migrations:
9393+9494+ ```bash
9595+ bunx prisma migrate deploy
9696+ ```
9797+9898+6. Build the app:
9999+100100+ ```bash
101101+ bun run build
102102+ ```
103103+104104+7. Start the server with your process manager of choice:
105105+106106+ ```bash
107107+ bun run start
108108+ ```
109109+110110+## Notes
111111+112112+- The build runs translation validation before Next.js production build.
113113+- Response exports are generated inside the app; no separate worker is required.
114114+- Editing a published form updates the live public form immediately.
+121
docs/development.md
···11+# Development
22+33+This document covers day-to-day local development for Lively Forms.
44+55+## Prerequisites
66+77+- Bun
88+- Podman + Podman Compose
99+- PostgreSQL container support via `compose.yaml`
1010+- A Google OAuth client for creator sign-in during local development
1111+1212+## Local setup
1313+1414+```bash
1515+bun install
1616+cp .env.example .env
1717+bun run db:up
1818+bun run prisma:migrate
1919+bun run dev
2020+```
2121+2222+Open `http://localhost:3000`.
2323+2424+For environment variables and OAuth setup details, see [deployment.md](./deployment.md).
2525+2626+## Daily workflow
2727+2828+### Start the database
2929+3030+```bash
3131+bun run db:up
3232+```
3333+3434+### Start the app
3535+3636+```bash
3737+bun run dev
3838+```
3939+4040+### Stop the database
4141+4242+```bash
4343+bun run db:down
4444+```
4545+4646+### View database logs
4747+4848+```bash
4949+bun run db:logs
5050+```
5151+5252+### Reset the local database volume
5353+5454+```bash
5555+bun run db:reset
5656+```
5757+5858+## Database workflow
5959+6060+Generate Prisma client after schema changes:
6161+6262+```bash
6363+bun run prisma:generate
6464+```
6565+6666+Create and apply a local migration during development:
6767+6868+```bash
6969+bun run prisma:migrate
7070+```
7171+7272+Open Prisma Studio:
7373+7474+```bash
7575+bun run prisma:studio
7676+```
7777+7878+## Quality checks
7979+8080+Run lint:
8181+8282+```bash
8383+bun run lint
8484+```
8585+8686+Run a production build:
8787+8888+```bash
8989+bun run build
9090+```
9191+9292+Notes:
9393+- `bun run build` also validates translation resources before the Next.js build.
9494+- There is currently no separate test suite command in `package.json`.
9595+9696+## Important directories
9797+9898+- `app/` — App Router pages, layouts, and API routes
9999+- `components/` — UI and feature components
100100+- `lib/` — business logic, auth, forms, branching, i18n, exports
101101+- `locales/` — translation YAML files
102102+- `prisma/` — schema and migrations
103103+- `docs/` — project documentation
104104+- `openspec/` — product/spec workflow artifacts
105105+106106+## Important files
107107+108108+- `lib/blocks.ts` — block types, config parsing, branch operator support
109109+- `lib/branching.ts` — branching resolution and validation helpers
110110+- `lib/forms.ts` — form loading, publish flow, submission shaping, response access
111111+- `components/form-builder.tsx` — creator builder shell
112112+- `components/form-builder-panels.tsx` — block settings and branching controls
113113+- `components/public-form-runner.tsx` — public respondent flow
114114+115115+## Notes for contributors
116116+117117+- Use `bun` commands for project workflows.
118118+- Creator routes require authentication; public form routes do not.
119119+- Responses are stored anonymously.
120120+- Editing a published form updates the live public form immediately.
121121+- When changing UI copy, update both `locales/en.yml` and `locales/ru.yml`.