rweb_starterkit/README.md
Mahmoud Emad 645a387528 feat: Add basic project structure and configuration
- Add `.env.template` file for environment variable configuration.
- Add `.gitignore` file to ignore generated files and IDE artifacts.
- Add `Cargo.toml` file specifying project dependencies.
- Add basic project documentation in `README.md` and configuration
  guide in `docs/configuration.md`.
- Add Gitea authentication guide in `docs/gitea-auth.md`.
- Add installation guide in `docs/installation.md`.
- Add MVC architecture guide in `docs/mvc.md`.
- Add views guide in `docs/views.md`.
2025-05-07 14:03:08 +03:00

134 lines
4.0 KiB
Markdown

# Hostbasket Starterkit
Welcome to the Hostbasket Starterkit! This guide will help you get started with the Hostbasket project, a comprehensive platform built with Actix Web and Rust.
## Table of Contents
1. [Introduction](#introduction)
2. [Installation](#installation)
3. [Usage](#usage)
4. [Creating Views](#creating-views)
5. [Authentication with Gitea](#authentication-with-gitea)
6. [Documentation](#documentation)
## Introduction
Hostbasket is a web application framework built with Actix Web, a powerful, pragmatic, and extremely fast web framework for Rust. It follows the MVC (Model-View-Controller) architecture and uses Tera templates for rendering views.
### Features
- **Actix Web**: A powerful, pragmatic, and extremely fast web framework for Rust
- **Tera Templates**: A template engine inspired by Jinja2 and Django templates
- **Bootstrap 5.3.5**: A popular CSS framework for responsive web design
- **MVC Architecture**: Clean separation of concerns with Models, Views, and Controllers
- **Middleware Support**: Custom middleware for request timing and security headers
- **Configuration Management**: Flexible configuration system with environment variable support
- **Static File Serving**: Serve CSS, JavaScript, and other static assets
## Installation
### Prerequisites
- Rust and Cargo (latest stable version)
- Git
### Setup
1. Clone the repository:
```bash
git clone https://github.com/yourusername/hostbasket.git
cd hostbasket
```
2. Build the project:
```bash
cargo build
```
3. Run the application:
```bash
cargo run
```
4. Open your browser and navigate to `http://localhost:9999`
For more detailed installation instructions, see [Installation Guide](docs/installation.md).
## Usage
### Basic Usage
Once the application is running, you can access it through your web browser at `http://localhost:9999`. The default configuration provides:
- Home page at `/`
- About page at `/about`
- Contact page at `/contact`
- Login page at `/login`
- Registration page at `/register`
### Configuration
The application can be configured using environment variables or configuration files. The following environment variables are supported:
- `APP__SERVER__HOST`: The host address to bind to (default: 127.0.0.1)
- `APP__SERVER__PORT`: The port to listen on (default: 9999)
- `APP__SERVER__WORKERS`: The number of worker threads (default: number of CPU cores)
- `APP__TEMPLATES__DIR`: The directory containing templates (default: ./src/views)
For more detailed usage instructions, see [Usage Guide](docs/usage.md).
## Creating Views
Hostbasket uses Tera templates for rendering views. Templates are stored in the `src/views` directory.
### Basic Template Structure
```html
{% extends "base.html" %}
{% block title %}Page Title{% endblock %}
{% block content %}
<div class="container">
<h1>Hello, World!</h1>
<p>This is a basic template.</p>
</div>
{% endblock %}
```
### Adding a New Page
1. Create a new template in the `src/views` directory
2. Add a new handler method in the appropriate controller
3. Add a new route in the `src/routes/mod.rs` file
For more detailed information on creating views, see [Views Guide](docs/views.md).
## Authentication with Gitea
Hostbasket supports authentication with Gitea using OAuth. This allows users to log in using their Gitea accounts.
### Setup
1. Register a new OAuth application in your Gitea instance
2. Configure the OAuth credentials in your Hostbasket application
3. Implement the OAuth flow in your application
For more detailed information on Gitea authentication, see [Gitea Authentication Guide](docs/gitea-auth.md).
## Documentation
For more detailed documentation, please refer to the following guides:
- [Installation Guide](docs/installation.md)
- [Usage Guide](docs/usage.md)
- [Views Guide](docs/views.md)
- [MVC Architecture Guide](docs/mvc.md)
- [Gitea Authentication Guide](docs/gitea-auth.md)
- [API Documentation](docs/api.md)
- [Configuration Guide](docs/configuration.md)
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.