Maziko is a full-stack web framework combining the power of Go for backend functionality with modern frontend technologies (React, Vue (coming soon), Svelte (coming soon)), connected through Inertia.js for a seamless single-page application experience.
- Full-Stack Go & Frontend: Develop your entire application with Go for backend code and your choice of frontend technology
- Multiple Frontend Templates: Choose from React, Vue (coming soon), or Svelte (coming soon) templates to start your project
- Single-Page Applications: Uses Inertia.js to provide SPA navigation without API boilerplate
- File-Based Routing: Automatic route generation based on directory structure
- Server-Side Rendering: Built-in SSR support for improved SEO and initial load performance
- Live Reloading: Fast development feedback with live reloading for both Go and frontend code
- CLI Tool: Easy project scaffolding and management with the
mazikocommand-line tool - Vite Building: Fast builds and development server with Vite
- Go >= 1.24.2
- Node.js >= 18
- pnpm >= 10
Install the Maziko CLI globally:
go install github.com/pezanitech/maziko/cli/maziko@latestUse the Maziko CLI to create a new project
# Create a React project
maziko create react -n my-appThen follow the next steps:
cd my-app
pnpm install
pnpm devThe maziko CLI tool provides several commands:
Usage:
maziko [flags]
maziko [command]
Available Commands:
build Build the project
clean Clean build artifacts
completion Generate the autocompletion script for the specified shell
create Create a new Maziko project
dev Start development server
genroutes Generate routes
help Help about any command
install Install dependencies
start Start the production server
Flags:
-h, --help help for maziko
-v, --verbose Enable verbose output (not implemented)
--version version for maziko
project/
βββ app/ # Application code
β βββ global.css # Global CSS imports
β βββ app.jsx # Main frontend entry point
β βββ public/ # Static public assets
β βββ routes/ # Routes (both backend and frontend)
β βββ index/ # Root route
β β βββ handler.go # Go route handler
β β βββ page.tsx # Frontend page for route
β βββ docs/ # Another route example
βββ gen/ # Auto-generated files
βββ build/ # Production build output
βββ ssrBuild/ # SSR build output
βββ tmp/ # Development build output
- Create a new directory in
app/routes/with your route name (e.g.,app/routes/about/) - Add a
handler.gofile with the HTTP methods you need:
package about
import (
"net/http"
"github.com/pezanitech/maziko/libs/core/router"
inertia "github.com/romsar/gonertia"
)
func Route() {
router.GET(func(i *inertia.Inertia, w http.ResponseWriter, r *http.Request) {
router.RenderPage(i, w, r, inertia.Props{
"title": "About Us",
"description": "Learn more about our team",
})
})
}- Create a
page.tsxfile with your frontend component (React example):
import { usePage } from "@inertiajs/react"
export default function Page() {
const { props } = usePage()
return (
<div>
<h1>{props.title}</h1>
<p>{props.description}</p>
</div>
)
}- Run
maziko genroutesto generate the route or restart the development server
maziko buildThis will:
- Build the Vite assets (both client and SSR versions)
- Generate route definitions
- Build the Go binary
maziko startMaziko uses a configuration file (maziko.json) located in your project root:
{
"app": {
"name": "Maziko App",
"url": "http://localhost:3080",
"port": 3080
},
"build": {
"prefix": "/build/",
"dir": "./build",
"tempDir": "./tmp",
"ssrDir": "./ssrBuild"
},
"vite": {
"manifestFile": "./build/.vite/manifest.json",
"hotFile": "tmp/hot",
"detectionAttempts": 5,
"detectionInterval": 2000
},
"paths": {
"routes": "./app/routes",
"public": "./app/public",
"gen": "./gen"
},
"logger": {
"type": "concise",
"level": "debug"
}
}Environment variables can override configuration values:
APP_URL- URL for the applicationLOGGER_TYPE- Logger type (text, json, concise)LOG_LEVEL- Logging level (debug, info, warn, error)
Maziko is organized as an Nx monorepo with the following structure:
maziko/
βββ libs/ # Core libraries
β βββ core/ # Core framework functionality
β βββ maziko/ # CLI tool implementation
βββ templates/ # Project templates
β βββ react/ # React template
β βββ vue/ # Vue template (coming soon)
β βββ svelte/ # Svelte template (coming soon)
βββ package.json # Root package.json
Maziko uses Nx for managing the monorepo and optimizing the build process. Here are some useful Nx commands:
nx run [project]:build- Build a specific projectnx run-many --target=build- Build all projectsnx affected --target=build- Build only affected projectsnx graph- Visualize the project dependenciesnx dev --project=[project]- Start development server for a specific projectnx build --project=[project]- Build a specific project
dev- Start development serverbuild- Build for production (generates routes, builds frontend and backend)start- Start production serverclean- Clean temporary filesreset- Clean everything and reinstall dependenciestest- Run tests (specific to each project)lint- Run linterstidy- Run Go mod tidy
Maziko is built on top of several amazing open-source technologies: