Marcelle provides a command line interface, for generating applications, components and backends. The source code is available on Github (opens new window).

# Installation

The CLI is an npm package that must be installed globally:

npm install -g @marcellejs/cli

Once installed, the marcelle command should be available:

marcelle --version

# Usage

# Generating an Application

To generate a new project:

mkdir myproject
cd myproject
marcelle generate app

Several options are available to customize the project. If you don't know what to chose, just hit enter to select the defaults.

Screenshot of the CLI's options

This will scaffold a new Marcelle project with the following structure (it might vary according to the build tool, this example is for vite):

├── README.md
├── index.html     # The main HTML page for your application
├── package.json
├── src
│   ├── index.js   # Main application script
│   └── components    # Directory containing local components bundled with your application
│       └── index.js
└── vite.config.js # Build tool configuration file

To run the application in development mode (with HMR), run:

npm run dev # or yarn dev

# Generating a Component

It is possible to use the generator to create new custom components for an application or a marcelle package.

marcelle generate component

Just enter your component's name (e.g. my-component) and the generator will create a template component that you can your in your script:

import { myComponent } from './components';

const m = myComponent(opts);

Components are stored in the src/components directory and provide a Svelte (opens new window) view by default:

├── src
│   └── components
│       ├── my-component
│       │   ├── my-component.component.js # Component definition file
│       │   ├── my-component.view.svelte    # Svelte component defining the component's view
│       │   └── index.js            # function wrapper
│       └── index.js

# Generating a Backend

It is possible to use the generator to add server-side data storage (backend).

marcelle generate backend

Two options are available for the backend:

To run the server:

npm run backend

The backend configuration files are stored in backend/configuration.