Softwr

APIs · head to head

AWS API Gateway vs Mocha

AWS API Gateway logo

AWS API Gateway

APIs

Fully managed API gateway service for creating and managing APIs at scale

From
Free
Free plan
Yes
Mocha logo

Mocha

Testing

JavaScript test framework for Node.js and the browser, an OpenJS Foundation project

From
Free
Free plan
Yes

The short version

  • AWS API Gateway is a fully managed service.
  • Mocha is free; AWS API Gateway starts at $1/mo.
  • Only AWS API Gateway lists REST APIs; only Mocha lists BDD, TDD, QUnit and other interfaces.
  • Where AWS API Gateway falls short: REST APIs cost $3.50 per million calls against $1.00 for HTTP APIs, so the older and more featureful type is three and a half times dearer.
  • Where Mocha falls short: no built-in mocking or spy tools; these come from add-on libraries.

How do AWS API Gateway and Mocha differ?

AWS API Gateway and Mocha differ on pricing model (Usage-based against Open-source) and category (APIs against Testing). Only the attributes on which AWS API Gateway and Mocha actually diverge.

Attributes where AWS API Gateway and Mocha differ
AttributeAWS API GatewayMocha
Pricing modelUsage-basedOpen-source
CategoryAPIsTesting

Identical on both: starting price (Free), free tier (Yes), platforms (Web).

Not yet recorded: founded for Mocha.

Which features does each one have?

They share no listed features; 9 appear only for AWS API Gateway and 7 only for Mocha. Drawn from each product's published feature list. An absence here means we hold no record of it - not that the product lacks it.

Only in AWS API Gateway

  • REST APIs
  • WebSocket APIs
  • HTTP APIs
  • Lambda
  • EC2
  • DynamoDB
  • CloudWatch
  • IAM

Only in Mocha

  • Node.js and browser support
  • BDD, TDD, QUnit and other interfaces
  • Asynchronous test support
  • Parallel mode
  • Multiple reporters
  • Hooks and global fixtures
  • Retryable tests

What is each one used for?

AWS API Gateway is most often brought in for fronting Lambda functions with an HTTP endpoint; Mocha for unit testing Node.js code. The jobs each tool is most often brought in to do.

AWS API Gateway

  • Fronting Lambda functions with an HTTP endpointnot Mocha
  • REST and HTTP API management with throttling and keysnot Mocha
  • WebSocket APIs for real-time clientsnot Mocha
  • Private APIs reachable only inside a VPCnot Mocha
  • Publishing a developer portal for API consumersnot Mocha

Mocha

  • Unit testing Node.js codenot AWS API Gateway
  • Browser-based testsnot AWS API Gateway
  • Asynchronous API testsnot AWS API Gateway
  • Choosing a reporter for CInot AWS API Gateway

Where do AWS API Gateway and Mocha fall short?

AWS API Gateway's most cited limit: data transfer out is charged at $0.09 per GB on top of request pricing. Mocha's: no built-in mocking or spy tools; these come from add-on libraries. Documented limitations, not opinions. Every one is a constraint you would hit in normal use.

AWS API Gateway

  • REST APIs cost $3.50 per million calls against $1.00 for HTTP APIs, so the older and more featureful type is three and a half times dearer
  • Data transfer out is charged at $0.09 per GB on top of request pricing
  • WebSocket APIs bill connection minutes as well as messages, at $0.25 per million minutes
  • Private APIs avoid data transfer charges but incur AWS PrivateLink costs instead
  • The developer portal is $125 a month, with additional portal products at $12.50 each
  • The free tier lasts 12 months rather than being ongoing

Mocha

  • No built-in mocking or spy tools; these come from add-on libraries
  • Assertion and coverage libraries are added separately
  • Tests run serially by default; parallel mode is opt-in
  • Browser testing needs your own pages and setup

How much do AWS API Gateway and Mocha cost?

AWS API Gateway has a free plan, with paid plans from $1/mo; Mocha is free to use. Plan by plan below, from each vendor's own pricing page.

