Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
f3e4935
feat: harden config and startup validation
ajaysinghj8 Mar 23, 2026
b36e4f1
feat: polish allow/deny edge cases, unknown-key warnings, startup sum…
ajaysinghj8 Mar 23, 2026
c928128
feat: add top-level unknown-key warnings and expand purge docs
ajaysinghj8 Mar 23, 2026
1bf1a72
docs: add admin UI implementation roadmap
ajaysinghj8 Mar 23, 2026
ade5476
docs: add admin API design and agent task list
ajaysinghj8 Mar 23, 2026
63dd133
docs: add admin UI PRD
ajaysinghj8 Mar 23, 2026
88fd345
feat(admin): implement admin API foundation + config endpoints (bundl…
ajaysinghj8 Mar 23, 2026
9de0a21
fix(admin): enforce local-only insecure auth bypass
ajaysinghj8 Mar 23, 2026
8001121
docs: add admin UI frontend implementation plan
ajaysinghj8 Mar 23, 2026
71e6678
feat(admin): add health and metrics summary endpoints
ajaysinghj8 Mar 23, 2026
782bf7c
feat(admin): add purge and audit endpoints
ajaysinghj8 Mar 23, 2026
b8442d6
feat(admin-ui): scaffold frontend shell
ajaysinghj8 Mar 23, 2026
5d6f46f
feat(admin-ui): wire dashboard, health, audit, and purge pages
ajaysinghj8 Mar 23, 2026
e81352e
feat(admin-ui): finish config editor integration
ajaysinghj8 Mar 23, 2026
be9db76
feat(admin-ui): add metrics and health dashboards
ajaysinghj8 Mar 23, 2026
d13f96f
fix(admin): apply config reload to runtime middleware
ajaysinghj8 Mar 23, 2026
1bd3b8e
feat(admin): tighten revision handling and config editor UX
ajaysinghj8 Mar 23, 2026
00d6f4f
fix(admin-ui): sync config editor drafts before save
ajaysinghj8 Mar 23, 2026
c95c58c
fix(metrics): expose configured namespaces consistently
ajaysinghj8 Mar 23, 2026
ab954a0
feat(admin-ui): polish Purge and Audit pages for operational safety
ajaysinghj8 Mar 23, 2026
0d35d7b
feat(admin): persist audit events across restarts
ajaysinghj8 Mar 23, 2026
2932434
fix(admin-ui): harden rules editor config round-trip
ajaysinghj8 Mar 24, 2026
3fef64d
feat(admin): add config history rollback workflow
ajaysinghj8 Mar 24, 2026
0354cba
feat(admin-ui): harden config draft workflow
ajaysinghj8 Mar 24, 2026
0ce9e38
fix(admin): limit oversized config payloads
ajaysinghj8 Mar 24, 2026
a74d9c7
feat(admin-ui): polish dashboard health and metrics views
ajaysinghj8 Mar 24, 2026
3b2a4df
feat(admin-ui): add raw config preview
ajaysinghj8 Mar 24, 2026
718c9b2
Harden admin UI secret handling
ajaysinghj8 Mar 24, 2026
28794a3
feat(admin-ui): show inline config validation feedback
ajaysinghj8 Mar 24, 2026
72a0239
feat(admin-ui): support YAML draft import and export
ajaysinghj8 Mar 24, 2026
7049f39
feat(admin-ui): add auth gate and docs polish
ajaysinghj8 Mar 24, 2026
c0de208
fix: move to npm
ajaysinghj8 Mar 24, 2026
2e9d289
ci: add admin-ui build to CI pipeline
ajaysinghj8 Mar 24, 2026
f1d37c6
fix: resolve minor code TODOs in proxy, ctx, and timeout middleware
ajaysinghj8 Mar 24, 2026
281f8b8
feat(admin-ui): polish metrics and dashboard pages
ajaysinghj8 Mar 24, 2026
b5c52f4
docs: add troubleshooting guide and contributor setup
ajaysinghj8 Mar 24, 2026
ca24eba
fix(deps): apply npm audit fixes and upgrade follow-redirects
ajaysinghj8 Mar 24, 2026
2988ff0
feat(deps): upgrade redis@3 → redis@4, migrate IStorage to Promise-ba…
ajaysinghj8 Mar 24, 2026
55131ef
fix(proxy): forward non-2xx backend responses instead of throwing
ajaysinghj8 Mar 24, 2026
345d4c0
fix(admin-ui): rollback button always disabled due to JSON format mis…
ajaysinghj8 Mar 25, 2026
6c6702f
feat(admin-ui): Phase 1 — shell redesign, collapsible sidebar, fixed …
ajaysinghj8 Mar 25, 2026
022bf37
feat(admin-ui): Phase 2 — config page redesign with 3-tab layout
ajaysinghj8 Mar 25, 2026
ea3f403
feat(admin-ui): Phase 3 — polish all pages with new design system
ajaysinghj8 Mar 25, 2026
f8d0963
Merge pull request #85 from ajaysinghj8/feat/admin-ui-redesign-phase1
ajaysinghj8 Mar 25, 2026
b626362
feat(log): optimise logs
ajaysinghj8 Mar 25, 2026
1a1ddec
fix(proxy): improve logging and add insecureSkipVerify for HTTPS upst…
ajaysinghj8 Mar 27, 2026
e59212a
refactor(ctx): move respondWithCtx into Context as respondWith method
ajaysinghj8 Mar 27, 2026
17e8d8e
docs: add getting started guide with config reference and HTTPS troub…
ajaysinghj8 Mar 27, 2026
15eec57
feat(docker): add single-container Docker build serving admin-ui and …
ajaysinghj8 Mar 27, 2026
9e100b9
fix(admin-ui): add @types/js-yaml to devDependencies
ajaysinghj8 Mar 27, 2026
8afc2cf
docs: add Docker run instructions and load-test config to getting sta…
ajaysinghj8 Mar 28, 2026
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
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
lib
admin-ui/node_modules
admin-ui/dist
.env
*.log
.git
docs
test
9 changes: 8 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,11 @@ SECURE=false
SSL_KEY=
SSL_CERT=
# Timeout for cache service. Default is 5000 ms
TIMEOUT=7000
TIMEOUT=7000

# Admin API shared secret for /__osham/admin/* endpoints
OSHAM_ADMIN_SECRET=
# Allow insecure admin access from localhost only (development/test only)
OSHAM_ADMIN_ALLOW_INSECURE_LOCAL=false
# Maximum accepted admin JSON request body size in bytes (default 1048576 = 1 MiB)
OSHAM_ADMIN_MAX_BODY_BYTES=1048576
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,20 @@ jobs:
- name: Test
run: npm test

build-admin-ui:
runs-on: ubuntu-latest

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

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install admin-ui dependencies
run: cd admin-ui && npm ci

- name: Build admin-ui
run: cd admin-ui && npm run build
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,16 @@ typings/

lib

admin-ui/dist
admin-ui/src/**/*.js
admin-ui/src/**/*.d.ts
admin-ui/vite.config.js
admin-ui/vite.config.d.ts
admin-ui/tsconfig.tsbuildinfo

cache-config.yml
.osham-admin-history/
.osham-admin-audit.jsonl

.vscode
.temp
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Stage 1: Build admin-ui
FROM node:20-alpine AS admin-ui-builder
WORKDIR /build/admin-ui
COPY admin-ui/package*.json ./
RUN npm ci
COPY admin-ui/ ./
RUN npm run build

# Stage 2: Build server
FROM node:20-alpine AS server-builder
WORKDIR /build
COPY package*.json ./
RUN npm ci
COPY src/ ./src/
COPY tsconfig.json ./
RUN npm run build

# Stage 3: Production
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY --from=server-builder /build/lib ./lib
COPY --from=admin-ui-builder /build/admin-ui/dist ./admin-ui/dist
COPY bin/ ./bin/

EXPOSE 26192
CMD ["node", "lib/index.js"]
77 changes: 75 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ SECURE=false
TIMEOUT=7000
```

See `cache-config.example.yml` for full options and examples. The server supports per-namespace rules, cache expiry, pooling, and query/header-based cache variation.
The server supports per-namespace rules, cache expiry, pooling, and query/header-based cache variation. See the inline example below and the full config reference in the docs.

### Example `cache-config.yml`

Expand Down Expand Up @@ -74,6 +74,40 @@ dummyRest:
cache: false
```

## Allow / Deny URL patterns

Each namespace accepts optional `allow` and `deny` glob pattern lists that control which paths Osham proxies. Requests blocked by these rules receive a `403` response with the header `x-osham-cache: denied`.

**Precedence rules:**

- If `deny` is set and the path matches any pattern → **403 Forbidden** (deny always wins).
- Else if `allow` is set and the path does **not** match any pattern → **403 Forbidden**.
- If neither `allow` nor `deny` is present, all paths within the namespace are handled normally (existing behavior unchanged).

**Example:**

```yaml
myNs:
expose: '/api/v1/*'
target: 'http://localhost:3000'
cache:
expires: 10s
allow:
- '/employees/**'
- '/employee/*'
deny:
- '/employees/private/**'
```

In this example:

- `/employees/123` → proxied (matches allow)
- `/employee/5` → proxied (matches allow)
- `/employees/private/data` → **403** (deny wins, even though it also matches `/employees/**` in allow)
- `/departments/1` → **403** (not in allow list)

Patterns follow glob syntax (e.g. `*` matches a single path segment, `**` matches any number of segments).

## Purge cache (administrative)

Osham provides an admin endpoint to invalidate cache by exact key or by pattern. See the detailed guide:
Expand Down Expand Up @@ -104,6 +138,30 @@ Scrape this endpoint from your Prometheus instance to track cache efficiency and

- [Metrics](docs/metrics.md)

## Admin UI

Osham now includes a sidecar admin UI under `admin-ui/` for config editing, health/metrics visibility, purge tooling, audit review, config history, rollback, and draft import/export.

### Run the admin UI locally

Start Osham first so the admin API is reachable, then in another shell:

```sh
cd admin-ui
npm install
npm run build
# or for local development
npm run dev
```

By default the Vite dev server proxies `'/__osham/*'` requests to `http://127.0.0.1:26192`. If your Osham server listens elsewhere, override the proxy target:

```sh
OSHAM_ADMIN_API_TARGET=http://127.0.0.1:3001 npm run dev
```

The UI stores `x-osham-admin-secret` in `sessionStorage` only and will prompt again if the saved secret is rejected by the admin API.

## When to use Osham

- Reduce backend load and TTFB for high-read API endpoints
Expand All @@ -127,11 +185,26 @@ The diagram below illustrates how Osham handles incoming HTTP GET requests:

![Osham Architecture](https://raw.githubusercontent.com/ajaysinghj8/osham/master/public/Arch.svg?sanitize=true&raw=true)

## Troubleshooting

Having problems? See the [Troubleshooting guide](docs/troubleshooting.md) for solutions to common issues including:

- Server won't start (missing config, invalid YAML, HTTPS env vars)
- Cache misses or incorrect TTL behaviour
- 403 responses from allow/deny rules
- Purge not working (auth, pattern format)
- Metrics endpoint returning 404
- Admin UI auth and CORS issues

## Contributing

PRs and issues welcome. Run tests with:
PRs and issues welcome. See the [Contributor Setup guide](docs/contributor-setup.md) for full local setup instructions, test guidance, and PR guidelines.

Quick start:

```sh
npm install
npm run build
npm test
```

Expand Down
12 changes: 12 additions & 0 deletions admin-ui/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Osham Admin</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading
Loading