Skip to content

Quick Start

Build a simple Core application in 5 minutes.

Create Project

mkdir myapp && cd myapp
go mod init myapp

Install Dependencies

go get github.com/Snider/Core@latest
go get github.com/wailsapp/wails/v3@latest

Create Main File

Create main.go:

package main

import (
    "context"
    "embed"
    "log"

    "github.com/Snider/Core/pkg/core"
    "github.com/Snider/Core/pkg/display"
    "github.com/wailsapp/wails/v3/pkg/application"
)

//go:embed all:frontend/dist
var assets embed.FS

func main() {
    // Initialize Core with display service
    c, err := core.New(
        core.WithAssets(assets),
        core.WithService(display.NewService),
    )
    if err != nil {
        log.Fatal(err)
    }

    // Get display service for window creation
    displaySvc := core.MustServiceFor[*display.Service](c, "display")

    // Create Wails application
    app := application.New(application.Options{
        Name: "My App",
        Assets: application.AssetOptions{
            FS: assets,
        },
    })

    // Create main window
    app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
        Title:  "My App",
        Width:  1200,
        Height: 800,
        URL:    "/",
    })

    // Register display service with Wails
    app.RegisterService(displaySvc)

    // Run application
    if err := app.Run(); err != nil {
        log.Fatal(err)
    }
}

Create Frontend

Create a minimal frontend:

mkdir -p frontend/dist

Create frontend/dist/index.html:

<!DOCTYPE html>
<html>
<head>
    <title>My App</title>
    <style>
        body {
            font-family: system-ui, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background: #1a1a2e;
            color: #eee;
        }
    </style>
</head>
<body>
    <h1>Hello from Core!</h1>
</body>
</html>

Run Development Mode

wails3 dev

Build for Production

wails3 build

Next Steps