- Add .env.example file for environment variable setup - Add .gitignore to manage sensitive files and directories - Add Dockerfile.prod for production-ready Docker image - Add PRODUCTION_CHECKLIST.md for pre/post deployment steps - Add PRODUCTION_DEPLOYMENT.md for deployment instructions - Add STRIPE_SETUP.md for Stripe payment configuration - Add config/default.toml for default configuration settings - Add config/local.toml.example for local configuration template |
||
---|---|---|
.. | ||
.cargo | ||
config | ||
src | ||
static | ||
tests | ||
.env.example | ||
.gitignore | ||
Cargo.lock | ||
Cargo.toml | ||
docker-compose.prod.yml | ||
Dockerfile.prod | ||
PRODUCTION_CHECKLIST.md | ||
PRODUCTION_DEPLOYMENT.md | ||
README.md | ||
STRIPE_SETUP.md |
Zanzibar Digital Freezone
Convenience, Safety and Privacy
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
-
Clone the repository:
git clone https://github.com/yourusername/zanzibar-digital-freezone.git cd zanzibar-digital-freezone
-
Build the project:
cargo build
-
Run the application:
cargo run
-
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
- 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
Adding a New Model
- Create a new model file in the
src/models
directory - 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.