Sample report. Fictional company, illustrative findings.

Back to the Architecture Audit

Architecture Audit Report

Corvane Freight

Overall: Amber. Salvage and stabilize.

Amber: a sound foundation with critical exposures to close first.

A B2B freight marketplace in the Philippines that matches shippers with carriers, runs bookings and invoices both sides.

Built by a previous agency over 18 months and inherited by a three-person in-house team. Feature delivery has slowed and invoice disputes are rising.

Scope
Architecture Audit: one product, 2 repositories (web app and API), 10 working days
Stack
React web app, Node.js API, PostgreSQL
Prepared by
Brainstorm IT
Signed by
Dan Ursoviciu (Founder) and Jarn Gotostos (CTO)

Executive summary

Corvane Freight is worth keeping. Shipments, loads, carriers and shippers are modelled correctly, and most of the API is maintainable. The team that inherited it can keep building on this foundation.

The risk is concentrated in four places: a payment secret in git history, an unscoped carrier endpoint, an invoicing module that overwrites its own history, and a release process with no safety net.

None of it needs a rewrite. The invoicing module needs a phased replacement behind the existing API. Everything else stabilizes in place within 30 days while the team keeps shipping. Two findings are critical and are fixed this week as hotfixes, before the first release cycle and before any new feature work.

Verdict: salvage or rebuild

Salvage and stabilize. Replace the invoicing module in phases.

  • The relational core is sound: the entities that matter are modelled the way the business works.
  • Invoicing is not: invoices are edited in place, money is stored as floating point, and there is no audit trail.
  • The blast radius of a typical change is contained everywhere except the booking controller.

Risk scorecard

PillarRatingSummary
Data Model & Schema IntegrityHighCore entities are sound. Invoicing stores money as floating point and overwrites history.
Security, Privacy & Access ControlCriticalA live payment-provider secret is in git history. Carrier accounts can read any shipper's rate sheets.
Performance & Reliability BottlenecksHighAn unbounded load-board query runs the API out of memory at month-end. No index on lane searches.
CI/CD & Release SafetyHighManual SSH deploys. Staging sends real email to carriers. No automated smoke tests.
Velocity & Codebase HygieneMediumA 2,800-line booking controller, three dependencies with known CVEs, no code-review gate.
  • Critical: Fix this week: active exposure or data loss
  • High: Fix within 30 days
  • Medium: Plan within the quarter
  • Low: Track

