DEV Community

From Paperwork Mountains to Digital Freedom: Building an IDP Solution with Kiro

Challenge: Office Staff Drowning in Paperwork

Every morning, Mai arrives at the government office where she works. Her desk is already piled high with paper documents - citizen applications, official reports, meeting minutes, and forms that need to be digitized.

Like thousands of office workers, Mai faces an exhausting daily routine:

  • 💢Type for hours: Manually transcribing each document into Word
  • 💢 Hunt for errors: Reviewing for typos and formatting mistakes
  • 😫 Work overtime: Staying late to finish the backlog
  • 😫 Feel exhausted: Repeating the same tedious task every single day

A single 5-page official document takes 30-45 minutes to transcribe. With dozens arriving daily, Mai is overwhelmed.

What if there was a better way?

The Vision: AI-Powered Document Processing

I wanted to build a solution where office staff could:

  1. Take photos with their smartphone camera
  2. Wait 30 seconds while AI processes them
  3. Download perfectly formatted Word documents
  4. Done! Ready to review and distribute

But I had a problem: I didn't know where to start.

  • How do I use AWS Bedrock for OCR?
  • How do I create properly formatted Word documents?
  • How do I preserve Vietnamese document headers?
  • How do I build a web interface?
  • How do I deploy on AWS?

That's when I turned to Kiro — my AI coding assistant.

Building with Kiro: The Journey

Step 1: The Initial Request

I started with a simple question to Kiro:

Me: "Given the AWS Bedrock Converse API and Claude Sonnet 4, build an AI solution to OCR images from a folder and convert them to Word DOCX files. Prefer Python. Search the internet for references."

Kiro immediately got to work:

Kiro searching for resources

Within minutes, Kiro had:

  • Fetched AWS Bedrock Converse API documentation
  • Researched python-docx library
  • Created complete project structure
  • Generated working code

Step 2: Fine-Tuning for Vietnamese Documents

The first version worked, but Vietnamese official documents have a special two-column header format that wasn't captured correctly.

My Request:

Me: "The phrase 'CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM' should be in a table with two columns. Left column has organization info, right column has the country header and date."

Kiro's Response:

Kiro understanding Vietnamese document structure

Kiro immediately:

  1. Updated the OCR prompt to detect two-column headers
  2. Modified create_docx.py to parse structured markup
  3. Created borderless tables for proper formatting
  4. Tested the changes automatically
# Kiro's clever solution - Structured OCR prompt
STRUCTURED_OCR_PROMPT = """
For Vietnamese official document headers with two columns, output as:
[HEADER_TABLE]
[LEFT]
organization line 1
organization line 2
Số: xx /TB-xxx
[/LEFT]
[RIGHT]
CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM
Độc lập - Tự do - Hạnh phúc  
Tp. xxx, ngày xx tháng xx năm xxxx
[/RIGHT]
[/HEADER_TABLE]
"""
Enter fullscreen mode Exit fullscreen mode

Result: Perfect two-column headers!

Step 3: Intelligent Multi-Page Grouping

I wanted images with similar names (doc-1.png, doc-2.png) to be combined into one Word file (doc.docx).

My Request:

Me: "If images have names with the same prefix but different numbers after a hyphen (e.g. tb-1, tb-2), group them into one DOCX file (e.g. named 'tb') with multiple pages."

Kiro's Implementation:

Kiro implementing grouping logic

Kiro created a smart filename parser:

def get_prefix_and_page(filename: str) -> tuple:
    """
    Extract prefix and page number from filename.
    Examples:
        'invoice-1.png' -> ('invoice', 1)
        'report_2.jpg' -> ('report', 2)
        'standalone.png' -> ('standalone', 0)
    """
    stem = Path(filename).stem
    match = re.match(r'^(.+?)[-_](\d+)$', stem)

    if match:
        return match.group(1), int(match.group(2))
    return stem, 0
Enter fullscreen mode Exit fullscreen mode

Result: Automatic multi-page document creation!

Step 4: Building the Web Interface

Manual CLI was working, but I needed a user-friendly web interface.

My Request:

Me: "Deploy a website that accepts image uploads, stores them in a S3 bucket, processes with Bedrock, outputs DOCX files, and provides download links."

Kiro's Response:

Kiro creating Flask app

Within minutes, Kiro built:

  • Complete Flask web application
  • Drag & drop upload interface
  • S3 integration for storage
  • Session management for multi-user support
  • Download functionality with presigned URLs
  • HTML templates
@app.route('/upload', methods=['POST'])
def upload_files():
    """Handle file upload and processing"""
    files = request.files.getlist('files')
    session_id = str(uuid.uuid4())[:8]

    # Upload to S3
    for file in files:
        s3_key = f"images/{session_id}/{filename}"
        s3_client.upload_file(local_path, S3_BUCKET, s3_key)

        # OCR with Bedrock
        text = ocr_image_with_bedrock(local_path)
        ocr_results[filename] = text

    # Create grouped DOCX files
    create_grouped_documents(ocr_results)
Enter fullscreen mode Exit fullscreen mode

Step 5: UI/UX Enhancement

The first UI worked but looked basic. I wanted something modern.

My Request:

Me: "The dashboard icons and colors look unacceptable. Search for modern color schemes and upgrade the UI."

Kiro transformed the interface with:

  • Modern dark theme with purple/blue gradients
  • Glassmorphism effects on cards
  • Animated background patterns
  • Mobile-responsive design
  • Success animations for feedback
