💎 CRYSTAL Developer’s Diary #2: Prototype - Enter Text (LARS)
January 13
upd: January 13
Contents:
1. Project Structure and Local PC Specifications
Composition:
Structure:
- Leptos v0.8.2.
- Actix Web v4.x.
- Rust v1.92.0.
- ScyllaDB v2025.4.0.
Local PC Specifications:
- OS: Debian 12.
2. Introduction
Enter Text (LARS) is a prototype developed to prepare for the transition of CRYSTAL to a new technological stack — LARS (Leptos, Actix Web, Rust, ScyllaDB).
This prototype allows adding, displaying, updating, and deleting text, demonstrating a full CRUD cycle with the ScyllaDB database.
You can deploy and test this prototype in a Linux-based environment using the instructions below.
3. Key Features
-
3.1. Auto-Schema, Single-Row Architecture, and Constant-id
When launching the application, thedatatable is automatically created (if it does not already exist) to store the entered text. During the saving process, a row is formed in the table consisting of three columns:id(primary key),content(text data), andcreated_at(timestamp). A constantidin theUUID (11111111-1111-1111-1111-111111111111)format is used for the entered text. Instead of creating multiple records, the system uses theINSERToperation as an«upsert»(updating an existing record). Since theidis always the same, any save operation simply overwrites the data in thecontentcolumn for this specific row:Screen 1: Single Row View
-
3.2. Blocking SSR (SsrMode::PartiallyBlocked)
Blocking server-side rendering mode. This ensures that dynamic content from ScyllaDB (and all other text on the site) is "embedded" into the HTML structure directly on the server. As a result, search engine robots receive a fully prepared document, which ensures 100% indexing and high SEO positions:Screen 2: Server-Side Rendered (SSR). View source code in browser (Ctrl+U)
-
3.3. Fine-grained Reactivity
When text is updated, only the specific DOM node containing that text is re-rendered, while the rest of the page remains untouched. This behavior is achieved through Leptos reactive signals. -
3.4. Isomorphic Data Access & Reactive UI
The use ofResource::new_blockingensures seamless state synchronization between the server and the client. It automatically monitors database changes via action versions, allowing the UI to instantly toggle buttons (e.g., switching between "Add" and "Update" or showing the "Delete" button) without a page reload. -
3.5. Asynchronous ScyllaDB Integration
High-performance asynchronous connection viascylla-rust-driver. Thanks to the use of a sharedArc<Session>, the server efficiently distributes resources and can handle thousands of concurrent requests without blocking CPU threads. While the database is preparing a response, the CPU remains free for other tasks, ensuring maximum system responsiveness under extreme loads. -
3.6. SSR Isolation
All database interaction code is protected by#[cfg(feature = "ssr")]macros. This guarantees that database drivers and sensitive logic never leave the server. -
3.7. Informative Server Logging
The system outputs informative operation reports to the console:Screen 3: ScyllaDB readiness log
4. Installation & Setup
Compatibility Note: This project is verified to work on Debian 12. Development on Windows is not recommended, as the installation process for Leptos and ScyllaDB on that system can cause critical errors. A Linux-based environment is required for correct operation.
-
4.1. Environment Preparation (Debian 12 and similar)
Installing system dependencies:
sudo apt update && sudo apt install build-essential pkg-config libssl-dev -y -
4.2. Installing Rust and Leptos Tools
The project is compatible with the Stable version of Rust, which guarantees build predictability.
-
4.2.1. Install Rust (installs the current stable version):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -
4.2.2. Configure environment variables:
source $HOME/.cargo/env -
4.2.3. Add WebAssembly support:
rustup target add wasm32-unknown-unknown -
4.2.4. Install the cargo-leptos build tool:
cargo install --locked cargo-leptos -
4.3. ScyllaDB Installation and Configuration
Installation is performed directly on the Debian 12 system using the official ScyllaDB repository.
-
4.3.1. Update package indexes:
sudo apt-get update -
4.3.2. Install necessary system utilities:
sudo apt-get install -y apt-transport-https curl gnupg -
4.3.3. Add the official ScyllaDB repository to the system:
curl -sSf https://get.scylladb.com/server | sudo bash -
4.3.4. Interactive configuration and ScyllaDB installation:
sudo scylla_setup -
4.3.5. Start the ScyllaDB server service:
sudo systemctl start scylla-server -
4.3.6. Check the status of cluster nodes:
nodetool status
5. Database Preparation
Before the first project launch, you must create a Keyspace in ScyllaDB.
-
Enter the database console:
cqlsh -
And execute the query:
CREATE KEYSPACE IF NOT EXISTS prototype WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
6. Launching the Project
-
6.1. Cloning the project repository:
git clone https://github.com/AndrewShedov/enter-text--LARS && cd enter-text--LARS/main -
6.2. Launch the project:
cargo leptos watch
Once the build is complete, the application will be available at:
http://127.0.0.1:3000
The data table inside the prototype keyspace will be created automatically upon the application's first request to the database, enabled by the built-in Auto-Schema logic.
By default, ScyllaDB is configured to work with the address 127.0.0.1:9042.
You can verify the address by entering the command into the terminal:
-
cqlshAfter entering the command, the address should be displayed:
Connected to at 127.0.0.1:9042
Share
USDT (TRON (TRC20)): TTvJdwtL3VAZKSHbYi8B2eQEQDxbHUD4Ka
POL (Polygon PoS): 0x97377684b9a589eca92e2c6c8430e6dcf2bae8c2
ETH (Base Mainnet): 0x97377684b9a589eca92e2c6c8430e6dcf2bae8c2
ETH (ERC20): 0x97377684b9a589eca92e2c6c8430e6dcf2bae8c2
BTC (BTC): 12GkhJZWrdn23PUerGerN7nSZXHwWGm59U








Comment on