AWS Builder Center

Weekend Annoying Task Challenge: Earth Pressure Calculator

Every civil and geotechnical engineering student or professional knows the pain. You're designing a retaining wall, and you need to calculate lateral earth pressure — fast. But instead of a clean answer, you're buried in textbook formulas, unit conversions, and manual calculations that eat up hours. One wrong value and the entire design is off.

The Problem — A Daily Frustration for Civil Engineers
As a civil engineering student, one of the most time-consuming and error-prone tasks I face regularly is calculating lateral earth pressure for retaining wall design. Every time I sit down to work on a retaining wall problem, I have to flip through multiple textbook pages, remember which formula applies to which condition, carefully punch numbers into a calculator, and then double-check everything manually because one small mistake — a wrong angle, a missed unit conversion — can throw off the entire design.
The worst part is doing this repeatedly. Every new wall, every new soil condition, means starting from scratch. Rankine or Coulomb? Is there wall friction? What about a water table? Is the backfill sloped? These decisions pile up fast, and there is no simple tool that walks you through all of it in one place.
That is exactly the annoying task I decided to automate this weekend.


Vision & What the App Does
Earth Pressure Calculator is a web-based geotechnical engineering tool that automates lateral earth pressure analysis for retaining wall design. It is built specifically for civil engineering students and professionals who need quick, accurate results without manually working through complex formulas every time.
The app supports three major earth pressure theories used in geotechnical engineering:
  • Rankine Theory — Used for smooth vertical walls with horizontal backfill and no wall friction. It gives the simplest and most conservative estimate of earth pressure using the formula Ka = tan²(45° − φ/2) for active pressure and Kp = tan²(45° + φ/2) for passive pressure.
  • Coulomb Theory — A more realistic theory that accounts for wall friction (δ), backfill slope (β), and wall inclination (θ). It uses a wedge failure mechanism and is better suited for rough concrete retaining walls in real construction.
  • At-Rest Pressure (K₀) — Based on Jaky's formula K₀ = (1 − sin φ) × OCR^sin φ, this is used when the wall cannot deflect at all, such as basement walls and bridge abutments. The Over-Consolidation Ratio (OCR) is also considered for overconsolidated soils.
Homepage:

Enter Details:

Result graph1:

Result graph2:

Pressure Table:

You simply enter your soil parameters — unit weight (γ), saturated unit weight (γsat), friction angle (φ), cohesion (c), wall height, surcharge load, water table depth, wall friction angle, backfill slope, and wall inclination — and the app instantly computes all pressure coefficients, resultant forces, and their points of action.
For cohesive soils, the app also calculates the tension crack depth, which is the zone near the top of the wall where active pressure becomes negative and should be ignored in design. This is a detail many students miss entirely.
The app then plots a full pressure distribution diagram showing how lateral pressure increases with depth, with separate lines for active, passive, at-rest, and pore water pressure. A data table gives exact values at every depth increment, which can be directly used in design calculations or reports.
One of my favourite features is the theory recommendation engine. Based on your input values, the app tells you which theory is most appropriate for your specific condition and explains why. This is something textbooks rarely make clear in a practical way.


How I Built It
I built this as a pure frontend React application with no backend server required. The entire mathematical engine lives inside a single  calculations.js  file that implements all three theories from scratch using JavaScript trigonometry and math functions.
The UI is structured as a three-tab dashboard — Inputs, Results, and Theory Guide. The Inputs tab collects all soil and wall parameters with helpful hints beside each field. The Results tab displays metric cards for all pressure coefficients, resultant forces, and special values like tension crack depth, followed by interactive charts built with Recharts.
The most challenging part was Coulomb's formula. It involves a deeply nested expression with multiple square roots and trigonometric functions. For certain combinations of wall friction and backfill slope, the expression under the square root becomes negative, which returns NaN in JavaScript and crashes the output. I handled this by adding validation checks and falling back to Rankine values when Coulomb inputs are geometrically invalid.
The app also includes a full print stylesheet so engineers can export results directly from the browser without any extra tools.


AWS Services Used & Architecture
The app is deployed on AWS Amplify, connected directly to my GitHub repository at  https://github.com/shooky7/earth-pressure .
Every time I push a change to the main branch, Amplify automatically detects the update, triggers a new build, runs  npm install  and  npm run build , and deploys the updated app to a globally distributed CDN within minutes. The entire pipeline is defined in the  amplify.yml  file included in the repo root.
GitHub Repository (main branch)
↓ push trigger
AWS Amplify Build Server
→ npm install
→ npm run build
↓
Global CDN Distribution
↓
Live App → https://main.d28hxfs4a41o4n.amplifyapp.com/
No Lambda functions, no database, no backend infrastructure needed. Amplify handles the entire build and hosting pipeline automatically, making it perfect for a static React app like this.


What I Learned
This weekend challenge taught me several things beyond just writing code.
First, deployment-first thinking matters. By writing the  amplify.yml  file before even finishing the app, I made deployment completely automated from day one. Every commit automatically goes live — no manual steps required.
Second, I learned that building a tool for a domain you actually work in makes you a better developer. Understanding Coulomb's wedge theory deeply enough to implement it in code — and to know when it fails — gave me insights I never got from just reading about it in a textbook.
Third, scope matters. A focused tool that does one thing well — calculate earth pressure accurately and explain the results clearly — is infinitely more useful than a bloated app trying to do everything. This calculator solves exactly one annoying problem, and it solves it completely.
As a civil engineering student, having this tool available means I can now spend less time grinding through manual calculations and more time actually understanding and interpreting results. That is what good engineering tools should do.


Links
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article