HomeCase studiesContinuous AI Compliance Management and Automated Audit...

Case study · Toronto, Canada

Continuous AI Compliance Management and Automated Audit Evidence Platform Built with Python, Next.js, and PostgreSQL

SOC 2, ISO 27001 & Audit Automation

Security and compliance teams spend months collecting screenshots, chasing engineers for configuration exports, and cross-mapping overlapping SOC 2, ISO 27001, and HIPAA controls before every external audit. We built an AI compliance management platform powered by Python evidence collectors, a Next.js governance workspace, and PostgreSQL control graphs. Automated cloud integrations pull live configuration snapshots on schedule, deterministic rule evaluators score control drift continuously, and citation-backed AI workflows map policies and draft auditor-ready gap assessments.

Industry
SOC 2, ISO 27001 & Audit Automation
Solution
A continuous compliance monitoring and AI policy-mapping platform uniting Python API collectors, deterministic control evaluators, PostgreSQL evidence ledgers, and a Next.js audit portal.
Platforms
Web & API
Stack
Python · Next.js · PostgreSQL · FastAPI · Celery · Redis
Location
Toronto, Canada · delivered remotely
Role
Engineering, with the team behind for mobile and QA

Delivered remotely for a business based in Toronto, Canada. Names withheld by agreement.

Project Overview

Preparing for an external audit still forces many software companies into seasonal fire drills: engineers pause product sprints to take timestamped cloud console screenshots, compliance leads hunt down stale spreadsheets of employee training completions, and sales teams wait weeks for answers to repetitive enterprise security questionnaires. Point-in-time compliance snapshots decay almost immediately after the auditor signs off.

Built for B2B software organizations and advisory firms in Toronto, we engineered an AI compliance management platform using Python, Next.js, and PostgreSQL. The system replaces manual evidence gathering with continuous read-only API collectors, evaluates infrastructure posture against unified control frameworks, and pairs deterministic compliance ledgers with citation-grounded AI policy mapping across web workspaces and external integration APIs.

Audit & Governance Friction

Compliance and security teams scaling across multiple regulatory regimes hit four persistent operational walls:

  • Framework overlap duplication: Supporting SOC 2 Type II alongside ISO 27001 and HIPAA forced teams to collect identical access-review and encryption proof multiple times under different control IDs.
  • Silent configuration drift: An engineer disabling branch protection or opening a temporary S3 bucket policy weeks after an audit went unnoticed until the next annual sampling window.
  • Unverifiable manual screenshots: Cropped UI screenshots lacked cryptographic provenance, forcing auditors to request live screen-sharing walkthroughs to confirm collection dates.
  • Risky AI policy wrappers: Generic LLM assistants summarizing security policies frequently hallucinated non-existent controls when answering customer DDQ spreadsheets.

Architectural Strategy

We separated deterministic control verification from semantic AI assistance. Technical pass/fail verdicts never depend on probabilistic language models; Python collectors fetch raw configuration state from cloud, identity, and version-control APIs and evaluate explicit policy assertions in code.

PostgreSQL serves as the single authoritative control graph—linking canonical internal controls to external framework clauses—while pgvector indexes approved corporate policy sections and historical auditor Q&A pairs inside the same transactional database. Next.js renders tailored views for internal control owners, executives, and read-only external auditors working inside scoped audit rooms.

Core Capabilities

  • Continuous Read-Only Evidence Collectors: Polls AWS, GCP, GitHub, Okta/Entra, Jira, and HRIS platforms via Celery workers to verify encryption, MFA, PR approvals, and offboarding SLAs.
  • Cross-Framework Control Mapping: Maps one technical test or policy document across SOC 2, ISO 27001, GDPR, and HIPAA simultaneously without redundant evidence uploads.
  • Cryptographically Anchored Audit Rooms: Grants external assessors scoped Next.js access to inspect pass/fail histories, exceptions, and SHA-256-hashed JSON evidence packages.
  • Citation-Grounded AI Policy & DDQ Assistant: Maps uploaded company policies to missing framework clauses and drafts security questionnaire answers strictly linked to live control states.
  • Real-Time Drift Remediation: Fires targeted Slack alerts and Jira tickets directly to asset owners whenever a monitored cloud resource falls out of compliance.

Technical Architecture

Scheduled and webhook-driven collection jobs run asynchronously on Celery queues coordinated by Redis. FastAPI exposes REST endpoints consumed by the Next.js server and external webhook integrations, committing normalized test outcomes and evidence metadata atomically into PostgreSQL while archiving signed raw JSON snapshots in encrypted object storage.

Flow: Read-Only Cloud / SaaS APIs → Celery Python Collectors → Deterministic Assertion Engine → SHA-256 Evidence Vault + PostgreSQL Control Graph & pgvector → FastAPI Backend → Next.js Governance & Auditor Portal + AI Citation Engine

Keeping pgvector inside PostgreSQL alongside relational control states eliminates synchronization lag between policy edits and AI retrieval. Whenever an engineering lead updates an incident response document or a technical check flips to failing, semantic retrieval sees the current state on the very next query.

Technology Stack

