Commercial proposals builder with AI-powered editing capabilities, voice transcription, and vector search integration.
This project leverages a modern stack of cutting-edge tools and libraries:
- Next.js 16 - React framework with App Router
- React 19 - UI library
- TypeScript - Type-safe development
- Vercel AI SDK (
@ai-sdk/react,@ai-sdk/google,@ai-sdk/openai) - AI integration for chat and streaming- Used for AI-powered proposal editing with tool calling
- Supports Google Gemini 2.5 Pro and OpenAI models
- Enables streaming responses and tool execution
- Eleven Labs (
@elevenlabs/client,@elevenlabs/react)- Speech-to-Text (STT): Real-time audio transcription using Scribe v1 model
- Voice Features: Real-time voice interactions and audio processing
- Used in
/api/scribe-tokenand/server/routers/sttfor audio transcription
- Qdrant (
@qdrant/js-client-rest) - Vector similarity search- Used for client information storage and similarity matching
- Enables semantic search capabilities
- Configured in
lib/qdrant/client.ts
- oRPC (
@orpc/server,@orpc/client,@orpc/tanstack-query) - Type-safe RPC framework- Replaces traditional REST/GraphQL with type-safe RPC calls
- Integrated with TanStack Query for client-side data fetching
- Server routers in
server/routers/(chat, propal, stt)
- Trigger.dev Workflows (
workflow) - Background job processing- Used for async workflows (e.g.,
create-propal-workflow.ts) - Handles long-running tasks and background processing
- Used for async workflows (e.g.,
- PostgreSQL - Primary database
- Drizzle ORM (
drizzle-orm,drizzle-kit) - Type-safe SQL ORM- Schema definitions in
db/schema/ - Migrations managed with Drizzle Kit
- Schema definitions in
- TipTap (
@tiptap/*) - Headless rich text editor- Custom extensions for proposal editing
- Slash commands and custom blocks (pricing cards, feature lists, CTAs)
- Image upload integration with Vercel Blob
- Vercel Blob (
@vercel/blob) - File storage service- Handles image and file uploads
- Used in editor image uploads and form file uploads
- API route:
/api/upload/editor-images
- Radix UI - Accessible component primitives
- Tailwind CSS - Utility-first CSS framework
- Motion (
motion) - Animation library - React Hook Form - Form state management
- Zod - Schema validation
- Biome - Fast linter and formatter
- TanStack Query - Data fetching and caching
- nuqs - Type-safe URL search params
- Node.js 20+ and pnpm (package manager)
- Docker and Docker Compose (for local PostgreSQL)
- PostgreSQL 17+ (via Docker or local installation)
- API keys for:
- Eleven Labs (required)
- Qdrant (optional, for vector search)
- Attio (optional, for CRM integration)
- Vercel Blob (required for file uploads)
git clone <repository-url>
cd propal-builderpnpm installCopy the example environment file and configure your variables:
cp env.example .env
# or for local development
cp env.example .env.localEdit .env (or .env.local) and add your API keys
Start the PostgreSQL database:
docker compose up -dThis will start PostgreSQL on port 5555 with:
- Database:
db - User:
postgres - Password:
postgres
Check the package.json file for all available scripts. Here are the main ones:
- Development:
pnpm dev- Start Next.js dev server - Database:
pnpm db:migrate,pnpm db:push,pnpm db:studio,pnpm db:start,pnpm db:stop - Code Quality:
pnpm lint,pnpm format,pnpm typecheck,pnpm checks - Trigger.dev:
pnpm trigger:deploy,pnpm trigger:webhook
See the Development Scripts section below for a complete list.
propal-builder/
βββ app/ # Next.js App Router
β βββ api/ # API routes
β β βββ rpc/ # oRPC endpoint
β β βββ scribe-token/ # Eleven Labs token endpoint
β β βββ upload/ # File upload endpoints
β βββ dashboard/ # Dashboard pages
β β βββ propal/[id]/ # Proposal editor pages
β βββ _components/ # App-level components
β βββ workflows/ # Trigger.dev workflows
βββ components/ # Shared React components
β βββ ai/ # AI-related components
β βββ custom/ # Custom components
β βββ form/ # Form components
β βββ ui/ # UI primitives
βββ db/ # Database schema
β βββ schema/ # Drizzle schemas
βββ lib/ # Utility libraries
β βββ qdrant/ # Qdrant client
β βββ utils/ # Helper functions
βββ orpc/ # oRPC client configuration
βββ server/ # Server-side code
β βββ routers/ # oRPC routers
β β βββ chat/ # Chat router
β β βββ propal/ # Proposal router
β β βββ stt/ # Speech-to-text router
β βββ context.ts # Server context
βββ docker-compose.yml # PostgreSQL Docker setup
βββ drizzle.config.ts # Drizzle configuration
βββ env.ts # Environment validation
- Route:
/api/rpc/[[...rest]] - Type: oRPC router
- Routers:
chat- AI chat and message handlingpropal- Proposal CRUD operationsstt- Speech-to-text transcription
- Route:
/api/scribe-token - Method: GET
- Purpose: Generates single-use tokens for Eleven Labs Realtime Scribe API
- Route:
/api/upload/editor-images - Method: POST
- Purpose: Handles image uploads for the TipTap editor
- Supported formats: JPEG, PNG, WebP, GIF
- Max size: 10MB
- Route:
/api/webhooks/create-propal - Purpose: Webhook endpoint for creating proposals (Trigger.dev integration)
After modifying schema files:
pnpm db:generatepnpm db:migrateVisual database browser:
pnpm db:studioConnect directly to PostgreSQL:
psql -h localhost -p 5555 -U postgres -d db# Development
pnpm dev # Start Next.js dev server
pnpm db:start # Start PostgreSQL with Docker
pnpm db:stop # Stop PostgreSQL
# Database
pnpm db:generate # Generate migrations
pnpm db:migrate # Run migrations
pnpm db:push # Push schema (dev only)
pnpm db:studio # Open Drizzle Studio
# Code Quality
pnpm lint # Run Biome linter
pnpm format # Format code with Biome
pnpm typecheck # TypeScript type checking
pnpm checks # Run lint + typecheck
# Trigger.dev
pnpm trigger:deploy # Deploy Trigger.dev workflows
pnpm trigger:webhook # Test webhook locally- Sign up at elevenlabs.io
- Navigate to your profile settings
- Copy your API key
- Add to
.envasELEVENLABS_API_KEY
- Sign up at qdrant.tech or run locally
- Create a cluster or use Qdrant Cloud
- Get your cluster URL and API key
- Add to
.envasQDRANT_URLandQDRANT_API_KEY
- Go to Vercel Dashboard
- Create a Blob store
- Copy the
BLOB_READ_WRITE_TOKEN - Add to
.envasBLOB_READ_WRITE_TOKEN
- Sign up at attio.com
- Generate an API key
- Add to
.envasATTIO_API_KEY
The project is configured for Vercel deployment:
- Push your code to GitHub
- Import the project in Vercel
- Add environment variables in Vercel dashboard
- Deploy
The vercel.json includes build commands that run migrations automatically.
Set these in your Vercel project settings:
DATABASE_URL- Production PostgreSQL connection stringELEVENLABS_API_KEY- RequiredQDRANT_URL- OptionalQDRANT_API_KEY- OptionalBLOB_READ_WRITE_TOKEN- Required for file uploadsATTIO_API_KEY- Optional
Vercel-specific variables (VERCEL_URL, VERCEL_ENV, etc.) are automatically set.