forked from conjured/silverfish
rust-based droplet implementation
- Rust 70.4%
- CSS 14.5%
- TypeScript 8.5%
- HTML 3%
- JavaScript 2.7%
- Other 0.9%
silverfish
new kid on the block
Requirements
Getting Started
- (optional) Copy
config/dev.secret.example.kdltoconfig/dev.secret.kdland edit as desired. just db-setupto create the database and migrate it.just devto start the server/watcher with all frontend stuff installed and built.- Visit https://localhost:4000 or wherever you configured your dev server to listen.
See Justfile for other tasks to run.
Architecture
config- configuration files. Per-environment. You can change environments with the--config-envoption. Configurations are layered between config file -> environment variables (prefixed withSF_CONFIG_) -> CLI options. Config files use KDL. Some editors still only support v1, but we use v2.crates/silverfish-config- crate for handling configuration layering stuff.migrations- database migrations. These are statically compiled into the binary.src- Rust source (including backend-rendered views)commands- CLI commandsweb- Classic MVC style.controllers- Route handlers.templates- HTML templates for the site.components- reusable/includable components.layouts- toplevel layouts used by other templates.
views- Rust side of templates, usingaskama. Statically compiled and verified.router- All routes are defined here for the entire site, nested as needed.state- App state.
workers- Unused for now. Will be whereapalisworkers live.db.rs- Database pool stuff.error.rs- Big honking error enum. Eventually, all errors we?should go in here and we should stop usingmiette::Reportoutside ofmain.rs.lib.rs- Config flags and init logic are all set up here, including config loading, overall logging, and cli/subcommand setup.main.rs- Tiny busybody.
src-frontend- JS/CSS stuff goes here. Uses TypeScript + esbuild and is all set up. TypeScript/JavaScript should be kept to an absolute minimum.static- Static frontend files.src-frontendfiles get compiled into a.gitignoredstatic/assetsdir.Justfile- Task runner.