Repository F# setup
open System
open System.IO
open System.Threading
open System.Threading.Tasks
open Axial
open Axial.Layers
open Axial.Console
open Axial.FileSystem
open Axial.Hosting
open Axial.Hosting.Browser
open Axial.Hosting.Node
open Axial.HttpClient
open Axial.PlatformService
open Axial.Process
open Axial.State
open Axial.Telemetry
open Axial.Telemetry.JavaScriptChoosing an Approach
Keep dependencies explicit. Axial has one dependency model for v1: workflows read an explicit environment, reusable helpers name service contracts, and layers build the environment at the boundary.
Use this order:
- Use records plus
Flow.envWithfor most application code. - Declare a per-service contract for reusable named services.
- Use
LayerandLayer.provideto build environments and own resource cleanup. - Use
ServiceProvider.getonly at .NET host edges where directIServiceProviderlookup is intentional.
Default Shape
Plain F# records are the default recommendation because they are legible, easy to fake in tests, and easy to refactor.
type ApiDeps = { Orders: IOrderRepo; Email: IEmailSender }
let workflow : Flow<ApiDeps, string, unit> =
flow {
let! email = Flow.envWith _.Email
do! email.SendConfirmation()
}Service Contracts
Reusable helpers can ask for a named service without forcing every application to use the same record shape:
type IHasOrders =
abstract OrderRepo : IOrderRepo
let save order : Flow<#IHasOrders, OrderError, unit> =
flow {
let! orders = Flow.envWith _.OrderRepo
do! orders.Save order
}Layers build explicit environments and own cleanup through Scope. Use layer { } when application startup needs to
combine several services into one environment.
let appLayer =
layer {
let! runtime = BaseRuntime.live
and! orders = ordersLayer
return { Runtime = runtime; Orders = orders }
}Tutorials
For concrete starting points, use App Record and Layers.

