Skip to content
FOSSBillingPublic

About

FOSSBilling serverless worker providing multiple API endpoints.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

FOSSBilling services

This repository contains the FOSSBilling API and its supporting libraries. It uses npm workspaces and one root package-lock.json. Install dependencies from this repository root with npm ci; each workspace declares its own dependencies.

Workspace Purpose Deployment
services/api HTTP API, authentication, package processing and publication Cloudflare Workers
libraries/extension-packaging Shared ZIP processing, manifest and storage adapters Bundled by its consumers
libraries/logging Structured logging and credential redaction Bundled by its consumers

Services do not import each other's source. Shared libraries are private npm workspaces consumed directly from TypeScript source; there is no separate package publication or library build step. Hosting configuration belongs to its service.

Development

Use Node.js 26.12.0 or later in the 26.x series for local development and CI. Hosting runtime selection belongs to each service's deployment configuration. Native dependencies are installed for the build host.

npm ci
npm run cf-typegen
cp -n services/api/.dev.vars.example services/api/.dev.vars
npm run dev  # API and local S3 storage

Run npm run cf-typegen after a fresh checkout before using an editor or running tsc directly. npm run typecheck generates the Worker declarations automatically.

API migrations and other service-specific commands use npm's workspace option:

npm run db:migrate:all:local --workspace @fossbilling/api
npm run test:workers --workspace @fossbilling/api

The API reads local package storage and authentication settings from services/api/.dev.vars. If that file already exists, replace its package and asset storage settings with the local values from .dev.vars.example and keep your authentication credentials. See the API README for configuration.

Checks

npm run format:check
npm run lint
npm run typecheck
npm test
npm run build:api  # build the production artifact locally

Each workspace owns its tests and type checking. The root test and type-check commands run all workspaces. Keep the single root lockfile updated with npm install from the repository root; do not create service-specific lockfiles.

Deployments

The API uses the same pinned shared Cloudflare workflow as fossbilling.org. CI/CD validates the workspaces and builds a self-contained Worker artifact, including deployment configuration and SQL.

  • Pushes to main migrate production D1 and deploy the tested artifact.
  • Other branch pushes migrate staging D1 and deploy Previews using the bindings in services/api/cloudflare.config.ts for Preview builds. Previews have stable branch and immutable commit URLs.
  • PR runs validate the workspaces and build the API artifact.

See the API deployment setup for GitHub environments, staging resource IDs, Preview secrets and comments, migration behaviour and the Workers Builds cutover. All API production and Preview deployments require validation, the API build and migrations to succeed. services/api/cloudflare.config.ts sets EXTENSION_PACKAGES_MODE to enabled for production and disabled for Previews. Complete the production prerequisites before merging an enablement change.

npm run cf-deploy remains the explicit manual production command; it applies remote migrations and deploys the API.

About

FOSSBilling serverless worker providing multiple API endpoints.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Sponsor this project

Used by

Contributors

Languages