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
6 changes: 5 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Optional environment variables — the editor works without any of these
# Optional environment variables

# Dev server port (default: 3002, set in .env.defaults)
# PORT=3002

# Public editor origin used by Mint OAuth and same-origin checks.
# Set this when Pascal is hosted outside editor.pascal.app.
# MINT_PASCAL_HOST_ORIGIN=https://pascal.example.com
10 changes: 9 additions & 1 deletion SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ cp .env.example .env
| Variable | Required | Description |
|----------|----------|-------------|
| `PORT` | No | Dev server port (default: 3002) |
| `MINT_PASCAL_HOST_ORIGIN` | No | Public editor origin used by Mint sign-in and request checks. Set it for self-hosted deployments. |

The editor works fully without any environment variables.
Local development and the official hosted editor work without any environment variables.

## Docker

Expand All @@ -36,6 +37,13 @@ docker compose up -d
The editor will be running at **http://localhost:3000**. Saved scenes live in
the `pascal-data` volume, so they survive `docker compose down`.

Docker defaults `MINT_PASCAL_HOST_ORIGIN` to `http://localhost:3000`. Override
it when hosting Pascal at another origin:

```bash
MINT_PASCAL_HOST_ORIGIN=https://pascal.example.com docker compose up -d
```

Keep the container port at 3000: the `/scenes` page fetches its own API through
a base URL that only `NEXT_PUBLIC_APP_URL` can override, and Next inlines that
value at build time, so remapping the port to something else makes the page
Expand Down
12 changes: 12 additions & 0 deletions apps/editor/app/api/plugins/mint/[...path]/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { handleMintPascalRequest } from '@mint/pascal-plugin/server'
import { BASE_URL } from '@/lib/utils'

export const runtime = 'nodejs'
export const dynamic = 'force-dynamic'

const route = (request: Request) =>
handleMintPascalRequest(request, {
origin: process.env.MINT_PASCAL_HOST_ORIGIN ?? BASE_URL,
})

export { route as GET, route as POST }
1 change: 1 addition & 0 deletions apps/editor/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@source "../../../packages/editor/src";
@source "../../../packages/nodes/src";
@source "../../../node_modules/@pascal-app/plugin-trees/src";
@source "../../../node_modules/@mint/pascal-plugin/src";

@custom-variant dark (&:is(.dark *));

Expand Down
3 changes: 3 additions & 0 deletions apps/editor/lib/bootstrap.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { mintHostPanel, mintPlugin } from '@mint/pascal-plugin'
import {
type AnyNodeDefinition,
discoverPlugins,
Expand Down Expand Up @@ -85,6 +86,8 @@ export async function loadExternalPlugins(): Promise<void> {
// so it is registered separately from the core plugin manifest.
extendPluginDiscovery(async () => [treesPlugin])
registerEditorHostPanel(treesHostPanel)
extendPluginDiscovery(async () => [mintPlugin])
registerEditorHostPanel(mintHostPanel)

loadBuiltinsSync()
void loadExternalPlugins()
1 change: 1 addition & 0 deletions apps/editor/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const nextConfig: NextConfig = {
'@pascal-app/editor',
'@pascal-app/mcp',
'@pascal-app/plugin-trees',
'@mint/pascal-plugin',
'@dgreenheck/ez-tree',
],
turbopack: {
Expand Down
1 change: 1 addition & 0 deletions apps/editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"dependencies": {
"@iconify/react": "^6.0.2",
"@mint/pascal-plugin": "github:mintdotgg/mint-pascal-plugin#902c546dbaece6b31455c0dc394afe6b9cd136fe",
"@number-flow/react": "^0.6.0",
"@pascal-app/core": "*",
"@pascal-app/editor": "*",
Expand Down
3 changes: 3 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ services:
- "3000:3000"
environment:
NODE_ENV: production
# Public editor origin used by Mint OAuth and same-origin checks.
MINT_PASCAL_HOST_ORIGIN: ${MINT_PASCAL_HOST_ORIGIN:-http://localhost:3000}
# Scene database location. Without the volume below, every saved project is
# discarded when the container is recreated.
PASCAL_DATA_DIR: /data
Expand Down