# Krustacea ### *Create, serve and manage websites* ### ------------------------------------------------ |------- Developped by Kuadrado Software ------| ------------------------------------------------ _______ Krustacea is a package that contains a web server written in Rust (Actix based) and a web application to build a static website. _________________ ## **/!\\** WIP ## This package is a work in progress I have just begun. More features and documentation should become visible soon. _______ ## CLI Syntax ``` krustacea [OPTIONS] ``` ### Options - `-c` | `--ctx` : The execution context. Can be `debug` (DEFAULT) or `production`. - `-d` | `--dir` : Any Linux directory path to hold the Krustacea static files. DEFAULT : In a `debug` context, the `$HOME` directory will be used (i.e. a krusteacea directory will be created in the HOME dir and krustacea will use it to store static assets, backups, config files, etc). In `production` context, the `/var` directory will be used. - `--load` [OPTIONAL]: The path to the website to load as a JSON file. If no file is provided, a new website will be created from a blank template. - `-h` | `--host` : The host name. DEFAULT: `localhost`. - `-p` | `--port` : The HTTP port to use. DEFAULT: `8080` - `--ptls` : The TLS port to use. DEFAULT: `8443` - `--certs_dir`: The directory containing the SSL certificates. DEFAULT : `/etc/letsencrypt/live`. (The host name will be joined to this path to find the right certificates) ___________ ## Website data A website data is store as a JSON file with the following structure ```json // example.json { "root_page": { "template_name": "A Custom Template", "metadata": { "title": "Hello Krustcea !", "description": "An example website", "image": "https://example.com/images/ex_pic.png", "css": [], "js": [], "url_slug": "", "lang": "en" }, "body": [ { "tag": "h1", "text": "Example Story" }, { "tag": "p", "text": "Hello,<br />How are you?", "attrs": { "class": "p_class" } }, { "tag": "img", "attrs": { "src": "/img/url.png" } } ], "sub_pages": [] }, "templates": [ { "name": "Custom template", "layout": { "display": "grid" }, "contents": [ { "tag": "div", "attrs": { "id": "custom-template", "class":"page-template" }, "contents": [ { "tag": "nav", "contents": [ { "tag": "ul", "contents": [ { "tag": "li", "text": "menu item 1" }, { "tag": "li", "text": "menu item 2" } ] } ] }, { "tag": "footer", "contents": [] } ] } ] } ], "assets_index": [ "/images/toto.jpg", "/sounds/toto.mp3", "/video/toto.mp4", "/docs/toto.xcf", "/source_code/toto.js" ] } ```