digital-garden: A Bun-driven modular digital garden runtime that hot-loads features from Git and routes every incoming request through plug-in modules for fast, reproducible setup.
- Bun installed (runtime and package manager).
- PostgreSQL or Docker to host the shared database schema.
- Git (to fetch module repositories).
- Nushell (optional, recommended) for the included developer scripts in
script/. - Basic familiarity with JavaScript/Node-style runtimes and SQL.
See script/env.nu for default environment variables (e.g. DOMAIN, POSTGRES_URL, POSTGRES_*). Edit these values to match your environment before starting the server. You can either export the variables in your shell or edit script/env.nu directly (the Nushell helper scripts will source it).
- Clone the repository and enter it:
$ git clone https://github.com/BeyondMagic/digital-garden
$ cd digital-garden-
Review and set your environment (open
script/env.nuand updateDOMAIN,POSTGRES_URL, etc.). -
(Optional) Start a local Postgres through the provided Docker compose:
$ ./script/index.nu database- Start the server in development mode (hot reload + logs):
$ ./script/index.nu dev- The server will bind to the
DOMAINyou configured — openhttp://$DOMAIN/to verify.
- The server entrypoint is
source/index.jsand loads modules on boot via the module manager (source/module/). - Modules are tracked in the
moduletable and discovered by the module manager; adding a module record (repository URL, slug, enabled) lets the server clone and register it. - Requests are dispatched as a
requestevent; the first module to return aResponsehandles the request. If no module handles a request, a minimal configuration notice is returned. - Developer helpers are in
script/index.nu(commands:dev,debug,cli,database,bun). Usedebugto enable verbose logging.
- Logs are written to the
logs/directory; check the latest log when the server fails to boot. - Use
./script/index.nu debugto run withDEBUG=trueand more verbose output. - If the database is misconfigured, double-check
POSTGRES_URLand that Postgres is running (or restart the Docker compose with./script/index.nu database). - For resetting a test DB schema, see
source/database/query/reset.js(WARNING: destructive; use only on disposable test DBs).
- Modularity: must be implemented as independent modules that can be added/removed at runtime.
- Performance: must be efficient, with minimal overhead on request handling.
- Isolation: must not interfere with each other; each module runs in its own context, but can communicate via events and shared DB.
- Observability: must provide clear logging and debugging tools to monitor module behavior and system health.
- Testability: should be easy to test features in isolation and as part of the whole system.
- Knowability: must be well-documented, with clear, concise and precise instructions of features, configuration and usage.
See CONTRIBUTING.md for contribution guidelines (if present). Feel free to open issues or PRs on this repository.
The database schema is available as a DBML reference.
See the LICENSE file for licensing details.
Maintained by João Farias (beyondmagic).