gurusalih / webstack

Go-based hybrid web template with SSR, REST, and gRPC support.

Home Page:https://9ssi7.medium.com/modern-web-development-with-go-a-lightweight-alternative-to-react-ssr-cccce8631773

Repository from Github https://github.comgurusalih/webstackRepository from Github https://github.comgurusalih/webstack

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

About

Go-based hybrid web template with SSR, REST, and gRPC support.

https://9ssi7.medium.com/modern-web-development-with-go-a-lightweight-alternative-to-react-ssr-cccce8631773

License:Apache License 2.0


Languages

Language:Go 41.1%Language:templ 26.2%Language:JavaScript 11.2%Language:Dockerfile 7.9%Language:Makefile 6.2%Language:Vue 2.5%Language:HTML 2.0%Language:TypeScript 1.9%Language:CSS 1.0%