FEAScript is a finite element simulation library developed in JavaScript. It runs engineering simulations in the browser or in Node.js, with no desktop software to install.
🎯 A JavaScript API for FEM: you set up the model, solve it and plot the results in JavaScript, and you can build the simulation into your own web pages and applications. This is the core library of the FEAScript project.
🚧 FEAScript is in development, and each release adds features. Its API may change between minor releases; see the changelog. Donations pay for development time, documentation and tutorials.
- Physics models: creeping (Stokes) flow, Euler–Bernoulli beam bending, front propagation, heat conduction, general-form PDE (linear and nonlinear)
- Geometry and meshing: a geometry (line, rectangle, or polygon with holes) with named boundaries, meshed with quadrilaterals (mapped grid) or triangles (Delaunay refinement, graded by position, built on Delaunator and Constrainautor), and unstructured mesh import from Gmsh (
.msh) with quadrilateral and triangular elements (linear and quadratic) - Solvers: frontal, Jacobi (CPU/WebGPU) and LU, Newton–Raphson for nonlinear systems
- Spatially varying coefficients:
thermalConductivity(x, y)andheatSource(x, y)can be scalars or functions, evaluated at each Gauss point - Performance: web worker support for multi-threaded computation
- Visualization: interactive rendering with vtk.js and Plotly
You can run simulations with FEAScript by calling its functions from JavaScript (the FEAScript API). The API is the core programmatic interface for FEAScript and works across multiple environments, including the browser (simple HTML pages and online JavaScript playgrounds, e.g. CodePen and Scribbler) and server-side runtimes such as Node.js. The most common ways to use FEAScript are outlined below:
- In the browser – Run FEAScript directly in a simple HTML page to perform simulations locally with no additional installations or cloud services required.
- In JavaScript playgrounds – Try FEAScript in interactive JavaScript playgrounds such as CodePen or Scribbler.
- With Node.js – Use FEAScript in server-side JavaScript applications.
The FEAScript documentation covers installation, the physical models and their equations, meshes, boundary conditions, solvers and the full API reference.
You can use FEAScript in browser environments in three ways:
-
Import from CDN (jsDelivr):
<script type="module"> import { FEAScriptModel } from "https://cdn.jsdelivr.net/gh/FEAScript/FEAScript-core/dist/feascript.esm.js"; </script>
-
Import from hosted ESM build:
<script type="module"> import { FEAScriptModel } from "https://core.feascript.com/dist/feascript.esm.js"; </script>
Note: Both URLs above always serve the latest FEAScript release, so your page updates automatically when a new version is published (new versions may include breaking changes). To freeze your page to a specific version, add a version tag to the jsDelivr URL:
<script type="module"> import { FEAScriptModel } from "https://cdn.jsdelivr.net/gh/FEAScript/[email protected]/dist/feascript.esm.js"; </script>
-
Download and use locally:
You can download the latest stable release from GitHub Releases.
<script type="module"> import { FEAScriptModel } from "./path/to/dist/feascript.esm.js"; </script>
👉 Explore browser-based tutorials on our website.
FEAScript works well in interactive JavaScript playgrounds where you can write code, visualize results inline, and share your work.
👉 Explore the following examples:
Install FEAScript and its peer dependencies from npm as follows:
npm install feascriptThen, import it in your JavaScript file:
import { FEAScriptModel } from "feascript";Important: FEAScript is built as an ES module. If you're starting a completely new project (outside this repository), make sure to configure it to use ES modules by:
# Create package.json with type=module for ES modules support
echo '{"type":"module"}' > package.jsonWhen running examples from within this repository, this step isn’t needed as the root package.json already has the proper configuration.
👉 Explore Node.js use cases on the examples directory.
Here is a minimal browser-based example using the FEAScript API. Adapt paths, physics model, and boundary conditions as needed for your specific problem:
<body>
<!-- ...body region... -->
<script type="module">
// Import FEAScript library
import { FEAScriptModel } from "https://core.feascript.com/dist/feascript.esm.js";
window.addEventListener("DOMContentLoaded", () => {
// Create a new FEAScript model
const model = new FEAScriptModel();
// Select physics/PDE
model.setModelConfig("physicsModel", { solver: { method: "lusolve" } }); // Example: "heatConduction"
// Define the geometry: a line, a rectangle, or a polygon with holes and named boundaries
model.setGeometry({ rectangle: [1.0, 0.5] }); // Boundaries "bottom", "right", "top", "left"
// Configure the mesh: quadrilaterals (rectangles) or triangles (any polygon), and the element size
model.setMeshConfig({
elements: "quadrilaterals", // Choose either "quadrilaterals" or "triangles"
elementOrder: "linear", // Choose either "linear" or "quadratic"
size: 0.1, // Length of an element side (or divisions: [10, 5] for quadrilaterals)
});
// Add boundary conditions by boundary name: the condition type and its named parameters
model.addBoundaryCondition("top", { type: "conditionType" /* , parameters */ }); // Example boundary condition
// Solve the problem
const { solutionVector, nodesCoordinates } = model.solve();
});
</script>
<!-- ...rest of body region... -->
</body>Note: The code above uses placeholder values that you should replace with appropriate options, e.g.:
- "physicsModel" should be replaced with an actual physics model such as "heatConduction" for heat conduction problems
- "conditionType" should be replaced with an actual boundary condition type with its parameters, such as
{ type: "constantTemperature", temperature: 100 }or{ type: "convection", h: 1, ambientTemperature: 20 } solverselects the linear solver:methodis "lusolve" (the default), "jacobi" or "frontal", and the iterative methods also takemaxIterationsandtolerance- "top" is the name of a boundary of the geometry: "left" and "right" for a line, "bottom", "right", "top" and "left" for a rectangle, the names you give the edges of a polygon, or the names of the physical groups of a Gmsh mesh
Furthermore, the scripts under examples/ contain Node.js examples. You can run them from the FEAScript-core/ directory as follows:
node examples/heatConduction/heatConduction1DWall/heatConduction1DWall.jsEach script prints its computed solution to the console.
💖 If you find FEAScript useful, please consider supporting its development through a donation. Your support helps fund new features, performance improvements, documentation and tutorials:
📨 You can also join the FEAScript mailing list to receive project updates and news: Subscribe here
We warmly welcome contributors to help expand and refine FEAScript. Please see the CONTRIBUTING.md file for detailed guidance on how to contribute.
The core library of FEAScript is released under the MIT license. © 2023-2026 FEAScript.

