# Actix MVC App A Rust web application built with Actix Web, Tera templates, and Bootstrap 5.3.5, following the MVC (Model-View-Controller) architectural pattern. ## 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 ## Project Structure ``` actix_mvc_app/ ├── Cargo.toml # Project dependencies ├── src/ │ ├── config/ # Configuration management │ ├── controllers/ # Request handlers │ ├── middleware/ # Custom middleware components │ ├── models/ # Data models and business logic │ ├── routes/ # Route definitions │ ├── static/ # Static assets (CSS, JS, images) │ │ ├── css/ # CSS files including Bootstrap │ │ ├── js/ # JavaScript files │ │ └── images/ # Image files │ ├── utils/ # Utility functions │ ├── views/ # Tera templates │ └── main.rs # Application entry point ``` ## Getting Started ### Prerequisites - Rust and Cargo (latest stable version) ### Installation 1. Clone the repository: ``` git clone https://github.com/yourusername/actix_mvc_app.git cd actix_mvc_app ``` 2. Build the project: ``` cargo build ``` 3. Run the application: ``` cargo run ``` 4. Open your browser and navigate to `http://localhost:8080` ## 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: 8080) - `APP__SERVER__WORKERS`: The number of worker threads (default: number of CPU cores) - `APP__TEMPLATES__DIR`: The directory containing templates (default: ./src/views) ## Development ### 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 ### Adding a New Model 1. Create a new model file in the `src/models` directory 2. Add the model to the `src/models/mod.rs` file ## License This project is licensed under the MIT License - see the LICENSE file for details.