This guide will help you set up a local development environment for contributing to @guillotinaweb/react-gmi.
- Node.js: 22.13 or higher (required by pnpm 11)
- pnpm: 11.x — run
corepack enableonce; version is pinned inpackage.json(packageManager) and enforced in CI - Docker: For running Guillotina and PostgreSQL
# Clone the repository
git clone git@github.com:guillotinaweb/guillotina_react.git
cd guillotina_react
# Install dependencies (root + E2E package; first time also installs Playwright browsers)
pnpm install
pnpm e2e:install
# Start Guillotina + Postgres in the background (Docker Compose)
pnpm guillotina:up
# Development server (same or another terminal)
pnpm devThe playground will be available at http://127.0.0.1:5173
Guillotina is the backend the library talks to. The simplest way is Docker Compose: one command starts PostgreSQL and the example Guillotina app (same Dockerfile as CI).
From the repository root:
pnpm guillotina:upEquivalent:
docker compose -f guillotina_example/guillotina_react_app/docker-compose.yml up --build- API:
http://127.0.0.1:8080 - Postgres on the host (optional tools like
psql):127.0.0.1:5532(inside Compose the hostname remainspostgres) - Containers run detached (
-d); follow logs withpnpm guillotina:logs(Ctrl+C stops tailing only) - Stop and remove containers:
pnpm guillotina:down
After changing Python code under guillotina_example/guillotina_react_app, run pnpm guillotina:up again so the image rebuilds (or docker compose ... up --build).
If you prefer running Guillotina directly:
# Create virtual environment
python -m venv venv
source venv/bin/activate
# Install Guillotina
pip install guillotina
# Install the example app (optional, for testing custom types)
cd guillotina_example/guillotina_react_app
pip install -e .
cd ../..
# Start PostgreSQL (still via Docker)
docker run -d \
--name postgres_guillotina \
-e POSTGRES_DB=guillotina \
-e POSTGRES_USER=guillotina \
-e POSTGRES_HOST_AUTH_METHOD=trust \
-p 127.0.0.1:5532:5432 \
postgres:18
# Run Guillotina
guillotina -c guillotina_example/guillotina_react_app/config.yamlWith Docker Compose and config.yaml, the **db** application database already exists at /db. You only need extra steps if you use a different config or empty data volume.
Open the playground at http://127.0.0.1:5173 and use the UI as needed.
Only if /db is missing or you need an extra container:
curl -X POST http://127.0.0.1:8080/db \
-H "Content-Type: application/json" \
-u root:root \
-d '{"@type": "Database", "id": "db"}'
curl -X POST http://127.0.0.1:8080/db \
-H "Content-Type: application/json" \
-u root:root \
-d '{"@type": "Container", "id": "container_test", "title": "Test Container"}'The example app includes a populate command that creates a container with test data (users, groups, folders, and sample content):
# With Docker Compose (from project root; starts Postgres if needed, then runs populate once)
pnpm guillotina:populate
# Using local installation (after activating venv)
cd guillotina_example/guillotina_react_app
guillotina populate -c config.yaml --container_id=containerThe populate command creates:
- A container with the specified ID
- Installs
dbusersandimageaddons - Creates a test group (
group_view_content) - Creates a test user (
default/default) - Creates a folder (
gmi_folder) - Creates 50 sample GMI items with various field types
This is useful for quickly setting up test data for development and testing.
| Command | Description |
|---|---|
pnpm dev |
Start playground with HMR (Vite dev server) |
pnpm build |
Build the library (JS + CSS) using Vite |
pnpm build:playground |
Build playground for preview/testing |
pnpm preview |
Preview built playground (port 4173) |
pnpm test |
Run unit tests (Vitest) |
pnpm test:e2e |
Run E2E tests (Playwright, auto-builds playground) |
pnpm e2e:install |
Install e2e deps + Playwright browsers (run after clone / updates) |
pnpm guillotina:up |
Start Postgres + Guillotina (Compose, detached) |
pnpm guillotina:logs |
Follow Compose service logs |
pnpm guillotina:down |
Stop Compose stack |
pnpm guillotina:populate |
Load sample data (populate in Guillotina) |
pnpm lint |
Run ESLint |
pnpm format |
Format code with Prettier |
pnpm test- One-time (after clone or Playwright upgrade):
pnpm e2e:install— installs thee2epackage and downloads Chromium (and dependencies). Without this step, tests fail with “Executable doesn't exist” for the browser. - Before each run:
pnpm guillotina:up— keeps API athttp://127.0.0.1:8080(same URL as the playground). Wait untilcurl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:8080prints200. - Run tests (from repo root): Playwright builds the playground and starts preview on
http://127.0.0.1:4173viawebServer.
pnpm guillotina:up
pnpm test:e2eManual mode from e2e/ (if you already ran pnpm install there):
cd e2e
pnpm install
pnpm exec playwright install --with-deps # first time only
pnpm playwright:testNote: e2e/playwright.config.js uses 127.0.0.1 for the preview URL so it matches playground/src/App.tsx (http://127.0.0.1:8080) and avoids localhost / IPv6 mismatches.
pnpm buildThis generates:
dist/react-gmi.js- CommonJS formatdist/react-gmi.modern.js- ES Module formatdist/index.d.ts- TypeScript declarationsdist/css/style.css- Compiled styles
guillotina_react/
├── src/guillo-gmi/ # Library source code
├── playground/ # Development app (Vite + React 19)
├── e2e/ # Playwright E2E tests
├── examples/ # Example apps for consumers
├── docs/ # Documentation
├── vite.config.ts # Library build config
└── package.json
When using the provided Guillotina configuration:
| Field | Value |
|---|---|
| Username | root |
| Password | root |
# Find process using a specific port
lsof -i :8080 # Guillotina
lsof -i :5532 # PostgreSQL (Compose stack)
lsof -i :5432 # Other local PostgreSQL
lsof -i :5173 # Vite dev server
lsof -i :4173 # Vite preview server
# Stop Guillotina stack (Compose)
pnpm guillotina:downMake sure your Guillotina config includes the development URLs in cors.allow_origin:
http://127.0.0.1:5173orhttp://localhost:5173(dev server)http://127.0.0.1:4173orhttp://localhost:4173(preview server)
The playground is configured to use 127.0.0.1 by default, but both work.
The playground uses path aliases (@guillotinaweb/react-gmi) to import from the library source directly. If you see TypeScript errors:
- Make sure you have the latest dependencies:
pnpm install- Restart the TypeScript server in your IDE
- Verify the alias is working in
playground/vite.config.ts
- Playwright browsers: Run
pnpm e2e:install. Missing Chromium shows asExecutable doesn't existunderms-playwright. - Guillotina:
curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8080should be200afterpnpm guillotina:up. - Compose:
docker psshould listguillotina_react_appservices. - Data: Tests create
container_testinbeforeEach; you do not need manual “Initial setup” for E2E when using Compose +config.yaml.