Repository directory structure
The Dark repo contains multiple services and compilation targets. For OCaml, here's how the various directories intersect, and what language they use:
Directory listing
.circleci
- CI config file.ionide
- config for F# VSCode plugin.vscode
- VSCode configauth0-branding
- has some assets for our login providerclient
- the editor, and the entire frontend application that is found under darklang.com/a/yourcanvas (note, not darklang.com or the docs). Written in ReScript. All frontend functionality, except the server-side APIs used for it, are heresrc/analysis
- handles code related to live values - requesting from the server, storing, sending to the client-side execution enginesrc/api
- most requests to the HTTP API live heresrc/app
- important scaffolding for the application (settings, exception tracking,Main.res
)src/canvas
- misc files pertaining to layoutsrc/components
- a number of parts of Dark have been componentized. They live here.src/core
- all the frontend types are defined here, also JSON encoders and decoders for themsrc/fluid
- fluid is the "editing" portion of the editor, the thing you type code in. All editing of Dark code happens in heresrc/forms
- the "forms" editor, used for editing any form-like boxes (HTTP handler headings, DB fields, etc). Still recovering from when it was also how we wrote Dark codesrc/package
- the Dark package managersrc/prelude
- builtin functions that are available in most other files (which start withopen Prelude
)src/toplevels
- HTTP handler, workers, REPLs, DBs, functions, etc, are all "toplevels"src/util
- generic utility codestatic
- some assetsstyles
- CSStest
- unit testsworkers
- web workers used for analysis and fetching data from the server in the background
config
- a set of env vars for each environment. You'll be interested in thedev
environmentdocs
- sporadic documentationdocs/production
- documentation about how we run the Dark servicebackend
- The backend written in F# and .NET. including the language definition and execution engine, the "framework" (HTTP, DB, queues, etc), the editor's HTTP API, and the execution engine which runs in the client..paket
- Used by the Paket/NuGet package managerBuild
- where the compiler puts compiled codepaket-files
- Used by the Paket/NuGet package managersrc/ApiServer
- webserver serving the editor and the API used by the editorsrc/BackendOnlyStdLib
- implementation of functions which need to be run on the backend, due to their connection to the DB, queues, etc.src/Benchmark
- a benchmark executable to measure the performance of Dark codesrc/BwdServer
- webserver that is grand-user facing (at builtwithdark.com)src/ClientTypes
- type definitions of types that are used in client-server communicationsrc/ClientTypes2BackendTypes
andsrc/ClientTypes2ExecutionTypes
- mappings between 'internal' types and our client-facing typessrc/CronChecker
- trigger events for scheduled worksrc/HttpMiddleware
- where we define our middlewares used in Dark HTTP handlerssrc/LibAnalysis
-src/LibBackend
- the framework functionality (HTTP, DB, queues, traces, secrets, serialization), including standard library functions which only run on the backend (and not in the client)src/LibBinarySerialization
- types that we use to store Dark programs to our Postgres databasesrc/LibExecution
- the Dark language, including types, the runtime, and of course the execution enginesrc/LibExecutionStdLib
- most of the standard library functions (anything that doesn't need to be run on the backend)src/LibService
- library with some common functionality for F# services (currently just the backend, soon queues and cron)src/Prelude
- utilities, libraries, common types; used everywheresrc/QueueWorker
- pulls user events from the queue and runs themsrc/Scripts
- some simple command-line programs that use F# librariessrc/Wasm
- "main" module for client-side analysis/execution-enginetests/FuzzTests
- code to fuzztest different parts of Darktests/TestUtils
- utilities used in Tests and FuzzTeststests/Tests
- mostly unit tests for backend and libexecution functionalitytestfiles/data
- text and binary files used during various backend teststestfiles/execution
- unit test definitions for language and standard librarytestfiles/httphandler
- tests for the Dark HTTP server and middlewaretestfiles/httpclient
- tests for the HTTP Library functions
integration-tests
- integration tests, written in JS using TestCafe. Flaky and brittle. Help welcome!lib
- build directory used by ReScriptnode_modules
- installation dir fornpm
rundir
- anything that runs and stores something stores it hereintegration_test_logs
logs
- logs from running services, especiallyfsharp-bwdserver.log
andfsharp-apiserver.log
(backend)screenshots
- for integration testsvideos
- for integration tests
scripts
- bash scripts to do common (and sometimes uncommon and therefore forgettable) actions on the repo. Using scripts is very very common. Anytime there's something interesting, we add a script to do it. Scripts are occasionally out of date.