Top findings, ranked by business blast radius

  1. F-01CriticalSecurity, Privacy & Access Control

    Live payment-provider secret key in git history

    In plain words
    Anyone who has ever had access to the code could move money out of your payment account.
    Blast radius
    Anyone with past or present repository access can issue refunds and payouts.
    Evidence
    The key was committed in an early config file, removed later, and never rotated.
    Reproduction
    $ git log --all -p -S "sk_live_" -- config/
    commit 4e1a9c2 (14 months ago)
    +  PAYMENT_SECRET_KEY: "sk_live_51Hx...REDACTED"
    
    # Removed from the file 11 months ago, never rotated.
    # Provider dashboard: key active, last rotated: never.
    Fix
    Rotate the key, move secrets to the cloud secret manager, and add secret scanning to CI.
    Fix estimate
    1 to 2 engineer-days, USD 600 to 2,000 at typical senior market rates
  2. F-02CriticalSecurity, Privacy & Access Control

    Carrier accounts can read any shipper's rate sheets

    In plain words
    Any carrier can see the confidential prices you agreed with your largest customers.
    Blast radius
    Confidential pricing is exposed to every carrier, a contract and trust problem with the largest shippers.
    Evidence
    The endpoint checks that a user is logged in, not which company they belong to.
    Reproduction
    # Signed in as a carrier test account (company 311)
    GET /api/rate-sheets?shipperId=1042
    Authorization: Bearer <carrier-test-token>
    
    HTTP/1.1 200 OK
    { "shipperId": 1042, "lanes": 37, "rates": [...] }
    
    # Expected: 403 Forbidden
    Fix
    Scope every query by company, enforce roles in middleware, and add per-role tests.
    Fix estimate
    3 to 4 engineer-days, USD 1,800 to 4,000 at typical senior market rates
  3. F-03HighData Model & Schema Integrity

    Invoices are edited in place and stored as floating point

    In plain words
    When a customer disputes an invoice, you cannot show what it said before, and small rounding errors reach their statements.
    Blast radius
    Disputed invoices cannot be reconstructed, and rounding errors reach customer statements.
    Evidence
    Amounts sit in float columns, updates overwrite rows, and there is no history table.
    Reproduction
    => SELECT 0.1::float8 + 0.2::float8 = 0.3::float8;
     ?column?
     f
    
    => \d invoices
     amount  | double precision
    # No invoice_revisions table. UPDATE overwrites the row.
    Fix
    Move money to integer minor units, add append-only invoice revisions, then replace the invoicing module in phases behind the existing API.
    Fix estimate
    8 to 10 engineer-days for the first phase (integer money and append-only revisions), USD 4,800 to 10,000 at typical senior market rates. The full invoicing replacement is scoped after day 30.
  4. F-04HighPerformance & Reliability Bottlenecks

    The load board query is unbounded

    In plain words
    At month-end, when you are busiest, the system can crash and nobody can book.
    Blast radius
    The API runs out of memory at the month-end peak and bookings fail for every customer at once.
    Evidence
    The query returns every open load with no pagination and no composite index on origin, destination and pickup date.
    Reproduction
    => EXPLAIN ANALYZE SELECT * FROM loads WHERE status = 'open';
     Seq Scan on loads (rows=184212)
     Execution Time: 6940 ms
    
    # Month-end traffic replay on staging:
    # API heap 1.9 GB, process killed (out of memory)
    Fix
    Cursor pagination, a composite index, and a memory alert.
    Fix estimate
    2 to 3 engineer-days, USD 1,200 to 3,000 at typical senior market rates
  5. F-05HighCI/CD & Release Safety

    Staging is wired to live email and deploys are manual

    In plain words
    Your test system can send real emails to real carriers, and a bad update goes live with no way to undo it.
    Blast radius
    Test runs have emailed real carriers, and a bad deploy reaches customers with no rollback.
    Evidence
    Staging uses production email credentials, and deploys are run by hand over SSH.
    Reproduction
    $ grep SMTP_ .env.staging
    SMTP_HOST=smtp.live-provider.example
    SMTP_USER=notifications@corvane-freight.example
    
    # docs/deploy.md: "ssh prod, git pull, pm2 restart"
    Fix
    Sandbox credentials for staging, a CI pipeline with smoke tests, and one-command rollback.
    Fix estimate
    3 to 5 engineer-days, USD 1,800 to 5,000 at typical senior market rates
  6. F-06MediumVelocity & Codebase Hygiene

    Booking logic lives in one 2,800-line controller

    In plain words
    Changing one thing in the booking screens can quietly break another, which is why your team has slowed down.
    Blast radius
    Simple changes break unrelated screens, which is the main source of the stalled velocity.
    Evidence
    Pricing, availability and booking rules are interleaved in one file with no tests.
    Fix
    Characterization tests first, then extract pricing, availability and booking into separate modules.
    Fix estimate
    4 to 6 engineer-days for the characterization tests, USD 2,400 to 6,000 at typical senior market rates. Extracting the modules follows within the quarter.

30-day stabilization plan

This week (days 1 to 5, shipped as hotfixes ahead of release cycle 1)

Close the critical exposures

  • F-01: rotate the payment secret, move secrets to the secret manager, add secret scanning to CI
  • F-02: scope rate-sheet queries by company, enforce roles in middleware, add per-role tests

Release cycle 1 (days 1 to 14)