AWS API Gateway

Free
  • Free Tier (12 months)Free
    • 1M REST API calls per month
    • 1M HTTP API calls per month
    • 1M WebSocket messages plus 750K connection minutes per month
  • HTTP APIs$1
    • First 300M: $1.00 per million
    • Next 132M: $0.90 per million
    • Data transfer varies by volume
  • REST APIs$3.5
    • Edge Optimized and Regional: $3.50 per million (first tier)
    • Higher volumes: $2.80 then $2.38 per million
    • Data transfer: $0.09 per GB
  • WebSocket APIs$1
    • Messages: $1.00 per million
    • Connection minutes: $0.25 per million minutes

Mocha

Free

No published plan breakdown. See the Mocha review.

Which should you pick?

Choose AWS API Gateway if

  • You need rest apis.
  • You want to start without paying.
  • You also want websocket apis.

Choose Mocha if

  • You need node.js and browser support.
  • You want to start without paying.
  • You also want bdd, tdd, qunit and other interfaces.

Questions people ask

Is AWS API Gateway or Mocha better?
It depends on the job. AWS API Gateway fits fronting Lambda functions with an HTTP endpoint; Mocha fits unit testing Node.js code. AWS API Gateway starts at Free and Mocha at Free.
Which is cheaper, AWS API Gateway or Mocha?
AWS API Gateway starts at Free and Mocha at Free.
Does AWS API Gateway or Mocha run on more platforms?
Both run on Web, so platform support will not decide this one for you.
Can I use AWS API Gateway for free?
Both have a free tier, so you can try either at no cost before committing.
What is AWS API Gateway best used for?
AWS API Gateway is most often used for fronting lambda functions with an http endpoint, rest and http api management with throttling and keys, websocket apis for real-time clients, private apis reachable only inside a vpc. Of those, fronting lambda functions with an http endpoint and rest and http api management with throttling and keys are not what Mocha is typically brought in for.
What can AWS API Gateway do that Mocha cannot?
AWS API Gateway covers REST APIs, WebSocket APIs, HTTP APIs, Lambda. Mocha covers Node.js and browser support, BDD, TDD, QUnit and other interfaces, Asynchronous test support, Parallel mode.

Answered from the vendors’ own pages

AWS API Gateway: How much does AWS API Gateway cost?

AWS API Gateway pricing varies by API type. HTTP APIs cost $1.00 per million requests for the first 300M monthly, then $0.90 per million. REST APIs cost $3.50 per million, and WebSocket APIs cost $1.00 per million messages plus $0.25 per million connection minutes. Data transfer charges ($0.09 per GB) apply separately.

Source
Mocha: Is Mocha free?

Yes. The site lists no pricing and says the project is funded through Open Collective sponsors and backers.

Source
AWS API Gateway: Is AWS API Gateway free?

New AWS customers receive 12 months of free tier access including 1 million REST API calls, 1 million HTTP API calls, and 1 million WebSocket messages plus 750,000 connection minutes per month. Starting July 15, 2025, new customers receive up to $200 in AWS Free Tier credits.

Source
Mocha: Where does Mocha run?

It runs on Node.js and in the browser. The site links to a running browser example.

Source
AWS API Gateway: What is the price difference between HTTP and REST APIs?

HTTP APIs are significantly cheaper at $1.00 per million requests compared to REST APIs at $3.50 per million (first tier). REST API pricing decreases to $2.80 and $2.38 per million for higher volumes, while HTTP API pricing drops to $0.90 per million after 300M monthly requests.

Source
Mocha: What licence does Mocha use?

Wikipedia lists the MIT Licence. The Mocha site does not state the software licence itself.

Source
AWS API Gateway: How much does an API Gateway Portal cost?

API Gateway Portals require a base fee of $125 per month (includes 10 PortalProducts with 40 endpoints each) plus $12.50 per month for each additional PortalProduct beyond the included 10.

Source
Share

Related pages

Other head to heads