- Add a comprehensive .gitignore to manage project files. - Create the basic project structure including Cargo.toml, LICENSE, and README.md. - Add basic project documentation. |
||
---|---|---|
docs | ||
src | ||
.gitignore | ||
Cargo.toml | ||
LICENSE | ||
README.md | ||
start_with_gitea.sh | ||
start.sh |
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
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
-
Clone the repository:
git clone https://github.com/yourusername/hostbasket.git cd hostbasket
-
Build the project:
cargo build
-
Run the application:
cargo run
-
Open your browser and navigate to
http://localhost:9999
For more detailed installation instructions, see Installation Guide.
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.
Creating Views
Hostbasket uses Tera templates for rendering views. Templates are stored in the src/views
directory.
Basic Template Structure
{% 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
- Create a new template in the
src/views
directory - Add a new handler method in the appropriate controller
- Add a new route in the
src/routes/mod.rs
file
For more detailed information on creating views, see Views Guide.
Authentication with Gitea
Hostbasket supports authentication with Gitea using OAuth. This allows users to log in using their Gitea accounts.
Setup
- Register a new OAuth application in your Gitea instance
- Configure the OAuth credentials in your Hostbasket application
- Implement the OAuth flow in your application
For more detailed information on Gitea authentication, see Gitea Authentication Guide.
Documentation
For more detailed documentation, please refer to the following guides:
- Installation Guide
- Usage Guide
- Views Guide
- MVC Architecture Guide
- Gitea Authentication Guide
- API Documentation
- Configuration Guide
License
This project is licensed under the MIT License - see the LICENSE file for details.