Category Technology detail
Governance Portal Next.js and TypeScript workspace for control dashboards, policy editors, and auditor rooms
Compliance API Python FastAPI managing tenant workspaces, integration credentials, and evidence exports
Relational Ledger PostgreSQL storing framework control graphs, test runs, and immutable evidence hashes
Semantic Mapping pgvector indexing corporate policies and past audit narratives for cross-framework matching
Collection Workers Celery task pools polling AWS, GCP, GitHub, IdPs, and HRIS APIs on scheduled cadences
Schedule & Cache Redis coordinating Celery beat schedules, distributed locks, and rate-limited API retries
Policy AI Layer Python LLM orchestration drafting gap analyses and questionnaire answers with strict citations
Evidence Vault Encrypted object storage preserving signed JSON snapshots and point-in-time audit bundles
Notification Bus Slack and Jira integrations alerting control owners immediately when drift occurs

Engineering Trade-offs & Solutions

Engineering Challenge Solution & Trade-off
Using LLMs to judge infrastructure compliance risks subtle false passes Restricted technical pass/fail assertions to deterministic Python rules against raw JSON APIs, confining AI to policy gap analysis and cited questionnaire drafting.
Running external vector databases creates stale sync windows after policy edits Used pgvector inside PostgreSQL so policy revisions, control ownership, and embeddings update inside single ACID transactions; trades massive-scale ANN tuning for strong consistency.
Aggressive polling across large cloud accounts triggers AWS and GitHub rate limits Implemented Redis-backed token-bucket throttling and incremental delta syncs in Celery workers, trading sub-minute refresh on static checks for reliable API citizenship.
Auditors require proof across an entire observation window rather than one snapshot Persisted daily immutable test-run hashes and exception sign-off logs in PostgreSQL so auditors inspect continuous Type II timelines effortlessly.

Security & Least-Privilege Access

A compliance hub concentrating cloud topology and HR offboarding signals becomes a prime target unless strictly scoped. Every integration enforces read-only permissions—such as AWS IAM cross-account audit roles with external IDs and minimal GitHub metadata scopes—explicitly refusing write access or unrelated employee payroll fields.

Tenant API secrets encrypt via envelope encryption using KMS-managed keys before landing in PostgreSQL. External auditor accounts authenticate into isolated read-only rooms scoped to specific observation dates, and all evidence bundle downloads emit signed audit log entries.

Performance & Collector Scalability

Enterprise customers monitor thousands of cloud resources, repositories, and personnel records concurrently. Celery distributes collection tasks across isolated queues by connector type, using Redis distributed locks so manual user "re-check now" clicks coalesce cleanly with scheduled nightly runs without duplicate API calls.

Next.js leverages server-side rendering and cached framework rollups for snappy dashboard navigation even across multi-framework views, while heavy auditor zip-bundle exports compile asynchronously in background workers and deliver via short-lived signed download links.

Operational Outcomes

Moving from annual screenshot marathons to continuous API verification and unified control mapping transformed audit operations across engineering and security teams:

  • Continuous audit readiness: Control owners catch unencrypted volumes or disabled MFA within hours rather than discovering gaps during external audit sampling.
  • Minimal engineering interruption: Automated read-only collectors eliminate ad-hoc Slack requests asking developers for console screenshots before compliance deadlines.
  • Multi-framework leverage: Canonical control graphs let teams expand from SOC 2 into ISO 27001 by reusing existing verified evidence rather than restarting from scratch.
  • Trustworthy AI acceleration: Strict grounding in live PostgreSQL control states speeds up policy gap reviews and customer security questionnaires without risking fabricated claims.

01 — Questions

asked about this kind of project

Do LLMs decide whether a technical security control passes or fails?

No. Technical controls—such as encryption at rest, MFA enforcement, branch protection, or backup retention—are evaluated strictly by deterministic Python assertions against raw cloud API responses. AI models assist solely with policy-to-control mapping, narrative gap summaries, and cited security questionnaire drafting.

How do external auditors trust automatically collected JSON evidence instead of manual screenshots?

Every evidence artifact is stored alongside its collection timestamp, source API endpoint, collector version, and SHA-256 hash inside PostgreSQL. Auditors inspect both the human-readable formatted table in Next.js and the cryptographically timestamped raw JSON payload.

How does the platform prevent duplicating work across SOC 2, ISO 27001, and HIPAA?

PostgreSQL models a canonical unified control catalog mapped many-to-many against external regulatory frameworks. A single automated check—like verifying SSO enforcement across production repositories—satisfies linked requirements across every active framework simultaneously.

How is least-privilege maintained when connecting to customer AWS, GitHub, or HR systems?

Integrations rely exclusively on read-only IAM roles, scoped OAuth apps, and minimal HR attribute filters—never requesting write permissions or unrelated employee payroll fields. Credentials are envelope-encrypted per tenant before persistence.

How do you stop AI questionnaire assistants from inventing security capabilities an organization lacks?

Drafted responses ground exclusively in verified PostgreSQL control statuses and indexed policy excerpts retrieved via pgvector. If an underlying technical check is failing or unmapped, the generator flags a coverage gap rather than fabricating compliance.

03 — Similar project?

describe what is different about yours

Build yours.

Tell me what exists, what you need and the deadline. Fixed price for a defined scope, or $55/day (8–9 hours work) with a written plan first.

Solitaire Corporate Park, Makarba, Ahmedabad, Gujarat 380015, India · IST (UTC+5:30) · --:-- IST · Mon–Fri 09:00–18:00 IST · US & EU overlap daily

No newsletter, no CRM. Just a reply.