npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@stacc/services-ambita-realty

v2.8.0

Published

An API that proxies the Ambita Realty API

Readme

Stacc Ambita Realty Proxy API

An API that proxies the Ambita Realty API

Requirements

To run and try out this API locally, a .env file must be included with the correct credentials:

API_URL=<API_URL>
AUTH_URL=<AUTH_URL
AMBITA_CLIENT_ID=<AMBITA_CLIENT_ID>
AMBITA_CLIENT_SECRET=<AMBITA_CLIENT_SECRET>
AMBITA_USERNAME=<AMBITA_USERNAME>
AMBITA_PASSWORD=<AMBITA_PASSWORD>

After this is setup, run the following command at the project's root:

$ npm install && npm run dev

Try out the API locally with REST client (Visual Studio Code)

  1. Install a REST client for your IDE
    • VSCode: https://marketplace.visualstudio.com/items?itemName=humao.rest-client
  2. Add a settings.json file to your .vscode folder and include the following:
    {
        "rest-client.environmentVariables": {
            "$shared":{
                "nin1": "<enter your nin here>",
                "nin2": "<enter your nin here>"
            },
            "local": {
            },
            "production": {
            }
        }
    }
    • !! Always make sure to not commit sensitive personal data to the VCS !!
  3. $ npm run dev
  4. You should now be abvle to run the requests in the src/requests folder.

For other IDE's, follow the documentation and makes sure to .gitignore any files containing sensitive information:

  • Webstorm: https://www.jetbrains.com/help/webstorm/exploring-http-syntax.html#using_request_vars

Blocc

Deployment paths

This repo ships two, side by side, from the same source and the same release tag:

  1. Helm — helm/, built and pushed by build-and-publish.yaml on a published release. The chart, its values, the image name and that workflow are unchanged. Two changes reach the helm image as well, both inert for it; see What differs from helm.
  2. Blocc module — module.yaml, published as stacc-classic/ambita-realty, with one component, api (Backend), which lives at the repo root (path: .) and builds from the same Dockerfile. It is published to the blocc registry by publish-blocc-module.yaml on the same release. The leading v is stripped, so tag v2.7.0 becomes module version 2.7.0.

version.yaml cuts a release on every push to main, so both workflows fire together.

The old root module.yaml (the legacy stacc-registry manifest, name: services-ambita) and backend.yaml are gone. The manifest pointed at a backends/my-backend that never existed, so nothing could have been published from it. The npm SDK (@stacc/services-ambita-realty, lib/) is unaffected.

Helm values → module schema

| Helm value (values.yaml) | Module property | Env var | Note | | --- | --- | --- | --- | | authUrl | authUrl | AUTH_URL | same default: Ambita BETA | | apiUrl | apiUrl | API_URL | same default: Ambita BETA | | credentials.clientId (STACC_BETA_TOS_1) | credentials.clientId | AMBITA_CLIENT_ID | same default | | credentials.username (STACC_BANK) | credentials.username | AMBITA_USERNAME | same default | | Secret <secretName>, key client-secret | credentials.clientSecret | AMBITA_CLIENT_SECRET | secret: true, required | | Secret <secretName>, key password | credentials.password | AMBITA_PASSWORD | secret: true, required | | — (app default 25000) | timeout ("25000") | TIMEOUT | new; string, milliseconds | | port (6060) | fixed in component.yaml | PORT | ports.internal: 6060; not configurable | | resourceProfile (large) | resourceProfiles.small / large | — | same figures; pick with spec.resourceProfile | | secretName | — | — | replaced by the two secret: true properties | | deployment.env | — | — | no equivalent; the service reads nothing else | | image.* | — | — | blocc builds and addresses the image |

Both URLs default to Ambita's BETA environment, as they do in the chart. A production solution must set authUrl and apiUrl to https://api.ambita.com/authentication/v2/token and https://api.ambita.com/realty/v1. A beta token is not valid against production, and the reverse.

credentials.clientId and credentials.username default to Stacc's beta account, as in the chart. If you supply secrets for any other account, set both alongside them. A mismatch fails the token request, which currently crashes the service (see Known issues).

