From cc44f06eb7eea5784508bf35cf3d3cf21c8724c9 Mon Sep 17 00:00:00 2001
From: Stephen Akinyemi
Date: Thu, 3 Oct 2024 23:56:02 +0100
Subject: [PATCH] feat: monocore config and project structure (#4)
---
.github/workflows/tests_and_checks.yml | 2 -
Cargo.lock | 613 +++++++++++++++++++++++++
README.md | 3 +-
monocore/Cargo.toml | 21 +
monocore/bin/mono.rs | 7 +
monocore/bin/monod.rs | 7 +
monocore/bin/monoproxy.rs | 7 +
monocore/lib/config/mod.rs | 7 +
monocore/lib/config/monocore.rs | 169 +++++++
monocore/lib/error.rs | 64 +++
monocore/lib/lib.rs | 7 +
monocore/lib/proxy/mod.rs | 9 +
monocore/lib/proxy/server.rs | 8 +
13 files changed, 920 insertions(+), 4 deletions(-)
create mode 100644 monocore/bin/mono.rs
create mode 100644 monocore/bin/monod.rs
create mode 100644 monocore/bin/monoproxy.rs
create mode 100644 monocore/lib/config/mod.rs
create mode 100644 monocore/lib/config/monocore.rs
create mode 100644 monocore/lib/error.rs
create mode 100644 monocore/lib/proxy/mod.rs
create mode 100644 monocore/lib/proxy/server.rs
diff --git a/.github/workflows/tests_and_checks.yml b/.github/workflows/tests_and_checks.yml
index 4937fc9..a363957 100644
--- a/.github/workflows/tests_and_checks.yml
+++ b/.github/workflows/tests_and_checks.yml
@@ -20,8 +20,6 @@ jobs:
rust-toolchain:
- stable
- nightly
- # minimum version
- - "1.75"
steps:
- name: Checkout Repository
uses: actions/checkout@v4
diff --git a/Cargo.lock b/Cargo.lock
index f266a7b..42846fa 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2,6 +2,164 @@
# It is not intended for manual editing.
version = 3
+[[package]]
+name = "aho-corasick"
+version = "1.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "anstream"
+version = "0.6.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526"
+dependencies = [
+ "anstyle",
+ "anstyle-parse",
+ "anstyle-query",
+ "anstyle-wincon",
+ "colorchoice",
+ "is_terminal_polyfill",
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle"
+version = "1.0.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
+
+[[package]]
+name = "anstyle-parse"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb"
+dependencies = [
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle-query"
+version = "1.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a"
+dependencies = [
+ "windows-sys",
+]
+
+[[package]]
+name = "anstyle-wincon"
+version = "3.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8"
+dependencies = [
+ "anstyle",
+ "windows-sys",
+]
+
+[[package]]
+name = "anyhow"
+version = "1.0.89"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6"
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "colorchoice"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0"
+
+[[package]]
+name = "env_filter"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab"
+dependencies = [
+ "log",
+]
+
+[[package]]
+name = "env_logger"
+version = "0.11.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d"
+dependencies = [
+ "anstream",
+ "anstyle",
+ "env_filter",
+ "log",
+]
+
+[[package]]
+name = "equivalent"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
+
+[[package]]
+name = "hashbrown"
+version = "0.15.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb"
+
+[[package]]
+name = "heck"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
+
+[[package]]
+name = "indexmap"
+version = "2.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da"
+dependencies = [
+ "equivalent",
+ "hashbrown",
+]
+
+[[package]]
+name = "is_terminal_polyfill"
+version = "1.70.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
+
+[[package]]
+name = "lazy_static"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
+
+[[package]]
+name = "log"
+version = "0.4.22"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
+
+[[package]]
+name = "matchers"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
+dependencies = [
+ "regex-automata 0.1.10",
+]
+
+[[package]]
+name = "memchr"
+version = "2.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
+
[[package]]
name = "monobase"
version = "0.1.0"
@@ -9,6 +167,15 @@ version = "0.1.0"
[[package]]
name = "monocore"
version = "0.1.0"
+dependencies = [
+ "anyhow",
+ "serde",
+ "structstruck",
+ "test-log",
+ "thiserror",
+ "toml",
+ "typed-builder",
+]
[[package]]
name = "monofs"
@@ -17,3 +184,449 @@ version = "0.1.0"
[[package]]
name = "monovue"
version = "0.1.0"
+
+[[package]]
+name = "nu-ansi-term"
+version = "0.46.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
+dependencies = [
+ "overload",
+ "winapi",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.20.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1"
+dependencies = [
+ "portable-atomic",
+]
+
+[[package]]
+name = "overload"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
+
+[[package]]
+name = "pin-project-lite"
+version = "0.2.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
+
+[[package]]
+name = "portable-atomic"
+version = "1.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2"
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.86"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.37"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "regex"
+version = "1.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-automata 0.4.8",
+ "regex-syntax 0.8.5",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
+dependencies = [
+ "regex-syntax 0.6.29",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.4.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-syntax 0.8.5",
+]
+
+[[package]]
+name = "regex-syntax"
+version = "0.6.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
+
+[[package]]
+name = "regex-syntax"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
+
+[[package]]
+name = "serde"
+version = "1.0.210"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.210"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "serde_spanned"
+version = "0.6.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "sharded-slab"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
+dependencies = [
+ "lazy_static",
+]
+
+[[package]]
+name = "structstruck"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1a052ec87a2d9bdd3a35f85ec6a07a5ac0816e4190b1cbede9d67cccb47ea66d"
+dependencies = [
+ "heck",
+ "proc-macro2",
+ "quote",
+ "venial",
+]
+
+[[package]]
+name = "syn"
+version = "2.0.79"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "test-log"
+version = "0.2.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3dffced63c2b5c7be278154d76b479f9f9920ed34e7574201407f0b14e2bbb93"
+dependencies = [
+ "env_logger",
+ "test-log-macros",
+ "tracing-subscriber",
+]
+
+[[package]]
+name = "test-log-macros"
+version = "0.2.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5999e24eaa32083191ba4e425deb75cdf25efefabe5aaccb7446dd0d4122a3f5"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "thiserror"
+version = "1.0.64"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84"
+dependencies = [
+ "thiserror-impl",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "1.0.64"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "thread_local"
+version = "1.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c"
+dependencies = [
+ "cfg-if",
+ "once_cell",
+]
+
+[[package]]
+name = "toml"
+version = "0.8.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
+dependencies = [
+ "serde",
+ "serde_spanned",
+ "toml_datetime",
+ "toml_edit",
+]
+
+[[package]]
+name = "toml_datetime"
+version = "0.6.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "toml_edit"
+version = "0.22.22"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
+dependencies = [
+ "indexmap",
+ "serde",
+ "serde_spanned",
+ "toml_datetime",
+ "winnow",
+]
+
+[[package]]
+name = "tracing"
+version = "0.1.40"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
+dependencies = [
+ "pin-project-lite",
+ "tracing-core",
+]
+
+[[package]]
+name = "tracing-core"
+version = "0.1.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
+dependencies = [
+ "once_cell",
+ "valuable",
+]
+
+[[package]]
+name = "tracing-log"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
+dependencies = [
+ "log",
+ "once_cell",
+ "tracing-core",
+]
+
+[[package]]
+name = "tracing-subscriber"
+version = "0.3.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b"
+dependencies = [
+ "matchers",
+ "nu-ansi-term",
+ "once_cell",
+ "regex",
+ "sharded-slab",
+ "thread_local",
+ "tracing",
+ "tracing-core",
+ "tracing-log",
+]
+
+[[package]]
+name = "typed-builder"
+version = "0.20.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e14ed59dc8b7b26cacb2a92bad2e8b1f098806063898ab42a3bd121d7d45e75"
+dependencies = [
+ "typed-builder-macro",
+]
+
+[[package]]
+name = "typed-builder-macro"
+version = "0.20.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "560b82d656506509d43abe30e0ba64c56b1953ab3d4fe7ba5902747a7a3cedd5"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
+
+[[package]]
+name = "utf8parse"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
+
+[[package]]
+name = "valuable"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
+
+[[package]]
+name = "venial"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "61584a325b16f97b5b25fcc852eb9550843a251057a5e3e5992d2376f3df4bb2"
+dependencies = [
+ "proc-macro2",
+ "quote",
+]
+
+[[package]]
+name = "winapi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+dependencies = [
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+
+[[package]]
+name = "windows-sys"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+dependencies = [
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+
+[[package]]
+name = "winnow"
+version = "0.6.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b"
+dependencies = [
+ "memchr",
+]
diff --git a/README.md b/README.md
index d38b4c3..9abdcc9 100644
--- a/README.md
+++ b/README.md
@@ -21,9 +21,8 @@
-->
-**`monocore`** is designed to be a distributed, decentralized, and secure personal data and compute cloud.
+**`monocore`** is a self-hosted distributed personal _data and compute cloud_ with serverless capabilities.
-
> [!WARNING]
> This project is in early development and is not yet ready for production use.
diff --git a/monocore/Cargo.toml b/monocore/Cargo.toml
index cfab3b2..aebd98d 100644
--- a/monocore/Cargo.toml
+++ b/monocore/Cargo.toml
@@ -8,4 +8,25 @@ license.workspace = true
name = "monocore"
path = "lib/lib.rs"
+[[bin]]
+name = "mono"
+path = "bin/mono.rs"
+
+[[bin]]
+name = "monoproxy"
+path = "bin/monoproxy.rs"
+
+[[bin]]
+name = "monod"
+path = "bin/monod.rs"
+
[dependencies]
+anyhow.workspace = true
+serde.workspace = true
+structstruck = "0.4.1"
+thiserror.workspace = true
+toml = "0.8.19"
+typed-builder = "0.20.0"
+
+[dev-dependencies]
+test-log = "0.2.16"
diff --git a/monocore/bin/mono.rs b/monocore/bin/mono.rs
new file mode 100644
index 0000000..6903d7b
--- /dev/null
+++ b/monocore/bin/mono.rs
@@ -0,0 +1,7 @@
+//--------------------------------------------------------------------------------------------------
+// Main
+//--------------------------------------------------------------------------------------------------
+
+fn main() {
+ println!("Monocore CLI coming soon!");
+}
diff --git a/monocore/bin/monod.rs b/monocore/bin/monod.rs
new file mode 100644
index 0000000..e773115
--- /dev/null
+++ b/monocore/bin/monod.rs
@@ -0,0 +1,7 @@
+//--------------------------------------------------------------------------------------------------
+// Main
+//--------------------------------------------------------------------------------------------------
+
+fn main() {
+ println!("Monocore Daemon coming soon!");
+}
diff --git a/monocore/bin/monoproxy.rs b/monocore/bin/monoproxy.rs
new file mode 100644
index 0000000..a95be06
--- /dev/null
+++ b/monocore/bin/monoproxy.rs
@@ -0,0 +1,7 @@
+//--------------------------------------------------------------------------------------------------
+// Main
+//--------------------------------------------------------------------------------------------------
+
+fn main() {
+ println!("Monocore Proxy coming soon!");
+}
diff --git a/monocore/lib/config/mod.rs b/monocore/lib/config/mod.rs
new file mode 100644
index 0000000..b3c028b
--- /dev/null
+++ b/monocore/lib/config/mod.rs
@@ -0,0 +1,7 @@
+//! Configuration types and helpers.
+
+//--------------------------------------------------------------------------------------------------
+// Exports
+//--------------------------------------------------------------------------------------------------
+
+pub mod monocore;
diff --git a/monocore/lib/config/monocore.rs b/monocore/lib/config/monocore.rs
new file mode 100644
index 0000000..360727e
--- /dev/null
+++ b/monocore/lib/config/monocore.rs
@@ -0,0 +1,169 @@
+//! Monocore configuration types and helpers.
+
+use serde::{Deserialize, Serialize};
+use structstruck::strike;
+use typed_builder::TypedBuilder;
+
+use crate::error::MonocoreResult;
+
+//--------------------------------------------------------------------------------------------------
+// Types
+//--------------------------------------------------------------------------------------------------
+
+strike! {
+ /// The monocore configuration.
+ #[strikethrough[derive(Debug, Deserialize, Serialize, TypedBuilder)]]
+ pub struct MonocoreConfig {
+ /// The services to run.
+ #[serde(rename = "service")]
+ services: Vec,
+
+ /// The networks to connect to.
+ networks: Vec,
+
+ /// The environment groups to use.
+ env_groups: Vec,
+
+ /// The setup commands to run.
+ setup: Vec,
+
+ /// The command to run.
+ run: String,
+
+ /// The project path.
+ project_path: struct ProjectPath {
+ host: String,
+ container: String,
+ },
+
+ /// The HTTP configuration.
+ http: struct HttpConfig {
+ /// The port to expose.
+ port: struct Port {
+ host: u16,
+ container: u16,
+ },
+
+ /// Whether the service is serverless.
+ serverless: bool,
+
+ /// The URL prefix.
+ url_prefix: String,
+ },
+ }>,
+
+ /// The volumes to mount.
+ #[serde(rename = "volume")]
+ volumes: Vec,
+
+ /// The networks to connect to.
+ #[serde(rename = "network")]
+ networks: Vec,
+
+ /// The environment groups to use.
+ #[serde(rename = "env_group")]
+ env_groups: Vec,
+ }>,
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+// Methods
+//--------------------------------------------------------------------------------------------------
+
+impl MonocoreConfig {
+ /// Validates the configuration.
+ pub fn validate(&self) -> MonocoreResult<()> {
+ Ok(())
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+// Tests
+//--------------------------------------------------------------------------------------------------
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_monocore_config_from_toml_string() -> anyhow::Result<()> {
+ let config = r#"
+ [[service]]
+ name = "server"
+ base = "ubuntu:24.04"
+ volumes = ["main"]
+ networks = ["main"]
+ env_groups = ["main"]
+ setup = [
+ "apt update && apt install -y curl",
+ "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y",
+ ]
+ run = "cargo run --bin monocore"
+ project_path = { host = "monocore", container = "/data/monocore" }
+
+ [service.http]
+ port = { host = 3000, container = 3000 }
+ serverless = true
+ url_prefix = "/api"
+
+ [[volume]]
+ name = "main"
+ path = { host = "/data", container = "/" }
+
+ [[network]]
+ name = "main"
+ ipv6 = true
+
+ [[env_group]]
+ name = "main"
+ envs = [
+ { name = "LOG_LEVEL", value = "info" },
+ { name = "MONO_DATA_DIR", value = "/data" },
+ ]
+ "#;
+
+ let config: MonocoreConfig = toml::from_str(config)?;
+
+ println!("{:?}", config);
+
+ Ok(())
+ }
+}
diff --git a/monocore/lib/error.rs b/monocore/lib/error.rs
new file mode 100644
index 0000000..97efe93
--- /dev/null
+++ b/monocore/lib/error.rs
@@ -0,0 +1,64 @@
+use std::{error::Error, fmt::Display};
+use thiserror::Error;
+
+//--------------------------------------------------------------------------------------------------
+// Types
+//--------------------------------------------------------------------------------------------------
+
+/// The result of a monocore-related operation.
+pub type MonocoreResult = Result;
+
+/// An error that occurred during a file system operation.
+#[derive(Debug, Error, PartialEq)]
+pub enum MonocoreError {
+ /// An error that can represent any error.
+ #[error(transparent)]
+ Custom(#[from] AnyError),
+}
+
+/// An error that can represent any error.
+#[derive(Debug)]
+pub struct AnyError {
+ error: anyhow::Error,
+}
+
+//--------------------------------------------------------------------------------------------------
+// Methods
+//--------------------------------------------------------------------------------------------------
+
+impl MonocoreError {
+ /// Creates a new `Err` result.
+ pub fn custom(error: impl Into) -> MonocoreError {
+ MonocoreError::Custom(AnyError {
+ error: error.into(),
+ })
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+// Functions
+//--------------------------------------------------------------------------------------------------
+
+/// Creates an `Ok` `MonocoreResult`.
+#[allow(non_snake_case)]
+pub fn Ok(value: T) -> MonocoreResult {
+ Result::Ok(value)
+}
+
+//--------------------------------------------------------------------------------------------------
+// Trait Implementations
+//--------------------------------------------------------------------------------------------------
+
+impl PartialEq for AnyError {
+ fn eq(&self, other: &Self) -> bool {
+ self.error.to_string() == other.error.to_string()
+ }
+}
+
+impl Display for AnyError {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(f, "{}", self.error)
+ }
+}
+
+impl Error for AnyError {}
diff --git a/monocore/lib/lib.rs b/monocore/lib/lib.rs
index c7cf3c5..6112436 100644
--- a/monocore/lib/lib.rs
+++ b/monocore/lib/lib.rs
@@ -3,6 +3,13 @@
#![warn(missing_docs)]
#![allow(clippy::module_inception)]
+mod error;
+
//--------------------------------------------------------------------------------------------------
// Exports
//--------------------------------------------------------------------------------------------------
+
+pub mod config;
+pub mod proxy;
+
+pub use error::*;
diff --git a/monocore/lib/proxy/mod.rs b/monocore/lib/proxy/mod.rs
new file mode 100644
index 0000000..fdaf59c
--- /dev/null
+++ b/monocore/lib/proxy/mod.rs
@@ -0,0 +1,9 @@
+//! Proxy types and helpers.
+
+mod server;
+
+//--------------------------------------------------------------------------------------------------
+// Exports
+//--------------------------------------------------------------------------------------------------
+
+pub use server::*;
diff --git a/monocore/lib/proxy/server.rs b/monocore/lib/proxy/server.rs
new file mode 100644
index 0000000..84deb6e
--- /dev/null
+++ b/monocore/lib/proxy/server.rs
@@ -0,0 +1,8 @@
+//! Monocore proxy server types and helpers.
+
+//--------------------------------------------------------------------------------------------------
+// Types
+//--------------------------------------------------------------------------------------------------
+
+/// The monocore proxy server.
+pub struct ProxyServer;