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.
The web server loads a website as a single JSON document, the html contents is built in memory by the server at start, and the website is served without the need of any static html file. It also handles the necessary static files such as images, or additional source code like css or javascript.
Modifications to the website object will be done through the use of a REST API and the web application on client side.
/!\ 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 bedebug
(DEFAULT) orproduction
. -
-d
|--dir
: Any Linux directory path to hold the Krustacea static files. DEFAULT : In adebug
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). Inproduction
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
// example.json
{
"root_page": {
"template_name": "A Custom Template",
"metadata": {
"title": "Hello Krustcea !",
"description": "An example website",
"image": "https://example.com/static/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": [
"/static/images/toto.jpg",
"/static/sounds/toto.mp3",
"/static/video/toto.mp4",
"/static/docs/toto.xcf",
"/static/source_code/toto.js"
]
}