Skip to main content
This guide covers setting up VATextractfor local development or self-hosted deployments.

Prerequisites

  • Node.js 18+
  • PostgreSQL database
  • OCR provider credentials (Google Document AI or AWS Textract)

Environment Variables

Create a .env file based on .env.example:
# Authentication (Clerk)
CLERK_PUBLISHABLE_KEY=pk_...
CLERK_SECRET_KEY=sk_...
CLERK_WEBHOOK_SECRET=whsec_...

# Database
DATABASE_URL=postgresql://user:password@host:5432/invoiceparse

# AWS (for Textract or S3 storage)
AWS_ACCESS_KEY_ID=AKIA...
AWS_SECRET_ACCESS_KEY=...
AWS_REGION=us-east-1
AWS_S3_BUCKET=your-bucket

# App URL
NEXT_PUBLIC_APP_URL=http://localhost:5000

OCR Provider Configuration

Set the OCR_PROVIDER environment variable:
ValueProvider
documentaiGoogle Document AI (default)
textractAWS Textract Expense Analysis
textract-openaiHybrid: Textract + OpenAI
OCR_PROVIDER=documentai
Requires Google Cloud credentials with Document AI API enabled.

Database Setup

Initialize the database with Prisma:
# Generate Prisma client
npx prisma generate

# Push schema to database
npx prisma db push

Email Forwarding (Optional)

To enable email forwarding, configure Postmark:
POSTMARK_WEBHOOK_USERNAME=your-username
POSTMARK_WEBHOOK_PASSWORD=your-password
Set up a Postmark inbound webhook pointing to:
https://your-domain.com/api/webhooks/inbound-email

Running Locally

# Install dependencies
npm install

# Start development server
npm run dev
The app runs at http://localhost:5000.

Production Deployment

  1. Connect your repo to Vercel
  2. Add environment variables in project settings
  3. Deploy

Docker

FROM node:18-alpine
WORKDIR /app
COPY . .
RUN npm ci
RUN npm run build
CMD ["npm", "start"]

Troubleshooting

Ensure your DATABASE_URL is correct and the PostgreSQL server is accessible.
Check that your OCR provider credentials are set and the service is enabled in your cloud console.