
# Getting Started

To get started look at the [examples](https://github.com/c0ckp1t/c0ckp1t-webroot/tree/main/examples) folder of the git repository. The simplest example is in the **minimum** folder.

* Minimum live demo: 
  * https://c0ckp1t.com/examples/minimum
* Repository:
  * https://github.com/c0ckp1t/c0ckp1t-webroot/tree/main/examples/minimum
 
You can copy the `index.html` and the `PageMain.vue` file and serve them from a static file server, the entire framework is delivered through a CDN (except for those two files). You can download any file and serve it locally if you want (or serve all the files locally). The framework should be self-contained and not require any compilation (unless you want to optimize). 

## Configuration

The main entry point is [Global.mjs](https://github.com/c0ckp1t/c0ckp1t-webroot/blob/main/core/Global.mjs) (import name `GlobalStore`). You initialize it with a configuration object, and name of the HTML element where the **C0ckp1t Vue Application** should be mounted.


```html
<body class="main-body">
    <div id="app-default" >
      <app-main></app-main>
    </div>
</body>
```

```html
<script type="module">
import {init as initLogger} from 'Logging'; // specified in importmap
import {api as apiMain} from 'GlobalStore' // specified in importmap
// The component registry helper (framework boilerplate)
import { defaultVueComponents } from 'https://cdn.jsdelivr.net/npm/c0ckp1t@latest/core/ConfigUtils.mjs'

// Configuration is a single, explicit plain object — no factory, no merge.
// This is a complete static website: no islands, no WebSocket code is downloaded.
const CDN = "https://cdn.jsdelivr.net/npm/c0ckp1t@latest"
const config = {
  appName: "My Site",
  appMainComponent: `${CDN}/core/PageMain.vue`,
  frameworkBase: CDN,                      // where core/ and components/ are loaded from
  vueRouterModeIsHash: true,
  defaultLoggerLevels: { "VueUtils.mjs": "INFO" },
  routes: [
    { path: '/', location: '/pages/Home.vue' },     // your pages, served by your static file server
  ],
  components: defaultVueComponents(CDN),
}
initLogger(config)
await apiMain.init("app-default", config)
</script>
```

Need to call a server? Plain HTTP: `await apiMain.http.getJson('/api/status')`. A server with `exec`/`exec2` over HTTP or WebSocket: add `backends` (see [Configuration](./Configuration.md)).

See [Configuration](./Configuration.md) for the full list of options and how to add your own pages. For a complete, commented reference copy [`config.default.mjs`](https://github.com/c0ckp1t/c0ckp1t-webroot/blob/main/config.default.mjs) to `config.mjs` and edit it.