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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ apps/site/.next
apps/site/out
apps/site/.source

# Apps — Demo
apps/demo/.vercel

# Database
*.sqlite3
*.db
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changelog

All notable changes to the ObjectQL monorepo are documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- **`apps/demo`** — standalone Vercel-deployable demo application ([#issue](https://github.com/objectstack-ai/objectql/issues)):
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

The changelog entry links to https://github.com/objectstack-ai/objectql/issues without an issue number. Update it to reference the actual issue/PR (e.g. #426) so the entry is actionable.

Suggested change
- **`apps/demo`** — standalone Vercel-deployable demo application ([#issue](https://github.com/objectstack-ai/objectql/issues)):
- **`apps/demo`** — standalone Vercel-deployable demo application ([#426](https://github.com/objectstack-ai/objectql/issues/426)):

Copilot uses AI. Check for mistakes.
- `vercel.json` — Vercel deployment configuration (custom serverless, 1 GiB memory, 60 s timeout).
- `api/[[...route]].ts` — catch-all serverless entry point bootstrapping the ObjectStack kernel with ObjectQL plugins, InMemoryDriver, Auth, Console, and Studio UIs.
- `scripts/build-vercel.sh` — ordered build script for all workspace dependencies.
- `scripts/patch-symlinks.cjs` — pnpm symlink dereference for Vercel bundling.
- `objectstack.config.ts` — local development configuration reusing the project-tracker showcase.
- `README.md` — deployment documentation for both local and Vercel workflows.
- Root `demo:dev` script for quick local start.
1 change: 1 addition & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,7 @@ Priority tasks following the `@objectstack` v3.2.6 upgrade:
| 7 | Structured logging framework | Low | 🔴 Open | Migrate `sdk` retry `console.log` and `types/logger.ts` fallback `console.error` to hook-based structured logging. |
| 8 | Add tests for `plugin-optimizations` and `plugin-query` | High | ✅ Done | Both packages now have comprehensive test suites — 202 tests across 4 test files. |
| 9 | Reduce `any` in protocol handlers | Medium | 🔴 Open | `protocol-json-rpc` (102), `protocol-graphql` (101), `protocol-odata-v4` (83) — highest `any` density in the monorepo. |
| 10 | Deploy `apps/demo` to Vercel | Medium | ✅ Done | Standalone `apps/demo` sub-project with serverless entry point (`api/[[...route]].ts`), Vercel config, build script, and pnpm symlink patching. Independent from `apps/site`. |

---

Expand Down
114 changes: 114 additions & 0 deletions apps/demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# ObjectQL Demo

A standalone, deployable demo application for the ObjectQL platform.
Runs locally with `@objectstack/cli` and deploys to **Vercel** as a serverless function.

## Features

- **In-memory driver** — zero external database required; data persists across warm Vercel invocations.
- **Console UI** — full ObjectStack Console available at `/console/`.
- **Studio UI** — ObjectStack Studio available at `/_studio/`.
- **Project-Tracker showcase** — ships with the `examples/showcase/project-tracker` metadata (objects, views, permissions) so the demo has real data structures out of the box.
- **Auth** — Better-Auth based authentication via `@objectstack/plugin-auth`.

## Local Development

```bash
# From the monorepo root:
pnpm install

# Start the demo in dev mode:
pnpm --filter @objectql/demo dev

# Or from the apps/demo directory:
cd apps/demo
pnpm dev
```

The development server starts on `http://localhost:3000`.

## Vercel Deployment

### Prerequisites

1. A [Vercel account](https://vercel.com).
2. The [Vercel CLI](https://vercel.com/docs/cli) installed (`npm i -g vercel`).

### Setup

1. **Create a new Vercel project** pointing to this repository.
2. In **Project Settings → General**, set the **Root Directory** to `apps/demo`.
3. Configure the following **Environment Variables**:

| Variable | Required | Description |
|---|---|---|
| `AUTH_SECRET` | **Yes** (production) | Secret key for signing auth tokens. Generate with `openssl rand -base64 32`. |
| `AUTH_TRUSTED_ORIGINS` | No | Comma-separated list of additional trusted origins (e.g. `https://myapp.example.com`). |

4. Deploy:

```bash
# From the monorepo root:
vercel --cwd apps/demo

# Or for production:
vercel --cwd apps/demo --prod
```

### How It Works

- **`vercel.json`** — Configures Vercel to use a custom build command, allocate 1 GiB memory to the serverless function, and rewrite all requests to the catch-all `api/[[...route]].ts` handler.
- **`api/[[...route]].ts`** — Bootstraps the full ObjectStack kernel with ObjectQL plugins, the in-memory driver, auth, Console, and Studio. Uses `@hono/node-server`'s `getRequestListener()` to bridge the Vercel serverless runtime with the Hono HTTP framework.
- **`scripts/build-vercel.sh`** — Builds all required workspace packages (foundation, drivers, plugins, protocols, examples) in the correct dependency order.
- **`scripts/patch-symlinks.cjs`** — Replaces pnpm workspace symlinks with real copies so Vercel can bundle the function without symlink errors.

### Monorepo Multi-Project

This repository contains two independent Vercel projects:

| Project | Root Directory | Framework |
|---|---|---|
| **`apps/site`** | `apps/site` | Next.js (fumadocs) |
| **`apps/demo`** | `apps/demo` | `null` (custom serverless) |

Each project is configured independently and deployed separately. Changes to one do not affect the other.

## Project Structure

```
apps/demo/
├── api/
│ └── [[...route]].ts # Vercel serverless entry point
├── scripts/
│ ├── build-vercel.sh # Vercel build script
│ └── patch-symlinks.cjs # pnpm symlink dereference for Vercel
├── objectstack.config.ts # Local dev configuration
├── package.json
├── tsconfig.json
├── vercel.json
└── README.md
```

## Architecture

```
Vercel Edge Network
┌──────────────────┐
│ api/[[...route]] │ ← catch-all serverless function
└────────┬─────────┘
┌───────────┼───────────┐
▼ ▼ ▼
┌──────────┐ ┌────────┐ ┌──────────┐
│ Console │ │ Studio │ │ REST/RPC │
│ SPA (/) │ │/_studio│ │ /api/* │
└──────────┘ └────────┘ └──────────┘
│ │ │
└───────────┴───────────┘
ObjectStack Kernel
(ObjectQL + Auth +
InMemoryDriver)
```
Loading
Loading