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.