-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add apps/demo sub-project for independent Vercel deployment #427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)): | ||
| - `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. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
| ``` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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/issueswithout an issue number. Update it to reference the actual issue/PR (e.g. #426) so the entry is actionable.