#wiki #back-end #api #wikijump

app deepwell

DEEPWELL - Wikijump API provider and database manager

2 unstable releases

0.7.0 May 21, 2022
0.6.2 May 5, 2022
0.0.9 Jan 27, 2020
0.0.8 Jan 27, 2020
0.0.7 Jan 6, 2020

#413 in HTTP server

Download history 18/week @ 2024-02-18 4/week @ 2024-02-25 57/week @ 2024-03-31

57 downloads per month
Used in deepwell-rpc

AGPL-3.0-or-later

1MB
24K SLoC

DEEPWELL

Build status

DEEPWELL is an experimental backend system to provide core wiki operations via an API for Wikijump. This is intended as an internal API consumed by the web server as part of its logical tasks.

The lint #![forbid(unsafe_code)] is set, and therefore this crate has only safe code.

Available under the terms of the GNU Affero General Public License. See LICENSE.md.

Development

If you have sea-orm-cli, and have a local instance of Wikijump running, you can use the following script to autogenerate SeaORM model files:

$ scripts/generate-models.sh

Structure

The primary organization of the crate is as follows:

  • api/ — Web server definition, such as its routes and related structures.
    • Each API is namespaced based on its version. The primary version of interest is the "internal" API, which is consumed by PHP and not meant for outside consumption due to it providing unguarded access.
  • methods/ — Implementations for individual routes provision above.
  • services/ — "Services", or logical encapsulations of different concepts or operations.
    • For instance, the ParentService allows retrieving and storing data related to parent-child page relationships. You can think of it as "wrapping" the page_parent table.
    • Similarly, the PageService encapsulates the page table, but also wraps all the other operations contained with the logical concept of the "page", such as creating new revisions using the RevisionService as part of the "edit" method.
  • locales/ — Provides localization methods, interpreting the Fluent translation files.
  • models/ — Primarily auto-generated by Sea-ORM, these files allow for interfacing with the database.
  • Other files are utilities, and are generally understandable by looking at their contents..

The routes are defined in api/, with their implementations in methods/, and the structures they rely on in services/<name>/structs.rs. The services invoked to encapsulate logical operations are at services/<name>.rs or services/<name>/service.rs.

Compilation

This executable targets the latest stable Rust. At time of writing, that is 1.61.0.

$ cargo build --release

Testing

Tests have not yet been implemented, but when they are, run:

$ cargo test

Add -- --nocapture to the end if you want to see test output.

Development

$ cargo fmt     # Ensure code is formatted
$ cargo clippy  # Check code for lints

Dependencies

~40–58MB
~1M SLoC