{"id":20425938,"url":"https://github.com/typedduck/website","last_synced_at":"2026-04-11T17:03:25.466Z","repository":{"id":234235894,"uuid":"787080773","full_name":"typedduck/website","owner":"typedduck","description":"This is a simple biased website scaffolding that I use for my projects.","archived":false,"fork":false,"pushed_at":"2024-04-24T07:08:06.000Z","size":5783,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-15T15:19:39.082Z","etag":null,"topics":["askama","axum","cargo-generate","docker","dockerfile","htmx","rust","rust-lang","tailwindcss","template","tokio","web","webapp","webserver","website"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/typedduck.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-15T21:16:56.000Z","updated_at":"2024-04-24T07:08:10.000Z","dependencies_parsed_at":"2024-04-18T16:01:54.634Z","dependency_job_id":"2febefe0-5327-4272-85d7-180b0dff0fbf","html_url":"https://github.com/typedduck/website","commit_stats":null,"previous_names":["typedduck/website"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typedduck%2Fwebsite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typedduck%2Fwebsite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typedduck%2Fwebsite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typedduck%2Fwebsite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/typedduck","download_url":"https://codeload.github.com/typedduck/website/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241967055,"owners_count":20050331,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["askama","axum","cargo-generate","docker","dockerfile","htmx","rust","rust-lang","tailwindcss","template","tokio","web","webapp","webserver","website"],"created_at":"2024-11-15T07:14:46.263Z","updated_at":"2025-12-31T01:03:19.796Z","avatar_url":"https://github.com/typedduck.png","language":"Rust","funding_links":["https://www.patreon.com/typedduck"],"categories":[],"sub_categories":[],"readme":"# Website Scaffolding\n\n![Build Status](https://img.shields.io/github/actions/workflow/status/typedduck/website/rust.yml)\n\nThis is a simple biased website scaffolding that I use for my projects. It uses\nthe following libraries and tools:\n\n- [Axum](https://crates.io/crates/axum) for the web framework.\n- [Askama](https://crates.io/crates/askama) for the template engine.\n- [Htmx](https://htmx.org/) for the client-side interactivity.\n- [Tailwind CSS](https://tailwindcss.com/) for the styling.\n\nIn the assets folder there are predefined fonts which are used in the Tailwind\nCSS configuration. These are:\n\n- [Inter](https://fonts.google.com/specimen/Inter) as the sans-serif font.\n- [Merriweather](https://fonts.google.com/specimen/Merriweather) as the serif\n  font.\n\nThe fonts and scripts are not loaded from a CDN but are included in the project\nitself. This reduces the number of external dependencies and allows for the\nwebsite to be used offline.\n\nThe template `root.html` is the base template for all the pages. It includes all\nthe necessary CSS and JavaScript files and allows for the title and the\ncontent to be overridden.\n\nThe `index.html` is the main page of the website and is the one that is shown\nwhen the website is accessed. It is handled by the `home` function in the\n`handler` module.\n\nThe `404.html` is the page that is shown when a page is not found. The handler\nfor this page is the `not_found` function in the `handler` module. It is\nregistered as the fallback route in the `main` function.\n\nAs of now there is only one template defined in the folder `simple`. In the\nfuture I will add more templates and styles to the project as needed.\n\n## Requirements\n\nThe project requires the following tools to be installed:\n\n- [Rust](https://www.rust-lang.org/) as the programming language.\n- [Cargo](https://doc.rust-lang.org/cargo/) as the package manager.\n- [Cargo-Generate](https://cargo-generate.github.io/cargo-generate/index.html)\n  as the project generator.\n\nThe template additionally requires the following tools to be installed:\n\n- [Node.js](https://nodejs.org/) to compile the Tailwind CSS.\n- [Docker](https://www.docker.com/) if you want to run the server in a container.\n\n## Usage\n\nThis scaffolding can be used as a template for new projects. It can be\ninstalled using the [`cargo generate`](https://cargo-generate.github.io/cargo-generate/index.html)\ncommand. To install the template, use the following command:\n\n```sh\n$ cargo generate --git https://github.com/typpeduck/website.git\n```\n\nThis will create a new folder with the name of the project and will initialize\nit with the parameterized templates. The project can be built using the\nfollowing commands:\n\n```sh\n$ cd project-name\n$ cargo build --release\n```\n\nThe project can be run using the following command:\n\n```sh\n$ cargo run --release\n```\n\nThe server will start and will listen on `http://localhost:8080`.\n\nYou can start implementing your website by modifying the `src/handler.rs` and\n`src/templates` files to suit your needs. You can also modify the `src/main.rs`\nfile to add more routes and handlers. You add or modify the `assets` folder to\ninclude your own fonts and scripts.\n\nThe resulting server can be configured using a configuration file. The\nconfiguration file is a TOML file that contains the following fields:\n\n- `host`: The host on which the server will listen. Default is `0.0.0.0`.\n- `port`: The port on which the server will listen. Default is `8080`.\n- `log`: The log filter directive as defined by the `tracing-subscriber` crate.\n  For more information on the filter directive, see the\n  [documentation](https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html).\n  Default is `error`.\n- `site.title`: The title of the website. There is no default value for this\n  field.\n- `site.language`: The language of the website. Default is `en`.\n- `site.base`: The base URL of the website. This is used to generate the URLs\n  for the pages. There is no default value for this field.\n- `assets`: Is a table that contains an entry for every asset that is used in\n  the website. The keys are the names of the assets and the values are tables\n  with the following fields:\n  - `route`: The route to the assets.\n  - `path`: The path to the assets folder.\n\nConfiguration files can be defined as follows:\n\n```toml\nhost = \"0.0.0.0\"\nport = 8080\nlog = \"info\"\n\n[site]\nlanguage = \"en\"\ntitle = \"My Website\"\nbase = \"http://localhost:8080\"\n\n[[assets]]\nroute = \"/assets\"\npath = \"assets\"\n```\n\nThe configuration file can be passed to the server using the `--config` flag.\nFor example:\n\n```sh\n$ cargo run --release -- --config config.toml\n```\n\nThe server can also be configured using environment variables. The environment\nvariables that can be used are the same as the fields in the configuration file\nbut are prefixed with `WEBSITE_` and are in uppercase. For example:\n\n```sh\n$ WEBSITE_HOST=\"localhost\" WEBSITE_PORT=\"8080\" WEBSITE_LOG=\"info\" cargo run --release\n```\n\nThe prefix is defined as constants in the `lib.rs` file and can be changed\nthere. The constants are:\n\n- `CONFIG_FILE`: The name of the default configuration file. It is set to\n  `website.toml`.\n- `CONFIG_PATHS`: The paths where the configuration file is searched for. It is\n  set to `[\".\"]`.\n- `CONFIG_ENV_PREFIX`: The prefix for the environment variables. It is set to\n  `WEBSITE`. The separator between the prefix and the field is `_`.\n- `CONFIG_ENV_FILE`: The name of the environment variable that contains the\n  path to the configuration file. It is set to `WEBSITE_CONFIG`.\n\n## Docker\n\nThe server can be run in a Docker container. The Dockerfile is defined in the\nrepository and can be built using the following command:\n\n```sh\n$ docker build -t website .\n```\n\nThe server can be run using the following command:\n\n```sh\n$ docker run -p 8080:8080 -it --rm website\n```\n\nThe server can also be run using a configuration file. The configuration file\ncan be mounted to the container using the following command:\n\n```sh\n$ docker run -p 8080:8080 -v $(pwd)/config.toml:/config.toml -it --rm website --config /config.toml\n```\n\nThis will override the default configuration file with the one that is mounted\nto the container.\n\nThe container is built using the `rust:latest` image and the server is compiled\nusing the `--release` flag. This means that the server is optimized for\nperformance and the profile strips the debug information from the binary. The \nbinary is a full self-contained statically linked binary that can be run on any\nsystem that has the same architecture as the one that it was compiled on. The\ncontainer only contains the binary, the assets and the configuration file. This\nmeans that the container is as small as possible and since no external\ndependencies are used, the container provides minimal attack surface.\n\n## License\n\nThis project is licensed under the MIT License or the Apache License 2.0, at\nyour option. For details, see the `LICENSE-MIT` and `LICENSE-APACHE` files for\nmore information.\n\n## Support\n\nIf you like this project and want to support it, you can do so by:\n\n- Giving it a star on GitHub.\n- Sharing it with your friends.\n- Contributing to the project by opening an issue or a pull request.\n- Donating to the project by using the following links:\n  - Bitcoin (Taproot): `bc1pqdck3v3r7sa4mgl0dztfzufa4xg66g8cpcgwvjax9rtx6mlxafdqcgw3g2`\n  - Bitcoin (Segwit): `bc1qet2ypmsxtx6mc03329ft5a736fy906flm4c42a9d3e7mvu872tcs8myzs6`\n  - [Patreon](https://www.patreon.com/typedduck)\n\nPatreon supporters will be listed in the `SUPPORTERS.md` file.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypedduck%2Fwebsite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftypedduck%2Fwebsite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypedduck%2Fwebsite/lists"}