What differs from helm

  • The Dockerfile's USER node is now USER 1000:1000. It is the same user. blocc's pod security context sets runAsNonRoot without a runAsUser, and the kubelet refuses a named user under that rule because it cannot prove the user is not root. The chart already forces runAsUser: 1000/runAsGroup: 1000, so the helm pod is unchanged. This keeps enableSecurityContext on, so the blocc pod is at least as locked down as the helm one.
  • A root .dockerignore now bounds the build context, for both paths. It keeps .git, helm/, examples/, .env and the blocc YAML out of the builder stage. The runtime image only ever took dist/ and package*.json from that stage, so its contents do not change.
  • Probes. The chart declares none; the module probes /livez and /readyz. Both are bare 200s and say nothing about Ambita or the credentials.
  • Autoscaling is off, matching the chart's fixed replicas: 1.
  • logging does nothing. The service logs with bare console.* and morgan('dev'), and ignores LOG_LEVEL / LOG_FORMAT.

Known issues (both paths, pre-existing)

These are in src/, not the packaging, and behave the same under helm:

  • Wrong credentials kill the process. authorizeMiddleware is an async Express 4 middleware with no try/catch. When Ambita refuses the token request, the rejection is unhandled and Node exits on the first /api call. The caller sees socket hang up / ECONNRESET, not a 401, and the pod restarts. The probes don't catch this: they never touch Ambita.
  • That crash prints the credentials. The unhandled AxiosError is dumped to stdout with its request body, which is the form-encoded client_secret and password.
  • Every request logs the bearer token. console.debug("Token is active. Reusing", cachedToken) runs on each /api call. console.debug is not level-gated in Node.
  • Request paths carry national identity numbers (/api/persons/<nin>/...), and morgan logs every path.

Reaching the service in-cluster

Both paths expose the same API the same way: a ClusterIP Service on port 80, forwarding to the container's 6060. Only the Service name differs:

| Path | Service | Name comes from | | ----- | ------------------- | --------------- | | Helm | <release name> | {{ .Release.Name }} — often services-ambita-realty, but whatever the release was called | | Blocc | ambita-realty-api | <module alias>-<component> |

curl http://services-ambita-realty/api/persons/<nin>/properties   # helm, release "services-ambita-realty"
curl http://ambita-realty-api/api/persons/<nin>/properties        # blocc

The blocc name is not fixed by this repo either. ambita-realty-api is what you get with the conventional alias. A solution installs the module under a key in spec.modules, and blocc names every resource <that key>-<component>:

spec:
  modules:
    realty:                  # → Service `realty-api`
      org: stacc-classic
      name: ambita-realty

So module.yaml's metadata.name does not determine the address. The consuming solution's alias does. Callers should treat the host as configuration. The example solution's handler hardcodes it only because it owns the solution it runs in.

Never give the api an apps entry in a solution. It has no inbound authentication and answers with Stacc's Ambita credentials, so an app would publish property ownership by national identity number on a public hostname, at Stacc's expense per lookup. From a laptop, port-forward the Service instead:

kubectl -n <namespace> port-forward svc/<release name>      6060:80   # helm
kubectl -n <namespace> port-forward svc/ambita-realty-api   6060:80   # blocc

Port 6060 locally means the .rest files under src/requests work unchanged.

Breaking changes

From helm: the service moves

http://<release name>   →   http://ambita-realty-api

The paths (/api/persons, /api/cadastres, /api/shares, the /api/* pass-through to Ambita, /livez, /readyz), the responses and the port are identical. The configuration changes:

  • the two secrets become module properties instead of a Kubernetes Secret named by secretName;
  • deployment.env has no equivalent.

Nothing routes between the two, so during a migration both can run side by side and each caller has to be pointed at one explicitly.

From an earlier blocc module

There is none. The blocc registry has no ambita or ambita-realty module under stacc or stacc-classic, so stacc-classic/ambita-realty is the first. There are no old keys to migrate and no removed components.

Trying the blocc module

examples/test-solution runs the module with a small Flow process and a Case Manager around it. It needs Stacc's Ambita beta secrets in your shell:

export AMBITA_CLIENT_SECRET='...' AMBITA_PASSWORD='...'
cd examples/test-solution
blocc config set                 # build-context, deploy-context, environment=dev
blocc sync

See its README for port-forwarding, the process, and a working curl.