This project is an experiment and toy project built to explore Rust as a web backend using the Actix-web framework. The focus is on learning, and it is not for production-use.
The application allows users to log personal diary entries through a simple Rust backend and a web frontend. It showcases the basic capabilities of Rust for web development, user authentication, and database handling.
Diary/
├── backend/ # Backend codebase (Rust, Actix)
│ ├── src/ # Source code for the backend
│ ├── Cargo.toml # Rust dependencies and project metadata
│ └── .env # Backend environment variables
├── frontend/ # Frontend codebase (JavaScript/TypeScript)
│ ├── src/ # Source code for the frontend
│ ├── package.json # Node.js dependencies and project metadata
│ └── .env # Frontend environment variables
├── .gitignore # Ignored files for Git
└── README.md # Project documentation
- User Authentication: User registration and login functionalities with secure password storage (Argon2 hashing) and basic session management.
- Diary Management: Users can create, edit, delete, and view personal diary entries.
- Date Filtering: Users can filter diary entries by date range.
- Validation: Strong password validation and standard username format validation.
To run this project locally, ensure you have the following installed:
- Rust: You need the latest stable version of Rust for the backend.
- Node.js: Required for running the frontend (Vite-based app).
- SQLite: The backend uses SQLite for database storage.
-
Navigate to the
backend
directory:cd backend
-
Install Rust dependencies:
cargo build
-
Create an
.env
file in thebackend/
directory based on the provided.env
template. Example contents:DATABASE_PATH=./src/self_diary.db
-
Start the backend server:
cargo run
The backend server will start at
http://127.0.0.1:8080
.
-
Navigate to the
frontend
directory:cd frontend
-
Install Node.js dependencies:
npm install
-
Create an
.env
file in thefrontend/
directory based on the provided.env
template. Example contents:VITE_API_BASE_URL=http://127.0.0.1:8080
-
Start the frontend development server:
npm run dev
This will launch the frontend on
http://localhost:3000
.
After running both the backend and frontend servers, navigate to http://localhost:3000
to access the application.
DATABASE_URL
: The path to the SQLite database file.FRONTEND_SERVER_URL
The URL to the frontend server to allow CORS.BACKEND_SERVER_URL
The URL to the backend server to serve the APIs.
VITE_API_BASE_URL
: The base URL for the backend API.
For development, you can format your Rust code using:
cargo fmt
This project is licensed under the MIT License.