Skip to content

Latest commit

 

History

History
226 lines (149 loc) · 10.4 KB

quick-start.md

File metadata and controls

226 lines (149 loc) · 10.4 KB

Quick Start

OpenFrame OSS Frontend is the application layer for OpenFrame, an AI-driven MSP operations platform. This repository contains the Next.js web console (apps/web), the Android mobile shell (apps/mobile), and the desktop runtime (apps/desktop), plus a vendored NATS Rust client. This guide gets the web console running locally in about five minutes.

For the full picture of how this repository fits the wider OpenFrame ecosystem (published artifacts, upstream dependencies), see Ecosystem.

Before You Start

Make sure your machine meets the prerequisites described in Prerequisites. At minimum you need:

  • Node.js version 26 (see the repository's .nvmrc)
  • npm version 11.11.0 or newer (devEngines.packageManager in apps/web/package.json enforces this with onFail: error)
node --version
npm --version

TL;DR: 5-Minute Setup

These steps bring up the web console (apps/web), which is the primary entry point for working with OpenFrame OSS Frontend.

1. Clone The Repository

git clone https://github.com/flamingo-stack/openframe-oss-frontend.git
cd openframe-oss-frontend/apps/web

2. Install Dependencies

npm ci

npm ci installs the exact dependency versions pinned in apps/web/package.json, including next 16.4.5, react 19.2.4, and the shared @flamingo-stack/openframe-frontend-core package consumed from its pinned preview build. A prepare script runs Husky git hooks (cd ../.. && husky || true) as part of install from the monorepo root.

3. Configure Environment Variables

Copy the example environment file and adjust values for your setup:

cp .env.example .env.local

apps/web/.env.example documents each variable. The most relevant one for local development is:

# 'oss-tenant' | 'saas-tenant' | 'saas-shared'
NEXT_PUBLIC_APP_MODE=oss-tenant

Leave NEXT_PUBLIC_APP_MODE at its default, oss-tenant, for an open-source tenant setup. Other variables such as NEXT_PUBLIC_RECAPTCHA_SITE_KEY, NEXT_PUBLIC_BREW_CASK, NEXT_PUBLIC_SUPABASE_HOST, and NEXT_PUBLIC_FEATURE_SCRIPT_SCHEDULE can stay unset for a basic local run; refer to your environment configuration for tenant-specific values such as gateway hosts and credentials.

No default credentials, usernames, or passwords are defined in this repository's configuration files. Refer to your environment configuration for any login details your deployment requires.

4. Generate The Relay Schema Artifacts

The web app uses Relay for GraphQL data access. Before the first build or dev run, generate the schema enums used by generated types:

npm run generate-enums

This runs scripts/generate-schema-enums.mjs, one of the steps also wired into npm run build.

5. Start The Development Server

npm run dev

This runs next dev -p ${PORT:-3000}, so the app listens on port 3000 by default (set PORT to override it). Open your browser at http://localhost:3000 to see the running console.

> openframe-frontend@0.1.0 dev
> next dev -p ${PORT:-3000}

   ▲ Next.js 16.4.5
   - Local:        http://localhost:3000
   - Environments: .env.local

 ✓ Ready in 1200ms

The exact banner wording depends on your installed Next.js version; expect a "ready" message followed by the local URL.

A Minimal "Hello World" Walkthrough

OpenFrame OSS Frontend does not ship a standalone "hello world" page — it is a full MSP operations console. The fastest way to confirm your setup works end-to-end is to run the dev server and the type checker together, then inspect one existing route.

Step 1: Confirm The Dev Server Responds

With npm run dev running from the previous section, request the root page:

curl -I http://localhost:3000

Expected output is an HTTP success or redirect status line, for example:

HTTP/1.1 200 OK

or a redirect toward an authentication route, depending on NEXT_PUBLIC_APP_MODE and session state. Either response confirms the Next.js server, environment loading, and routing are working.

Step 2: Run The Project's Automated Checks

Validate the toolchain without needing a backend connection:

npm run type-check
npm run lint
npm run test
  • type-check runs tsc --noEmit against the full TypeScript project.
  • lint runs ESLint with the repository's custom rule set (eslint.config.mjs, plus the eslint-rules/ directory for OpenFrame-specific conventions such as component-shape.mjs and conventions.mjs).
  • test runs vitest run followed by npm run test:node, which executes node --test src/lib/*.test.mjs for Node-native library tests.

Expected Output

A healthy local setup prints something close to:

$ npm run type-check
> tsc --noEmit
(no errors — command exits 0)

$ npm run lint
> eslint . --cache --cache-location node_modules/.cache/eslint/ --max-warnings 0
(no errors — command exits 0)

$ npm run test
> vitest run && npm run test:node
 ✓ src/**/*.test.ts(x) (N tests)
 Test Files  N passed (N)
      Tests  N passed (N)

If lint or type-check fails immediately after a fresh clone, re-run npm ci to confirm dependencies installed cleanly, and re-run npm run generate-enums to confirm the Relay-related generated enums exist.

Step 3: Explore A Real Feature Route

Once the dev server is up, sign-in flows route through the (auth) route group, and authenticated operational views live under the (app) route group — for example apps/web/src/app/(app)/dashboard, apps/web/src/app/(app)/customers, and apps/web/src/app/(app)/devices. These are documented in depth in the architecture reference (see Dashboard and Customers).

Building For Production

To produce a production build locally:

npm run build

This runs, in order: generate-enums, relay-compiler, and next-styles build (per the build script in apps/web/package.json). To start the compiled app:

npm run start

This runs next start -p ${PORT:-3000}.

A static export variant (used by the desktop and mobile shells) is available via:

npm run build:export

This sets OPENFRAME_BUILD_TARGET=export before invoking the normal build.

Running Other Repository Pieces

Desktop Shell (Tauri)

apps/desktop wraps the same web console's static export in a Tauri (Rust) shell and publishes the openframe_console cargo artifact at version 0.1.0. It depends on async_nats from the NATS Rust Client for its background notification plane. To stage a placeholder web bundle and run the shell in dev mode:

cd apps/desktop
npm run predev
npm run dev

predev invokes scripts/make-placeholder-web.mjs --if-missing, which writes a minimal www/index.html only if one is not already staged — this lets the Tauri shell compile without first building the full web export. To stage the real web export instead, run npm run build:web (backed by apps/desktop/scripts/build-web.sh), which builds apps/web with OPENFRAME_BUILD_TARGET=export and copies its dist/ output into apps/desktop/www.

A full production build (make build from apps/desktop/Makefile) requires OPENFRAME_SHARED_HOST_URL to be set, for example:

make build OPENFRAME_SHARED_HOST_URL=https://openframe.ai

Mobile Shell (Capacitor)

apps/mobile wraps the same static web export in a Capacitor shell targeting Android (and iOS build scripts are present under apps/mobile/scripts/). It holds no UI code itself. A typical local flow:

cd apps/mobile
npm run build:web
npm run sync

build:web runs scripts/build-web.sh; sync runs cap sync to propagate the staged web bundle into the native projects. Platform-specific release scripts such as scripts/build-android-stage.sh, scripts/build-ios-stage.sh, and scripts/build-android-prod.sh are oriented toward CI and store-distribution lanes and require environment variables such as NEXT_PUBLIC_SHARED_HOST_URL and signing credentials — treat these as advanced workflows beyond the quick-start scope.

Troubleshooting

Symptom Likely Cause What To Check
npm ci fails on engine check npm version older than 11.11.0 Upgrade npm; devEngines.packageManager in apps/web/package.json fails the install (onFail: error)
Type errors mentioning generated enums generate-enums not run Run npm run generate-enums before type-check or build
Lint fails with many warnings Custom rule set or stale cache Re-run npm run lint:fix, or clear node_modules/.cache/eslint/
Dev server starts but API calls fail Tenant/gateway environment not configured Review your .env.local values against apps/web/.env.example; refer to your environment configuration for the gateway host
Desktop shell fails to compile (www missing) No placeholder or real web bundle staged Run npm run predev (placeholder) or npm run build:web (real export) inside apps/desktop

Next Steps

Once your environment is running:

This project does not use GitHub Issues or GitHub Discussions for support. Join the OpenMSP Slack community for questions and discussion.