Monorepo & Packages
Jet Admin is structured as a workspace monorepo (using Yarn Workspaces). This architecture allows the frontend and backend applications to share types, schemas, and UI components without duplicating code or publishing to an external npm registry.
Architecture
The repository is divided into two main domains:
jet-admin/
├── apps/
│ ├── backend/ # Node.js Express API
│ └── frontend/ # React 18 SPA (Vite)
└── packages/
├── datasource-types/ # Shared schemas for DB connections
├── datasources-logic/ # Backend drivers (Postgres, Stripe, etc.)
├── datasources-ui/ # Frontend connection forms
├── ui/ # Shared React components
├── widget-types/ # Shared widget metadata
├── widgets-logic/ # Backend chart data transformers
├── widgets-ui/ # Frontend widget configuration forms
├── workflow-edges/ # Custom React Flow edges
└── workflow-nodes/ # Frontend Workflow Nodes
Why Packages?
By moving feature logic into the packages/ folder, the codebase remains decoupled:
- The Backend imports
@jet-admin/datasources-logicto execute queries, without needing to know how the connection form looks. - The Frontend imports
@jet-admin/datasources-uito render the configuration form, without needing to bundle the actualpg(PostgreSQL) runtime driver. - Both share
@jet-admin/datasource-typesto ensure the shape of the data remains strictly typed across the wire.
Working with Packages
Consuming Packages
Packages are symlinked locally via Yarn workspaces. You import them using the @jet-admin/* scope.
// In apps/frontend/src/...
import { WidgetConfigForm } from '@jet-admin/widgets-ui';
Developing Packages
If you make a change to a package (e.g., adding a new React component to @jet-admin/ui), you must ensure the consuming application (Frontend) is aware of it.
Run the workspace watch script from the repository root:
npm run dev:all-packages
This triggers vite build --watch or tsc --watch inside the relevant packages, seamlessly updating the frontend dev server.
Creating a New Package
If you are building a new, highly decoupled feature system:
- Copy
packages/template-packageas a starting point. - Update
package.jsonwith the new name (e.g.,@jet-admin/comments-ui). - Implement your functionality in
src/index.js. - Ensure the package is included by the root
package.jsonworkspace glob.