Go to file
2025-05-08 09:51:26 +03:00
docs ... 2025-05-08 08:05:19 +03:00
src ... 2025-05-08 08:05:19 +03:00
.env.sample feat: Add environment configuration and Gitea OAuth 2025-05-07 16:26:58 +03:00
.env.template feat: Add basic project structure and configuration 2025-05-07 14:03:08 +03:00
.gitignore feat: Add basic project structure and configuration 2025-05-07 14:03:08 +03:00
Cargo.toml ... 2025-05-08 09:51:26 +03:00
LICENSE chore: Add MIT License 2025-05-07 14:07:30 +03:00
README.md feat: Add basic project structure and configuration 2025-05-07 14:03:08 +03:00
start_with_gitea.sh ... 2025-05-08 08:05:19 +03:00
start.sh ... 2025-05-08 08:05:19 +03:00

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
  2. Installation
  3. Usage
  4. Creating Views
  5. Authentication with Gitea
  6. 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:

    git clone https://github.com/yourusername/hostbasket.git
    cd hostbasket
    
  2. Build the project:

    cargo build
    
  3. Run the application:

    cargo run
    
  4. 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

  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.

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.

Documentation

For more detailed documentation, please refer to the following guides:

License

This project is licensed under the MIT License - see the LICENSE file for details.