Make releases safe and remove the outage risk

  • F-05: sandbox credentials for staging, CI pipeline with smoke tests, one-command rollback
  • F-04: cursor pagination and a composite index on the load board, plus a memory alert

Release cycle 2 (days 15 to 30)

Stop the invoice drift and start untangling bookings

  • F-03: integer money columns and append-only invoice revisions as the first phase, with the phased replacement planned
  • F-06: characterization tests around the booking controller

Total for the 30-day plan: 21 to 30 engineer-days, USD 12,600 to 30,000 at typical senior market rates.

Method and limitations

Inspected

  • 2 repositories with full git history: the React web app (about 41,000 lines) and the Node.js API (about 68,000 lines)

Tools run

  • Secret scanning across the full git history
  • Dependency and CVE scan of both lockfiles
  • Static analysis for complexity and unsafe patterns
  • Query plans (EXPLAIN ANALYZE) on staging for the slowest queries
  • A month-end traffic replay on staging

Sessions held

  • Three working sessions: the operations lead on bookings, the finance lead on invoice disputes, and the in-house tech lead on releases

Reviewed by

  • Data model and security reviewed by Dan and Jarn. Scans run by the team under their supervision.

Not covered

  • Penetration testing
  • Load testing at production scale
  • Legal review

Appendix: If this were a Due Diligence Audit

A Due Diligence Audit adds this appendix for the investor or acquirer. It uses the same fictional company and the same findings. Illustrative deal context: an investor is considering a growth round on a plan to triple booking volume in 18 months.

Deal risk: Amber. Proceed with conditions.

Conditions to close

  • Rotate the F-01 payment key and confirm the rotation with the payment provider before close.
  • Fix and re-test F-02 (rate-sheet scoping) before close.
  • Agree a holdback or escrow sized to the invoicing replacement (F-03) until it ships.
  • Obtain a signed IP assignment from the former contractor, or have their modules rewritten, before close.

IP and open-source licensing

An AGPL-licensed PDF library is linked into the API that customers reach over the network, which can carry source-disclosure obligations. The former contractor who wrote the rate engine has no IP assignment on file. Payments and email run on standard SaaS providers that can be replaced in weeks. Flagged for your counsel. This is not legal advice.

Scalability headroom

Current peak is about 900 bookings an hour at month-end, which is already the ceiling: the load board query exhausts API memory at that level (F-04). After the F-04 fix the estimated ceiling is about 4,000 an hour on current hosting, above the roughly 2,700 an hour the growth plan needs. Cost to lift: the F-04 fix (2 to 3 engineer-days, USD 1,200 to 3,000 at typical senior market rates) plus about USD 300 to 500 a month more database capacity at 3x volume.

Team and key-person risk

One of the three in-house engineers understands invoicing, and none of it is documented or tested. We recommend a retention arrangement or a documented handover before close.

Data protection

Carrier personal data (driver names, mobile numbers, licence numbers) is copied unmasked into staging, and staging sends real email (F-05). For a business operating in the Philippines this is exposure under the Philippine Data Privacy Act of 2012, and there is no documented breach-response procedure. Flagged for your counsel. This is not legal advice.

What the full report contains

This sample shows the shape of the report. A real audit report also includes:

  • Every finding, not just the top six, with file and line references
  • The target data model and system blueprint: diagrams and schema specifications for core entities, permissions and integrations
  • The 30-day plan as tickets any senior engineer can pick up
  • A retainer proposal, as a separate, optional document sent only if you ask for it
  • A readout call with the people who did the audit
  • 30 days of email questions after the readout, plus one re-check of the Critical fixes once your team has made them

You own every deliverable, whether or not you hire us afterward.

Sample report. Fictional company, illustrative findings.

Want This for Your Codebase?

Tell Dan what you inherited. A 30-minute call is enough to scope the audit and confirm the price.

Talk to Dan
Talk to Dan

30 minutes with Dan and the people who would do the work