/* Kiro's modern design system */
:root {
    --primary: #6366f1;
    --secondary: #0ea5e9;
    --accent: #8b5cf6;
    --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #0ea5e9 100%);
}
Enter fullscreen mode Exit fullscreen mode

Result: Beautiful professional interface!

You can upload 2 image files with naming convention such as - and click Convert to DOCX.

It will take a while, around 1 minute to complete.

Demo

Please watch this demo at https://haianh-sing.s3.ap-southeast-1.amazonaws.com/2026-01-06+21-56-16.mp4.

What We Built Together

After working with Kiro for just 1 hour, we had a complete, production-ready Intelligent Document Processing platform that would have taken days to build manually.

The Power of AI-Assisted Development

Features Kiro Built

  • AI-Powered OCR: Claude Sonnet 4 with 95%+ accuracy
  • Mobile-First: Works with any smartphone camera
  • Vietnamese Support: Preserves official document formatting
  • Multi-Page: Automatic grouping by filename
  • Web Interface: Beautiful, responsive dark theme design
  • Cloud-Native: AWS S3, Bedrock, EC2 Graviton (ARM64)
  • Secure: IAM roles with least-privilege access
  • Cost-Effective: $0.003 per page
  • Production-Ready: Deployed to AWS with monitoring

Getting Started: Deploy Your Own System

Prerequisites

AWS Account Setup:

  1. AWS Account with Bedrock access in us-west-2
  2. Enable Claude Sonnet 4 model in Bedrock console
  3. Create IAM user with admin access (for initial setup)

Local Development:

  1. Python 3.9 or higher installed
  2. AWS CLI configured (aws configure)
  3. Git installed

Quick Start (5 Minutes)

Deployment on EC2

Step 1: Create IAM Role

# File iam-trust-policy.json containing trust policy
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "S3BucketAccess",
            "Effect": "Allow",
            "Action": [
                "s3:CreateBucket",
                "s3:PutObject",
                "s3:GetObject",
                "s3:ListBucket",
                "s3:DeleteObject",
                "s3:HeadBucket"
            ],
            "Resource": [
                "arn:aws:s3:::ocr-to-docx",
                "arn:aws:s3:::ocr-to-docx/*"
            ]
        },
        {
            "Sid": "BedrockInvoke",
            "Effect": "Allow",
            "Action": [
                "bedrock:InvokeModel"
            ],
            "Resource": "*"
        }
    ]
}

# Create role with trust policy
aws iam create-role \
    --role-name Image2Docx-EC2-Role \
    --assume-role-policy-document file://iam-trust-policy.json

# Attach permissions policy
aws iam put-role-policy \
    --role-name Image2Docx-EC2-Role \
    --policy-name Image2Docx-Policy \
    --policy-document file://iam-policy.json

# Create instance profile
aws iam create-instance-profile \
    --instance-profile-name Image2Docx-EC2-Profile

# Add role to profile
aws iam add-role-to-instance-profile \
    --instance-profile-name Image2Docx-EC2-Profile \
    --role-name Image2Docx-EC2-Role
Enter fullscreen mode Exit fullscreen mode

Step 2: Launch EC2 Instance

# Launch Graviton instance (ARM64 - cost efficient)
aws ec2 run-instances \
    --image-id ami-xxxxxxxxx \  # Amazon Linux 2023 ARM64
    --instance-type t4g.micro \
    --key-name your-key-pair \
    --security-group-ids sg-xxxxxxxxx \
    --iam-instance-profile Name=Image2Docx-EC2-Profile \
    --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=Image2Docx-Server}]'
Enter fullscreen mode Exit fullscreen mode

Step 3: Configure Security Group

# Allow inbound HTTP on port 8080
aws ec2 authorize-security-group-ingress \
    --group-id sg-xxxxxxxxx \
    --protocol tcp \
    --port 8080 \
    --cidr 0.0.0.0/0

# Allow SSH for administration
aws ec2 authorize-security-group-ingress \
    --group-id sg-xxxxxxxxx \
    --protocol tcp \
    --port 22 \
    --cidr your-ip-address/32
Enter fullscreen mode Exit fullscreen mode

Step 4: Deploy Application

# SSH to instance
ssh -i "your-key.pem" ec2-user@<EC2-PUBLIC-IP>

# Update system
sudo yum update -y

# Install dependencies
sudo yum install -y git python3-pip

# Clone repository
git clone https://github.com/PNg-HA/Image2Docx.git
cd Image2Docx

# Install Python packages
pip3 install -r requirements.txt

# Run application in background
nohup python3 app.py > app.log 2>&1 &

Enter fullscreen mode Exit fullscreen mode

Step 5: Access Your Application

Open browser and navigate to:

http://<EC2-PUBLIC-IP>:8080
Enter fullscreen mode Exit fullscreen mode

Success! Your intelligent documentation platform is live.


Conclusion: From Vision to Reality in 1 Hour with Kiro

We started with a simple question: "Can we help office staff escape the paperwork trap?"

The answer is a resounding YES. But what's even more remarkable is HOW we did it.

This platform is my contribution to eliminating paperwork drudgery and freeing office workers. But more importantly, this project proves that anyone with vision and AI assistance can build transformative solutions.

What will you build with Kiro?

Top comments (3)

Collapse
 
meo_meo_57bd45733cfa1795f profile image
Meo Meo

Wonderful

Collapse
 
im_30_5ea5333ed389fbaa6 profile image
điểm 30

niceeeeeee

Collapse
 
trn_v_b35c476ea8ec64991 profile image
Trần Vĩ

🤗