Skip to content

Arete-Innovations/blast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

66 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’₯ Blast CLI Tool

License Rust

🌟 Overview

Blast is a powerful CLI utility tool for managing Catalyst web applications. It streamlines development workflow with code generation, asset management, and project automation. The Catalyst framework follows a "suckless" philosophy, emphasizing simplicity, modularity, and performance.

πŸ“‹ Features

πŸ”„ Project Management

  • πŸ†• Create new projects with blast new [project_name]
  • 🧩 Scaffold controllers, models, and views
  • πŸ› οΈ Interactive dashboard mode for project management
  • πŸ” Comprehensive configuration management
  • πŸͺ Post-generation hooks for custom scripts and automation

πŸ’Ύ Database Operations

  • πŸ“Š Generate schemas from existing databases
  • πŸ“ Interactive migration creation and management
  • πŸ—οΈ Model generation with consistent CRUD methods
  • πŸ§ͺ Struct generation (NewStruct insertable types)
  • πŸ—„οΈ Database seeding with support for specific seed files

🌐 Frontend Assets

  • πŸ“¦ Asset management with git source repositories and CDN fallbacks
  • 🌍 Locale/internationalization system
  • 🎭 SCSS transpiling with automatic minification
  • πŸ“± Responsive design helpers
  • πŸ“Š Consistent asset organization in css/js/fonts folders
  • 🧩 Simplified importing with .min.css/.min.js convention
  • 🎨 Customizable theming with direct access to Materialize SCSS source

⏱️ Cronjob Management

  • πŸ“Š Interactive TUI for managing scheduled tasks
  • πŸ•’ Status tracking with last and next run times
  • πŸ“ Dedicated logging for cronjob execution
  • πŸ”„ Toggle jobs active/inactive without removing them
  • πŸ“‹ Live table view with auto-refresh

🧰 Development Tools

  • πŸƒβ€β™‚οΈ Development server with multiple run modes
  • πŸ‘€ Watch mode for auto-restarting on code changes
  • πŸ“ Code generation utilities
  • πŸ”Œ Editor integration
  • πŸ”„ Git workflow support
  • πŸ“¦ Cargo dependency management with crates.io search

πŸš€ Installation

# Clone the repository
git clone https://github.com/Arete-Innovations/blast
cd blast

# Install the blast binary
./install_blast.sh

Make sure ~/.local/bin is in your PATH.

Template Repository

Blast uses remote Git repositories for templates instead of embedding them in the binary. When you create a new project, Blast will:

  1. Clone the template from one of the following repositories (with automatic fallback):

  2. Configure the cloned template with your project name

  3. Initialize it as a new Git repository

This approach allows for more flexibility and easier template updates without requiring a new Blast release.

πŸ› οΈ Usage

Creating a New Project

# Create a new project
blast new my_project

# Use development branch (latest features)
blast new my_project --dev

# Change to the project directory
cd my_project

# Initialize project (migrations, seeds, assets, code generation)
blast init

Running the Dashboard

# Start the interactive dashboard (default when run without arguments)
blast

# Explicitly start the dashboard
blast dashboard

# Run the interactive CLI
blast cli

Managing Configuration

# Toggle between development and production
blast env toggle

Code Generation

# Generate a model from database
blast gen models

# Generate structs for models
blast gen structs

# Create a migration
blast migration

# Add a dependency with crates.io search
blast cargo add serde

# Remove dependencies interactively
blast cargo remove

Asset Management

# Transpile SCSS to CSS
blast scss

# Minify CSS files
blast css

# Publish CSS to public directory
blast publish-css

# Process JS files
blast js

# Download assets (git repo cloning for Materialize, CDN for others)
blast cdn

Running Your Application

# Start the development server
blast run
# Or
blast serve

# Start with production settings
blast run-prod
# Or
blast serve-prod

# Stop a running server
blast stop

# Watch mode - auto-restart on code changes
blast watch

Log Management

# Truncate all logs
blast log truncate

# Truncate specific log
blast log truncate server.log

Cronjob Management

# Launch interactive TUI cronjob manager
blast cronjobs

# List all scheduled jobs
blast cronjobs list

# Add a new cronjob (name, interval in seconds)
blast cronjobs add job_name 300

# Toggle a job's active status
blast cronjobs toggle 1

# Remove a scheduled job
blast cronjobs remove 1

# Display live auto-refreshing table
blast cronjobs table

Spark Plugins

Sparks are modular plugins that can be added to your Catalyst application:

# Add a spark plugin from a git repository
blast spark add https://github.com/user/repo

Sparks can also be defined in your Catalyst.toml configuration:

[sparks]
auth = "https://github.com/catalyst-framework/auth"
plznohac = "https://github.com/catalyst-framework/plznohac"

πŸ“ Project Structure

When you create a new Catalyst project with Blast, it follows a clear separation between generated and custom code:

