Note: This application was developed as part of a B2B competition (UGotIT) for a Polish client (AB Bechcicki). Therefore, the application interface, business logic, internal documents (like
Instrukcja.md), and variables are in Polish to meet the client's direct requirements.
SmartOffer is an agent designed to automate and accelerate the quotation process in the B2B construction sector. The solution integrates with a massive product database (nearly 100,000 PIM indexes), analyzes user intents and attachments, and generates precise, print-ready material quotes in real-time.
- Live Quote Generation: Automatically builds a document with itemized lists, calculating net/gross totals based on natural conversation.
- Multimodality: Supports text, voice queries, and analyzes attached files and investment photos.
- Large-scale Knowledge Base: Seamlessly searches through 97,751 PIM products using PostgREST API and vector mechanisms.
- Event-Driven Architecture: Continuous listening and data exchange with the AI agent (n8n) via a secure Reverse Proxy on AWS.
Our system is based on a modern, modular microservices architecture:
- Frontend / UI (Next.js 14+): Serves the user interface and acts as a Reverse Proxy for the internal API (bypassing AWS port restrictions).
- AI Orchestrator (n8n): The brain of the system. Receives webhooks from the frontend, manages thread memory, and communicates with LLMs.
- Data API (PostgREST): A high-performance server in a container that automatically translates REST queries to SQL queries.
- Database (PostgreSQL + pgvector): Relational engine storing the PIM product structure.
- Storage (AWS S3): Used for importing initial PIM data packages (CSV).
- Next.js (React) - For building the web application and handling UI and proxy routing.
- n8n - For AI agent logic and workflow automation.
- PostgreSQL + PostgREST - For high-performance data querying.
- Docker & Docker Compose - For environment immutability and easy deployment on EC2.
Important Note: This solution was originally deployed on a dedicated AWS infrastructure provided by the UGotIT competition organizers (including pre-configured S3 buckets, n8n instances, and network rules). These resources are no longer active post-competition. The following instructions are preserved for historical reference and as a guide for potential future deployments in a similar environment.
- Infrastructure: AWS EC2 instance with Linux (e.g., Ubuntu or Amazon Linux).
- Software:
dockeranddocker-composeinstalled. - Network (AWS Security Groups): Port
80(HTTP) must be open for external traffic. Ports5432and3000function securely only within the internal Docker network.
Clone the repository:
git clone <repository-url> smartoffer
cd smartofferCreate and configure the .env file:
cp .env.example .envRequired variables in .env:
# Database
DB_USER=admin
DB_PASS=your_secure_password
DB_NAME=bechcicki_pim
DB_PORT=5432
DB_HOST=127.0.0.1
# AI Gateway
AI_GATEWAY_KEY=your_ai_gateway_key
# AWS S3 (Initial Data Import)
AWS_ACCESS_KEY_ID=your_aws_access_key
AWS_SECRET_ACCESS_KEY=your_aws_secret_key
S3_BUCKET=your-data-bucket-name
CSV_FILE_KEY=data.csv
# Frontend / API Configuration
N8N_WEBHOOK_URL=https://n8n.ugotit.pl/webhook/zapytanie-b2b
NEXT_PUBLIC_API_URL=http://api:3000The application uses Docker Compose. To build the images and run the environment in the background, execute:
docker-compose up -d --build