AI-powered cross-referencing of construction submittals against project specifications and plan documents
An intelligent system that automatically analyzes construction submittals against project specifications and plan documents using AI, helping project managers identify compliance issues, missing requirements, and inconsistencies quickly and accurately.
- π€ AI-Powered Analysis - GPT-4o/mini models for intelligent cross-referencing
- π Document Processing - OCR support for PDFs, images, and Excel files
- π Plan Document Analysis - Compare submittals against both specs AND construction plans
- π Multi-Tenant Architecture - Company isolation with role-based access control
- π Real-Time Cost Tracking - Monitor AI usage costs and set budgets
- π§ Email Notifications - Automated alerts via Resend
- β‘ Background Processing - Redis-based async job queue
- π¨ Modern UI - Next.js 15 with React 19 and Tailwind CSS
- π Confidence Scoring - AI confidence levels for each finding with explanations
- π Analytics Dashboard - Track reviews, costs, and compliance metrics
- ποΈ Document Management - Upload and delete documents across all types
Required:
- Docker and Docker Compose (v2.0+)
- Node.js 20+ (for frontend development)
- Python 3.11+ (for backend development)
Accounts Needed:
- Supabase - Authentication (free tier available)
- OpenAI - AI models (pay-as-you-go)
- Resend - Email notifications (free tier available)
-
Clone the repository
git clone https://github.com/jesusr04/Submittal_Review.git cd Submittal_Review -
Configure environment variables
cp .env.example .env
Edit
.envand set the following required variables:# Supabase (from your Supabase project settings) SUPABASE_URL=https://your-project.supabase.co SUPABASE_ANON_KEY=your-anon-key SUPABASE_JWT_SECRET=your-jwt-secret # OpenAI (from https://platform.openai.com/api-keys) OPENAI_API_KEY=sk-... # Resend (from https://resend.com/api-keys) RESEND_API_KEY=re_... EMAIL_FROM_ADDRESS=noreply@yourdomain.com
-
Start all services
docker-compose up -d
This starts:
- PostgreSQL database (port 5432)
- Redis cache (port 6379)
- MinIO storage (port 9000, console 9001)
- Backend API (port 8000)
- Frontend app (port 3000)
-
Run database migrations
docker-compose exec backend alembic upgrade head -
Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Docs (Swagger): http://localhost:8000/docs
- API Docs (ReDoc): http://localhost:8000/redoc
- MinIO Console: http://localhost:9001 (user:
minioadmin, pass:minioadmin)
For active development without Docker:
cd backend
# Create and activate virtual environment
python -m venv .venv
.venv\Scripts\activate # Windows PowerShell
# source .venv/bin/activate # Linux/Mac
# Install dependencies
pip install -r requirements.txt -r requirements-dev.txt
# Set environment variables
# Copy .env.example to .env and configure
# Run migrations
alembic upgrade head
# Start development server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000cd frontend
# Install dependencies
npm install
# Set environment variables
# Create .env.local with:
# NEXT_PUBLIC_API_URL=http://localhost:8000
# NEXT_PUBLIC_SUPABASE_URL=your-url
# NEXT_PUBLIC_SUPABASE_ANON_KEY=your-key
# Start development server
npm run devUsing Docker (recommended):
# Database is automatically created by docker-compose
docker-compose exec backend alembic upgrade headManual PostgreSQL setup:
# Create database
createdb submittal_review
# Update .env with connection string:
# DATABASE_URL=postgresql://user:pass@localhost:5432/submittal_review
# Run migrations
cd backend
alembic upgrade headBackend:
- Framework: FastAPI (Python 3.11+)
- Database: PostgreSQL 15
- Cache: Redis 7
- Storage: MinIO (S3-compatible)
- AI: OpenAI GPT-4o / GPT-4o-mini
- OCR: Tesseract
- Auth: Supabase JWT
Frontend:
- Framework: Next.js 15 (React 19)
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: Radix UI primitives
- State: React Context + Hooks
- API Client: Axios
Infrastructure:
- CI/CD: GitHub Actions
- **Contain Development
cd backend
# Activate virtual environment
.venv\Scripts\activate # Windows
# source .venv/bin/activate # Linux/Mac
# Code quality checks
ruff check . # Lint
ruff format . # Format
mypy app --ignore-missing-imports # Type check
# Run tests
pytest # All tests
pytest tests/test_api/ # API tests only
pytest tests/test_services/ # Service tests only
pytest -v --cov=app # With coverage
# Database migrations
alembic revision --autogenerate -m "Description" # Create migration
alembic upgrade head # Apply migrations
alembic downgrade -1 # Rollback one migration
# Start development server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000cd frontend
# Code quality checks
npm run lint # ESLint
npm run type-check # TypeScript
npm run format # Prettier (if configured)
# Run tests
npm test # All tests
npm test -- --watch # Watch mode
npm test -- --coverage # With coverage
# Build
npm run build # Production build
npm run start # Start production server
# Start development server
npm run dev-
Create the endpoint in
backend/app/api/v1/:from fastapi import APIRouter, Depends from app.auth.dependencies import require_auth router = APIRouter() @router.get("/my-endpoint") async def my_endpoint(user=Depends(require_auth)): return {"message": "Hello"}
-
Add Pydantic schemas in
backend/app/schemas/:from pydantic import BaseModel class MyResponse(BaseModel): message: str
-
Include router in
backend/app/main.py:from app.api.v1 import my_module app.include_router(my_module.router, prefix="/api/v1", tags=["My Module"])
-
Add TypeScript types in
frontend/lib/types.ts:export interface MyResponse { message: string; }
-
Add API client method in
frontend/lib/api.ts:async getMyData(): Promise<MyResponse> { const { data } = await this.client.get('/my-endpoint'); return data; }
-
Write tests in
backend/tests/test_api/and `frontend/tests/ β βββ layout.tsx # Root layout β βββ components/ β β βββ layout/ # AppShell, navigation β β βββ ui/ # Reusable UI components β β βββ analytics/ # Charts & dashboards β βββ contexts/ # React contexts β βββ hooks/ # Custom hooks β βββ lib/ β β βββ api.ts # API client β β βββ types.ts # TypeScript types β β βββ supabase.ts # Supabase client β βββ tests/ # Jest tests (52+ tests) β βββ package.json β βββ docs/ # Documentation β βββ API_DOCUMENTATION.md # Comprehensive API docs β βββ USER_GUIDE.md # User manual β βββ .github/workflows/ # CI/CD β βββ ci.yml # Test & lint β βββ docker-build.yml # Docker images β βββ docker-compose.yml # Development stack βββ .env.examp
- β Authentication & Authorization - Supabase JWT auth with RBAC
- β Multi-Tenant Architecture - Company-level data isolation
- β Project Management - Create and organize projects
- β Specification Management - Upload and organize spec sections
- β Submittal Management - Track submittals and revisions
- β File Upload & Storage - PDF, images, Excel via MinIO/S3
- β Document Processing - Text extraction with PyMuPDF and pdfplumber
- β OCR Processing - Tesseract OCR for scanned documents
- Authentication: Supabase JWT tokens with automatic expiration
- Authorization: Role-based access control (Admin, Project Manager, Contractor, Viewer)
- Multi-Tenancy: Company-level data isolation in database
- Input Validation: Pydantic schemas on all API endpoints
- SQL Injection Protection: SQLAlchemy ORM with parameterized queries
- File Security: Type validation, size limits, and secure storage
- CORS Configuration: Whitelist-based CORS policy
- Environment Variables: Secrets stored in
.env(not committed) - HTTPS: TLS/SSL required in production
- Never commit
.envfiles or secrets to Git - Rotate API keys regularly (OpenAI, Resend, database passwords)
- Use strong Supabase JWT secrets (256-bit minimum)
- Enable Supabase RLS (Row Level Security) policies
- Monitor API usage and set rate limits
- Review audit logs regularly
- Keep dependencies updated (
pip-audit,npm audit)
- API Documentation - Complete API reference
- User Guide - End-user manual
- Development Tracker - Development progress
- Swagger UI - Interactive API docs (when running)
- ReDoc - Alternative API docs (when running)
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
pytestandnpm test) - Run linters (
ruff check .andnpm run lint) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Use the PR template
- Ensure all CI checks pass
- Include tests for new features
- Update documentation as needed
- Keep PRs focused on a single feature/fix
- Check
.envhas all required variables - Ensure PostgreSQL is running:
docker-compose ps - Check database connection:
docker-compose logs backend - Verify migrations are applied:
docker-compose exec backend alembic current
- Verify
NEXT_PUBLIC_API_URLin.env.local - Check CORS settings in
backend/app/config.py - Ensure backend is running:
curl http://localhost:8000/health
- Check OpenAI API key is valid
- Monitor rate limits:
GET /api/v1/reviews/costs/dashboard - Check OpenAI status: https://status.openai.com/
- Try
review_mode: "quick"for faster processing
- Rollback:
alembic downgrade -1 - Check alembic version:
alembic current - View migration history:
alembic history - Manual fix: Connect to database and inspect tables
- Check MinIO is running:
docker-compose ps minio - Verify MinIO credentials in
.env - Check bucket exists: http://localhost:9001
- Check file size limits in
backend/app/config.py
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: [your-email@example.com]
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenAI - GPT-4o and GPT-4o-mini models
- Supabase - Authentication and database hosting
- FastAPI - High-performance Python web framework
- Next.js - React framework for production
- Radix UI - Accessible component primitives
- Tailwind CSS - Utility-first CSS framework
Built with β€οΈ for the construction industrysts** - 233 backend + 52 frontend tests
- β CI/CD - GitHub Actions for testing and Docker builds
- β API Documentation - OpenAPI/Swagger + ReDoc
- π§ Visual Marking System - Document annotations with a/A marks
- π§ Split View - Side-by-side spec/submittal comparison
- π§ Human Override Workflow - Review and approve/reject AI findings
- π§ Advanced Analytics - Historical trends and predictive insights
- π§ Export Reports - CSV/Excel export of findings
- π§ Revision Comparison - Compare submittal revisions
- π§ Approval Workflows - Multi-stage approval processes
- π§ Webhooks - Real-time event notifications
- π§ Mobile App - iOS and Android apps
cd backend
# Create virtual environment
python -m venv .venv
.venv\Scripts\activate # Windows
source .venv/bin/activate # Linux/Mac
# Install dependencies
pip install -r requirements.txt -r requirements-dev.txt
# Run linting
ruff check .
ruff format .
# Run tests
pytest
# Start server
uvicorn app.main:app --reloadcd frontend
# Install dependencies
npm install
# Run linting
npm run lint
# Run type checking
npm run type-check
# Run tests
npm test
# Start development server
npm run dev- Authentication - Supabase Auth with role-based access
- Project Management - Create and organize projects
- File Upload - Upload specs and submittals (PDF, images, Excel)
- OCR Processing - Extract text from scanned documents
- AI Review - Cross-reference submittals against specifications
- Findings Display - View compliance issues with confidence scores
- Notifications - Email alerts when reviews complete
- JWT-based authentication via Supabase
- Role-based access control (Admin, Project Manager, Contractor)
- Input validation on all endpoints
- Rate limiting to prevent abuse
- Secure file handling with virus scanning