my_project/
β”œβ”€β”€ Cargo.toml              # Rust project dependencies
β”œβ”€β”€ Catalyst.toml           # Framework configuration
β”œβ”€β”€ Rocket.toml             # Web server configuration  
β”œβ”€β”€ diesel.toml             # ORM configuration
β”œβ”€β”€ public/                 # Public web assets
β”‚   β”œβ”€β”€ css/                # Compiled/minified CSS
β”‚   β”‚   └── app/
β”‚   β”œβ”€β”€ fonts/              # Font resources
β”‚   β”‚   β”œβ”€β”€ fontawesome/
β”‚   β”‚   └── material-icons/
β”‚   └── js/                 # Compiled/minified JS
β”‚       β”œβ”€β”€ app/
β”‚       β”œβ”€β”€ htmx/
β”‚       └── materialize/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ assets/             # Frontend source assets
β”‚   β”‚   β”œβ”€β”€ css/            # CSS source files
β”‚   β”‚   β”œβ”€β”€ js/             # JavaScript source files
β”‚   β”‚   β”œβ”€β”€ locale/         # Internationalization JSON files
β”‚   β”‚   β”œβ”€β”€ materialize/    # Materialize SCSS source
β”‚   β”‚   β”‚   └── sass/       # SCSS components
β”‚   β”‚   └── sass/           # SCSS source files
β”‚   β”œβ”€β”€ bootstrap.rs        # Application bootstrapping
β”‚   β”œβ”€β”€ database/           # Database management
β”‚   β”‚   β”œβ”€β”€ db.rs           # Database connection pool
β”‚   β”‚   β”œβ”€β”€ migrations/     # Database migrations
β”‚   β”‚   β”‚   └── ...         # Migration directories with up.sql/down.sql
β”‚   β”‚   β”œβ”€β”€ schema.rs       # Generated DB schema
β”‚   β”‚   └── seeds/          # Database seed files
β”‚   β”œβ”€β”€ lib.rs              # Library entry point
β”‚   β”œβ”€β”€ main.rs             # Application entry point
β”‚   β”œβ”€β”€ middleware/         # Request/response middleware
β”‚   β”‚   β”œβ”€β”€ api_logger.rs   # API request logging
β”‚   β”‚   β”œβ”€β”€ app_context.rs  # Application context
β”‚   β”‚   β”œβ”€β”€ cache.rs        # Response caching
β”‚   β”‚   β”œβ”€β”€ catchers.rs     # Error catchers
β”‚   β”‚   β”œβ”€β”€ compress.rs     # Response compression
β”‚   β”‚   β”œβ”€β”€ guards.rs       # Request guards
β”‚   β”‚   β”œβ”€β”€ htmx.rs         # HTMX integration
β”‚   β”‚   └── jwt.rs          # JWT authentication
β”‚   β”œβ”€β”€ models/             # Database models
β”‚   β”‚   β”œβ”€β”€ auth/           # Authentication models
β”‚   β”‚   β”œβ”€β”€ custom/         # Your custom models (never overwritten)
β”‚   β”‚   └── generated/      # Generated models (can be overwritten)
β”‚   β”œβ”€β”€ routes/             # Route handlers
β”‚   β”‚   β”œβ”€β”€ admin.rs        # Admin routes
β”‚   β”‚   β”œβ”€β”€ api/            # API routes
β”‚   β”‚   β”‚   β”œβ”€β”€ v1.rs       # API version 1
β”‚   β”‚   β”‚   └── ...         # Other API endpoints
β”‚   β”‚   β”œβ”€β”€ home.rs         # Homepage routes
β”‚   β”‚   └── user.rs         # User routes
β”‚   β”œβ”€β”€ services/           # Business logic services
β”‚   β”‚   β”œβ”€β”€ builders/       # Query builders
β”‚   β”‚   β”œβ”€β”€ context/        # Context services
β”‚   β”‚   β”œβ”€β”€ default/        # Default services
β”‚   β”‚   └── sparks/         # Spark plugins
β”‚   β”‚       β”œβ”€β”€ makeuse.rs  # Utility for sparks
β”‚   β”‚       β”œβ”€β”€ plznohac/   # Security spark
β”‚   β”‚       └── vigil/      # Monitoring spark
β”‚   └── structs/            # Data structures
β”‚       β”œβ”€β”€ auth/           # Authentication structs
β”‚       β”œβ”€β”€ custom/         # Your custom structs (never overwritten)
β”‚       └── generated/      # Generated structs (can be overwritten)
β”‚           └── insertable/ # NewStruct types for insertions
β”œβ”€β”€ storage/                # Storage directory
β”‚   β”œβ”€β”€ blast/              # Blast-specific files
β”‚   β”‚   β”œβ”€β”€ blast.log       # Blast tool log
β”‚   β”‚   └── dashboard.kdl   # Dashboard configuration
β”‚   └── logs/               # Application logs
β”‚       β”œβ”€β”€ debug.log       # Debug level logs
β”‚       β”œβ”€β”€ error.log       # Error level logs
β”‚       β”œβ”€β”€ info.log        # Info level logs
β”‚       β”œβ”€β”€ server.log      # Server output log
β”‚       └── warning.log     # Warning level logs
└── templates/              # Tera templates for views
    β”œβ”€β”€ admin/              # Admin area templates
    β”œβ”€β”€ auth/               # Authentication templates
    β”œβ”€β”€ oops/               # Error pages
    β”œβ”€β”€ partials/           # Shared template components
    β”‚   β”œβ”€β”€ footer.tera
    β”‚   β”œβ”€β”€ header.tera
    β”‚   └── navbar.tera
    └── user/               # User area templates

πŸ”„ "Suckless" Philosophy

The Catalyst framework and Blast CLI follow the "suckless" philosophy:

  • Simplicity: Minimalist code with clear purpose
  • Modularity: Small components that do one thing well
  • Pragmatism: Practical solutions over theoretical purity
  • Performance: Lightweight and efficient implementation
  • Mental Model: Consistent patterns throughout the codebase

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“œ License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) - see the LICENSE file for details.

The AGPL-3.0 is a strong copyleft license that requires making the complete source code available to users who interact with the software over a network. This ensures that all modifications and improvements remain free and open source.

About

Tool for managing Catalyst

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages