{"id":51239908,"url":"https://github.com/nimbus-solution/berlinbrew-demo","last_synced_at":"2026-06-28T23:31:54.995Z","repository":{"id":356754651,"uuid":"1222676934","full_name":"nimbus-solution/berlinbrew-demo","owner":"nimbus-solution","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-16T06:15:18.000Z","size":79,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-16T07:44:34.269Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Apex","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nimbus-solution.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-27T15:43:58.000Z","updated_at":"2026-06-16T05:22:45.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/nimbus-solution/berlinbrew-demo","commit_stats":null,"previous_names":["nimbus-solution/berlinbrew-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nimbus-solution/berlinbrew-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimbus-solution%2Fberlinbrew-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimbus-solution%2Fberlinbrew-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimbus-solution%2Fberlinbrew-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimbus-solution%2Fberlinbrew-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nimbus-solution","download_url":"https://codeload.github.com/nimbus-solution/berlinbrew-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimbus-solution%2Fberlinbrew-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34907985,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-28T23:31:54.893Z","updated_at":"2026-06-28T23:31:54.985Z","avatar_url":"https://github.com/nimbus-solution.png","language":"Apex","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BerlinBrew\n\nA fictional specialty-coffee subscription company built as a Salesforce DX project.\nThe official starter / showcase repo for [Nimbus](https://testnimbus.dev) — local\nApex test execution without an org.\n\n## Install Nimbus\n\nOne-line install. Single static binary into `~/.local/bin`. No JVM, no Node, no Docker.\nLinux, macOS (Intel + Apple Silicon), and Windows (via WSL) supported.\n\n```bash\ncurl -fsSL https://install.testnimbus.dev | sh\n\n# Verify\nnimbus --version\n```\n\nRe-run any time to upgrade. Full install options: [testnimbus.dev/quickstart](https://testnimbus.dev/quickstart).\n\n## Run the demo\n\n```bash\ngit clone https://github.com/nimbus-solution/berlinbrew-demo\ncd berlinbrew-demo\nnimbus test\n```\n\nExpected: **all green in under a second on a warm daemon.** No org\nconnection, no credentials, no scratch org pool.\n\n## What you get\n\nA real-shape Salesforce project that exercises every facet of Nimbus you'd hit\non a production codebase — and a few you'd hit *eventually*. Not a toy.\n\n**Domain:** coffee products, subscriptions, roast-batch inventory, FIFO\nreservation, regional config, loyalty programs, shipping callouts, customer\nmetrics. Real-shape Apex with realistic state machines, governor-aware bulk\npatterns, and trigger handlers.\n\n### Salesforce metadata in this repo\n\n| Kind | Files | What it shows |\n|---|---|---|\n| **Custom objects** | `CoffeeProduct__c`, `Subscription__c`, `RoastBatch__c`, `LoyaltyTransaction__c` | Lookups (with proper `\u003cdeleteConstraint\u003e`), required fields, formula fields |\n| **Custom Metadata Type** | `BrewConfig__mdt` + 3 records (EU, US, UK) | Region-specific config (free-shipping threshold, default cadence, loyalty toggle). Records load from `customMetadata/*.md-meta.xml` automatically — Nimbus seeds them into the local DB at Setup. |\n| **Custom labels** | `BrewWelcomeSubject`, `BrewLoyaltyTierMessage`, `BrewSupportSignoff` | Loaded from `labels/CustomLabels.labels-meta.xml`. `BrewWelcomeSubject` overridden via `nimbus.seed.label.*` in nimbus.properties. |\n| **Platform event** | `ShipmentEvent__e` | High-volume / publish-after-commit |\n| **Triggers** | `AccountTrigger`, `SubscriptionTrigger` | Before/after handlers via TriggerHandler-style classes |\n| **Record-triggered Flow** | `Account_WelcomeEnrichment` | RecordBeforeSave |\n| **Profiles** | `BrewSupportAgent`, `BrewFulfillment` | FLS demo (BrewSupportAgent cannot read `WholesaleCost__c`) |\n| **Permission set** | `BrewLoyaltyManager` | Used by `runAs` tests |\n\n### Apex surface\n\n| Class | What it shows |\n|---|---|\n| `BrewPricingService` | Pure pricing/margin math, FLS-gated query helper |\n| `BrewLoyaltyEngine` | DML + platform events on tier graduation |\n| `BrewSubscriptionService` | Lifecycle with state guards (activate/pause/resume/cancel) |\n| `BrewInventoryService` | FIFO batch reservation with `FOR UPDATE` lock + in-memory date sort |\n| `BrewShippingCallout` | HTTP callout with mockable boundary |\n| `BrewCustomerMetrics` | Aggregate SOQL (`GROUP BY`, `SUM`, `COUNT`) |\n| `BrewAccountHandler` | Before/after triggers with normalization + DML guards |\n| `BrewSubscriptionHandler` | State-transition rules + after-update ripple to Account |\n| `BrewAuditLogger` | **HopLog managed-package facade** — calls into `Hoplog.Logger.*` (see below) |\n| `BrewAuditArchive` | **DML on a managed-package custom object** — `Hoplog__LogEntry__c` |\n| `BrewRegionalConfig` | Reads `BrewConfig__mdt` records with class-load caching |\n| `BrewWelcomeMailer` | Custom-label composition with `String.format` interpolation |\n| `BrewOrderRouter` | Shipping decision combining mdt config + `IBrewShippingProvider` (Stub API target) |\n| `IBrewShippingProvider` | Interface for `Test.createStub` mocking |\n| `BrewLegacyAuditLog` | **Demonstrates the API-version mismatch warning** (see below) |\n\n## Nimbus features showcased\n\n### `nimbus init` scaffolding\n\nRun on a fresh project: writes `nimbus.properties` (heavily commented) and\n`stubs/README.md`. Both committed. Idempotent — re-running on a configured\nproject leaves the user's edits alone.\n\n### Auto-doctor on first test run\n\nWhen `.nimbus/history` is empty, `nimbus test` runs the doctor checks before\nfiring tests, prefixed with *\"First run on this project — surfaced now so they\ndon't surprise you as test failures.\"* Subsequent runs silent.\n\n### Managed-package handling — the **HopLog** showcase\n\nHopLog is a fictional logging managed package this repo references in two\nshapes — Apex classes (`Hoplog.Logger.*`) and a namespaced custom object\n(`Hoplog__LogEntry__c` with fields `Hoplog__Severity__c`,\n`Hoplog__EventType__c`, `Hoplog__Message__c`). Together they exercise both\nsides of how Nimbus handles managed dependencies your org doesn't have.\n\nEverything HopLog-related lives under `stubs/Hoplog/` — one folder per\nmanaged package, classes and objects co-located. Adding Nebula tomorrow\nis just `stubs/Nebula/` next to `stubs/Hoplog/`.\n\n**Apex surface — `BrewAuditLogger`** calls `Hoplog.Logger.info(...)`,\n`Hoplog.Logger.error(...)`, etc. Resolution at test time is two-layer:\n\n1. `nimbus.properties` declares `nimbus.stubs.namespaces=Hoplog` — Nimbus\n   resolves any `Hoplog` reference to null/no-op for static method calls.\n   Matching is case-insensitive (Apex itself is).\n2. `stubs/Hoplog/Hoplog.cls` provides the type definitions\n   (`Hoplog.Logger` with no-op methods) so type-position references bind\n   cleanly during tests.\n\n**Custom object — `BrewAuditArchive`** runs real DML and SOQL against\n`Hoplog__LogEntry__c`: `insert new Hoplog__LogEntry__c(...)`,\n`SELECT ... FROM Hoplog__LogEntry__c WHERE Hoplog__Severity__c = 'ERROR'`.\nThe schema lives at `stubs/Hoplog/objects/Hoplog__LogEntry__c/`. Nimbus\nloads the XML the same way it loads any other custom object and creates\nthe matching table in the embedded Postgres — so tests query the\nnamespaced object end-to-end without the package being installed.\n\nThe `.forceignore` excludes the entire `stubs/` tree plus the four\nclasses that call into HopLog (HopLog isn't installed in a real org, so\ndeploys would fail with \"Variable does not exist: Hoplog.Logger\") —\nbut Nimbus runs all of it locally green. **This is the demo: Nimbus runs\ncode that wouldn't deploy without dependencies your org doesn't have.**\n\n### Custom metadata records — `BrewConfig__mdt`\n\nThree records ship in `customMetadata/`. Nimbus loads them at Setup time and\nthey're queryable via SOQL with no test setup needed. `BrewRegionalConfig`\nreads them via a static initializer (one-time per JVM) — same pattern you'd\nwrite on a real org.\n\n### Custom labels with seeded overrides\n\nLabels load from `labels/CustomLabels.labels-meta.xml`. The\n`BrewWelcomeSubject` label is overridden via\n`nimbus.seed.label.BrewWelcomeSubject=...` in nimbus.properties to demonstrate\nthe per-environment override pattern.\n\n### `@testSetup` per-test rollback\n\n`BrewSharedSetupTest` exercises the contract end-to-end: setup runs once,\neach test method runs in its own transaction that rolls back, mutations\nin test 2 are invisible to test 3. Run with `--parallel 1` and `--parallel 8`\nto verify isolation across both modes.\n\n### Stub API — `Test.createStub`\n\n`BrewOrderRouterTest.FakeShippingProvider` implements\n`System.StubProvider`; tests mock `IBrewShippingProvider` without an HTTP\ncallout. The stub captures invocations, lets the test assert on call count\nand arguments, and returns canned values per call.\n\n### API-version mismatch detection\n\n`BrewLegacyAuditLog.cls-meta.xml` declares apiVersion 52.0 but the class\ncalls `System.Assert.areEqual` — a method Salesforce introduced in v56.\nNimbus surfaces the mismatch at the start of every test run with a clear\nhint about which symbol came in at which version:\n\n```\n⚠ src/.../BrewLegacyAuditLog.cls:36\n  references System.Assert.areEqual (introduced in API 56.0)\n  but class apiVersion is 52.0\n```\n\nTests still run — it's advisory. Two ways to resolve: bump the apiVersion,\nor use the older `System.assertEquals` form. The class is `.forceignore`d so\nreal-org deploys don't try to ship it.\n\n### Pre-deploy field-metadata validation\n\nThe doctor check `Field metadata validity` walks every `*.field-meta.xml`\nand runs the same shape-validation Salesforce does at deploy time. Today\nit catches two of the most common deploy failures:\n\n- **Required lookups that would fail at deploy** — when a required Lookup\n  field has no `\u003cdeleteConstraint\u003e` (or has `SetNull`), Salesforce rejects\n  the deploy with *\"must specify either cascade delete or restrict delete\n  for required lookup foreign key.\"* The doctor surfaces this locally before\n  you push.\n- **Currency fields on Custom Metadata Types** — CMTs don't support\n  Currency. Salesforce rejects at deploy; the doctor catches it earlier.\n\nAuto-fires on first `nimbus test` run via the doctor preamble. Closes the\n\"passed locally, failed on org\" gap.\n\n## Project structure\n\n```\nberlinbrew-demo/\n├── README.md                  # this file\n├── nimbus.properties          # Nimbus config (managed packages, governor, label seeds)\n├── sfdx-project.json          # standard SFDX project file\n├── .forceignore               # excludes the HopLog showcase + API-version mismatch demo from sf deploys\n├── stubs/\n│   ├── README.md              # how to add managed-package stubs\n│   └── Hoplog/                # one folder per package: classes + namespaced objects\n│       ├── Hoplog.cls\n│       └── objects/Hoplog__LogEntry__c/\n└── force-app/main/default/\n    ├── classes/               # services + test classes\n    ├── customMetadata/        # 3 BrewConfig records (EU, US, UK)\n    ├── flows/                 # Account_WelcomeEnrichment\n    ├── labels/                # 3 custom labels\n    ├── objects/               # 7 custom objects + Account/Contact extensions\n    ├── permissionsets/        # BrewLoyaltyManager\n    ├── profiles/              # BrewSupportAgent, BrewFulfillment\n    ├── staticresources/       # demo CSV + sample shipping API JSON\n    └── triggers/              # AccountTrigger, SubscriptionTrigger\n```\n\n## Common commands\n\n```bash\n# Run everything\nnimbus test\n\n# Run one class\nnimbus test BrewPricingServiceTest\n\n# Run one method\nnimbus test BrewPricingServiceTest.weeklyPrice_is_fourTimesBase\n\n# Pattern match\nnimbus test \"*Subscription*\"\n\n# With coverage\nnimbus test --coverage\n\n# Machine-readable output (for CI / AI agents)\nnimbus test --json\n\n# Open the browser dashboard\nnimbus dev\n\n# Run doctor (auto-fires on first run too)\nnimbus doctor\n```\n\n## Disclaimer\n\nThe pricing, VAT handling, loyalty rules, and shipping economics are plausible\nbut not intended for production use. Any resemblance to a real Berlin\nroastery is coincidental.\n\n## License\n\nMIT. See [LICENSE](LICENSE).\n\n## Maintained by\n\n[Nimbus](https://testnimbus.dev) — fast, local Apex test execution.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnimbus-solution%2Fberlinbrew-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnimbus-solution%2Fberlinbrew-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnimbus-solution%2Fberlinbrew-demo/lists"}