Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Publish NPM Packages

on:
release:
types: [published] # triggers when a release is published on GitHub
workflow_dispatch: # allows manual trigger from the Actions tab

jobs:
publish:
name: Build, Test & Publish to NPM
runs-on: ubuntu-latest
defaults:
run:
working-directory: platform/packages

permissions:
contents: read
id-token: write # required for npm provenance

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
cache-dependency-path: framework/platform/packages/pnpm-lock.yaml
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cache-dependency-path points to framework/platform/packages/pnpm-lock.yaml, but this repo's lockfile is at platform/packages/pnpm-lock.yaml (no framework/ directory). This will disable pnpm caching and may slow down the workflow; update the path to the correct lockfile location.

Suggested change
cache-dependency-path: framework/platform/packages/pnpm-lock.yaml
cache-dependency-path: platform/packages/pnpm-lock.yaml

Copilot uses AI. Check for mistakes.

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build all packages
run: pnpm build

- name: Run tests
run: pnpm test

- name: Publish all packages to NPM
run: pnpm -r publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: Release and Deploy

on:
release:
types: [ created ]
types: [ published ]

jobs:
build:
Expand Down
3 changes: 3 additions & 0 deletions examples/demo-client-books/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# demo-client-books backend API URL — override for production
PUBLIC_API_URL=https://your-demo-zk-books.example.com

5 changes: 5 additions & 0 deletions examples/demo-client-books/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
dist/
.env
.env.local
.astro/
95 changes: 95 additions & 0 deletions examples/demo-client-books/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# demo-client-books

> Public storefront demo built with **Astro** + **@dynamia-tools/sdk**, consuming the [`demo-zk-books`](../demo-zk-books) backend.

---

## What it shows

| Page | URL | Description |
|------|-----|-------------|
| Home | `/` | Featured books grid with category filter and pagination |
| Books | `/books` | Full catalog with search, category filter and pagination |
| Book detail | `/books/:id` | Cover, price, stock status, synopsis and reader reviews |
| Categories | `/categories` | All categories with links to filtered book list |

Everything is **server-rendered** (SSR via `@astrojs/node`), so each request fetches live data from the Dynamia Platform REST API via `@dynamia-tools/sdk`.

---

## Prerequisites

- Node.js ≥ 20
- [`demo-zk-books`](../demo-zk-books) backend running (defaults to `http://localhost:8080`)

Comment on lines +21 to +24
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README says the backend defaults to http://localhost:8080, but the actual default in code/.env examples is http://localhost:8484. Please align the documented default with the implementation to avoid confusion when running the demo.

Copilot uses AI. Check for mistakes.
---

## Quick start

```bash
# 1 – Install dependencies
npm install

# 2 – Point to your backend (edit .env or set the env var)
echo "PUBLIC_API_URL=http://localhost:8484" > .env

# 3 – Dev server with hot-reload
npm run dev # http://localhost:4321

# 4 – Production build
npm run build
node dist/server/entry.mjs
```

---

## Project structure

```
demo-client-books/
├── src/
│ ├── layouts/
│ │ └── Layout.astro # Navbar, footer, global CSS
│ ├── lib/
│ │ ├── client.ts # DynamiaClient singleton (reads PUBLIC_API_URL)
│ │ ├── types.ts # TypeScript types mirroring Java domain
│ │ └── api.ts # Thin helpers: getBooks(), getCoverUrl(), ...
│ └── pages/
│ ├── index.astro # Home / featured books
│ ├── books/
│ │ ├── index.astro # /books — full catalog
│ │ └── [id].astro # /books/:id — book detail
│ └── categories/
│ └── index.astro # /categories
├── .env # PUBLIC_API_URL (git-ignored)
├── .env.example # Template
├── astro.config.mjs
├── package.json
└── tsconfig.json
```

---

## SDK usage

```typescript
import { DynamiaClient } from '@dynamia-tools/sdk';

const client = new DynamiaClient({ baseUrl: 'http://localhost:8080' });

// List books (CrudPage virtual path: "library/books")
const { content, total } = await client.crud('library/books').findAll({ page: 1, size: 12 });

// Single book
const book = await client.crud('library/books').findById(1);

// File cover URL
const url = client.files.getUrl(book.bookCover.filename, book.bookCover.uuid);
```

---

## License

Apache 2.0 — © Dynamia Soluciones IT SAS

13 changes: 13 additions & 0 deletions examples/demo-client-books/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from 'astro/config';
import node from '@astrojs/node';

// https://astro.build/config
export default defineConfig({
output: 'server',
adapter: node({ mode: 'standalone' }),
server: {
port: 4321,
},
});


Loading