# Agent V3 Quiform Smoke

A premium Quiform-like form builder SaaS for small businesses. Create beautiful forms, collect responses, analyze data, and grow your business.

## Features

✅ **Form Builder** - Drag-and-drop builder with multiple field types
✅ **Live Preview** - See your form as respondents see it
✅ **Submissions** - Track and manage all responses in one place
✅ **Analytics** - Get insights on form performance
✅ **Templates** - Pre-built templates for common use cases
✅ **Settings** - Team management, billing, and integrations
✅ **Mock Database** - SQLite backend for data persistence

## Tech Stack

- **Frontend**: HTML5, CSS3, Vanilla JavaScript
- **Backend**: Node.js, Express.js
- **Database**: SQLite3
- **Hosting**: Self-hosted (can run locally)

## Installation

### Prerequisites
- Node.js (v16+)
- npm (v8+)
- Git

### Quick Start

```bash
# Clone or navigate to workspace
cd /workspace

# Install dependencies
npm install

# Setup database and start server
node setup.js
node server.js
```

### Manual Setup

```bash
# Install dependencies
npm install

# Create database and seed data
node -e "const sqlite3 = require('sqlite3').verbose(); const db = new sqlite3.Database('./data/quiform.db'); const fs = require('fs'); db.exec(fs.readFileSync('./data/schema.sql', 'utf8'), () => { console.log('Database created'); db.close(); });"

# Start server
node server.js
```

## Running the Application

```bash
# Start the development server
node server.js

# Server will run on:
http://localhost:3000
```

## Project Structure

```
/workspace/
├── public/
│   ├── index.html          # Landing page
│   ├── dashboard.html      # Main dashboard
│   ├── builder.html        # Form builder canvas
│   ├── preview.html        # Live form preview
│   ├── forms.html          # Forms list
│   ├── submissions.html    # Submissions inbox
│   ├── analytics.html      # Analytics dashboard
│   ├── templates.html      # Templates gallery
│   ├── settings.html       # Settings page
│   ├── css/
│   │   └── styles.css      # Global styles
│   ├── js/
│   │   └── app.js          # Frontend application
│   └── assets/
├── data/
│   ├── schema.sql          # Database schema
│   ├── seed.sql           # Seed data
│   └── quiform.db         # SQLite database
├── server.js               # Backend server
├── package.json            # Dependencies
├── setup.js               # Setup script
├── README.md              # This file
├── DELIVERY.md            # Delivery documentation
└── project-manifest.json  # Project metadata
```

## API Documentation

### Forms
- `GET /api/forms` - List all forms
- `GET /api/forms/:id` - Get form details
- `POST /api/forms` - Create new form
- `PUT /api/forms/:id` - Update form
- `DELETE /api/forms/:id` - Delete form

### Fields
- `GET /api/forms/:formId/fields` - List form fields
- `POST /api/forms/:formId/fields` - Add field
- `PUT /api/forms/:formId/fields/:fieldId` - Update field
- `DELETE /api/forms/:formId/fields/:fieldId` - Delete field

### Submissions
- `GET /api/submissions` - List submissions
- `GET /api/submissions/:id` - Get submission details
- `GET /api/submissions/:id/values` - Get submission values
- `POST /api/submissions/:formId/submit` - Submit form
- `PUT /api/submissions/:id` - Update submission status
- `DELETE /api/submissions/:id` - Delete submission

### Analytics
- `GET /api/analytics/overview` - Dashboard overview
- `GET /api/analytics/submissions` - Daily submissions
- `GET /api/analytics/fields` - Field analytics

### Templates
- `GET /api/templates` - List templates
- `POST /api/templates` - Create template

### Settings
- `GET /api/settings` - Get user settings

### Webhooks
- `GET /api/webhooks` - List webhooks
- `POST /api/webhooks` - Create webhook

## Features Roadmap

### Completed ✅
- Form builder with field types
- Live preview
- Submissions management
- Analytics dashboard
- Templates gallery
- Settings page
- Mock database backend

### In Progress
- Team collaboration
- Custom domain support
- Email notifications

### Planned
- Export to CSV/PDF
- API integrations
- Custom CSS themes
- Conditional logic
- Payment field integration
- Signature field
- File upload

## Browser Compatibility

- Chrome/Edge (latest)
- Firefox (latest)
- Safari (latest)
- Mobile browsers

## Support

For issues and questions, please open an issue in the repository.

## License

MIT License - see LICENSE file for details.

## Demo

The demo runs locally at `http://localhost:3000`

**Demo Credentials:**
- Email: admin@quiform.test
- Password: demo (mock)

## Development

```bash
# Run in development mode
npm run dev

# Rebuild after changes
npm run build
```
