#web-apps #site #web #blog #engine

bin+lib huxi-server

基于Axum和PostgreSQL的网站应用引擎

2个版本

0.8.1 2023年7月26日
0.8.0 2023年7月19日

#37#site

MIT/Apache

1MB
9K SLoC

Rust 8K SLoC // 0.0% comments JavaScript 1K SLoC // 0.0% comments SQL 253 SLoC // 0.0% comments

Huxi Server

Huxi Server是一个基于Axum和PostgreSQL的网站应用引擎。

英文文档正在编写中,以下为中文内容。

演示: https://www.huxi.fun

介绍

Huxi(呼吸) Server是用Rust编写的网站系统,主要用于构建网站应用。

已实现功能

  • 用户注册登录
  • 电子邮件验证
  • 博客文章
  • 微博
  • 好书
  • 图片
  • 站内信箱

基本架构

  • Web框架使用 axum
  • 页面模板使用 maud
  • 前端CSS使用 bootstrap
  • 数据库使用 PostgreSQLsqlx
  • 全文检索使用 pg_jieba

安装

准备数据库

  1. 安装 PostgreSQL
  2. 安装 pg_jieba
  3. 新建数据库 www,导入 pgsql/setup.sql,创建表
psql www < pgsql/setup.sql

详细说明见 pgsql/README.md

栏目基本配置

cp examples/config.toml my-config.toml

编辑 my-config.toml,其中SMTP设置用于用户注册。

设置环境变量

示例

export WWW_CONFIG=/home/huxi/has/my-config.toml
export WWW_PORT=3000
export DATABASE_URL=postgres://huxi:12345678@localhost/www

运行

cargo run

打开网址: https://127.0.0.1:3000

管理员

注册用户后,在pgsql中,修改 users.i_role = 5, 例如:

update users set i_role=5 where name='admin';

Nginx https部署

examples/nginx.conf

待办事项

  • 完善栏目管理
  • 完善用户管理
  • 优化页面

联系作者

川月([email protected]

依赖项

~89MB
~1.5M SLoC