m MiniEHR / learn
Foundry ↗About MiniEHROpen workspace ↗
LESSON 1 OF 94 min read

1. Set up and orient yourself

Learn which tools do what and how to open the app through its required Foundry workflow.

Tools in plain language

ToolJob
C#Backend language; source files end in .cs
.NET SDKCompiles C#, restores packages, runs projects/tests
ASP.NET CoreWeb framework that accepts HTTP requests
Entity Framework Core (EF Core)Connects C# objects/queries to a database
SQLiteDatabase in a local file, or in memory for some tests
xUnitDefines and executes automated tests
Node.jsChecks JavaScript syntax and prepares Netlify assets
FoundryAssigns engineering work and supervises/records execution
Git / GitHubLocal history / remote source hosting
NetlifyHosts static frontend files, not this C# backend

An SDK includes development tools; a runtime alone cannot build the project. Use Microsoft's .NET SDK downloads. global.json requests SDK 10.0.401, latest-patch roll-forward, and no prerelease SDKs. Installation is human bootstrap, not Foundry build evidence.

Open the checkout

On the owner's Mac:

sh
cd /Users/anthonynarine/Desktop/django-react/miniehr
git status --short --branch
/usr/local/share/dotnet/dotnet --info
node --version

These inspect state; they do not build/launch. If dotnet is on PATH, use dotnet --info. PATH is the list of directories the shell searches for programs.

For a fresh learning checkout:

sh
git clone --branch agent/frontend/ehr-4-tutorial https://github.com/anthonynarine/miniehr.git
cd miniehr

Cloning source does not recreate Foundry's signed identity, local state worktree, sessions, or temporary preview. Read lesson 8 before governed work on another machine.

Repository map

File/directoryMeaning
MiniEHR.slnxSolution listing related .NET projects
Directory.Build.propsShared project settings
src/Domain, Application, Infrastructure, and Api source
tests/Unit, integration, and readiness tests
docs/foundry/Historical evidence and repair handoffs
.foundry/Engineering configuration/control-plane integration
AGENTS.mdRepository operating rules

A .csproj configures one project; a solution groups projects. Shared settings target net10.0, enable nullable analysis and implicit imports, and treat warnings as errors. bin/ and obj/ are generated output ignored by Git.

Use the working Foundry preview

The default sibling CLI currently rejects this project's newer tests config. The observed working preview uses this source path:

sh
export PYTHONPATH=/private/tmp/miniehr-foundry-preview-a03d4a3/tree/src
MINIEHR_FOUNDRY_PYTHON=/Users/anthonynarine/Desktop/django-react/foundry/.venv/bin/python
"$MINIEHR_FOUNDRY_PYTHON" -m foundry status
"$MINIEHR_FOUNDRY_PYTHON" -m foundry recover
"$MINIEHR_FOUNDRY_PYTHON" -m foundry task show EHR-4

-m foundry runs the Python module for the engineering tool; the EHR remains C#. If that temporary directory is gone, arrange a reviewed replacement rather than silently loading an incompatible CLI. The paths are specific to this Mac.

Launch the functional local app

Run the following as the human owner in an interactive terminal, after checking EHR-4/frontend is launchable and its assigned checkout contains the intended candidate. Review the exact invocation before signing:

sh
PYTHONPATH=/private/tmp/miniehr-foundry-preview-a03d4a3/tree/src \
/Users/anthonynarine/Desktop/django-react/foundry/.venv/bin/python -m foundry \
  run EHR-4 frontend --isolation none --timeout-minutes 20 -- \
  /usr/local/share/dotnet/dotnet run --project src/MiniEHR.Api \
  --urls http://127.0.0.1:5080 \
  --ConnectionStrings:MiniEHR 'Data Source=/private/tmp/miniehr-frontend-synthetic.db'

Foundry requires the owner's signature for this host-isolation override. The agent cannot sign it. A previous agent attempt was denied; no running process is assumed. If the state/assignment changed, inspect it and arrange the runtime rather than bypassing Foundry with a direct dotnet run.

--isolation none means logical host isolation, not a container. The timeout is 20 minutes. The synthetic database sits outside the publish directory. ASP.NET applies pending migrations at startup, serves static files and API routes, and seeds no patients.

Confirm an actual running Foundry runtime and inspect its recorded logs. Open http://127.0.0.1:5080/, then check:

sh
curl -i http://127.0.0.1:5080/health

Expected: HTTP 200 and {"status":"ready"}. Connection refused means no reachable server on that port. A page loading alone does not prove database readiness. Retain the runtime ID; use Foundry runtime controls/logs to stop or investigate it.

Checkpoint

Why can local ASP.NET register a patient while the Netlify preview cannot? The local process executes C# and connects to SQLite; the preview only hosts files.

Next: C# basics.

MiniEHR learning guide · Based on this project’s source · Read on GitHub