Skip to content

9ssi7/webstack

Repository files navigation

WebStack

A comprehensive Go-based web application framework that combines server-side rendering, client-side reactivity, and API services (REST/gRPC) in a single cohesive stack.

Features

  • Multi-Protocol Support

    • REST API Server (/api/rest)
    • gRPC Server (/api/rpc)
    • Web Application Server (/api/web)
  • Web Stack

    • Server-Side Rendering with templ
    • Enhanced interactivity with HTMX
    • Lightweight client-side reactivity using Petite Vue (6kb)
  • Embedable Applications

    • Utilize Go's embed feature for serving static assets
    • Support for multiple web applications (e.g., main app, admin panel)

Architecture

graph TD
    A[Main Application] --> B[API Layer]
    B --> C[REST API]
    B --> D[gRPC API]
    B --> E[Web Application]
    
    E --> F[Templates]
    E --> G[Static Assets]
    E --> H[Handlers]
    
    F --> I[templ Engine]
    G --> J[JavaScript/CSS]
    H --> K[HTTP Routes]
    
    subgraph "Embedded Applications"
        L[Admin Panel]
        M[Other Apps...]
    end
    
    A --> L
    A --> M
Loading

Rendering Strategy

graph LR
    A[Web Request] --> B{Route Type}
    B -->|Full Page| C[Server-Side Rendering]
    B -->|Dynamic Update| D[HTMX Request]
    B -->|Client Interaction| E[Petite Vue]
    
    C --> F[templ Templates]
    D --> G[Partial HTML]
    E --> H[Reactive Components]
    
    subgraph "Server-Side"
        F
        G
    end
    
    subgraph "Client-Side"
        H -->|Local State| I[6kb Vue Runtime]
        H -->|User Events| J[DOM Updates]
    end
Loading

Project Structure

webstack/
├── api/
│   ├── rest/    # REST API server
│   ├── rpc/     # gRPC server
│   ├── web/     # Main web application
│   └── admin/   # Admin panel (example additional web app)

Quick Start

  1. Clone the repository

  2. Install dependencies:

    make setup

    This will install both Go and Node.js dependencies.

  3. Build and run:

    # Build the application
    make build
    
    # Run the application
    make run
  4. Development mode:

    # Watch JavaScript changes
    make js-watch
    
    # Run the application
    make run

Documentation

For detailed development instructions and guidelines, see COPILOT-INSTRUCTIONS.md.

License

Apache 2.0