All skills
encoredev avatar

/go-getting-started

@cb69bb1 official
by Encoreencoredev/skills28 stars
5

Bootstrap a brand-new Encore Go project from zero. Only for first-time CLI install and `encore app create` β€” not for architecture or feature questions.

  • 1 file
  • 4 KB
  • Updated 5 months ago
  • GitHub

Use this Skill: https://skilld.dev/gh/encoredev/skills/go-getting-started

This session only. Nothing lands on disk.

SKILL.md

β‰ˆ43 tokens always: the name and description. β‰ˆ839 when used: this file.

Getting Started with Encore Go

Instructions

Install Encore CLI

# macOS
brew install encoredev/tap/encore

# Linux/WSL
curl -L https://encore.dev/install.sh | bash

# Windows (PowerShell)
iwr https://encore.dev/install.ps1 | iex

Create a New App

# Interactive - choose from templates
encore app create my-app

# Or start with a blank Go app
encore app create my-app --example=hello-world

Project Structure

A minimal Encore Go app:

my-app/
β”œβ”€β”€ encore.app           # App configuration
β”œβ”€β”€ go.mod               # Go module
└── hello/               # A service (package with API)
    └── hello.go         # API endpoints

The encore.app File

// encore.app
{
    "id": "my-app"
}

This file marks the root of your Encore app. The id is your app's unique identifier.

Create Your First API

In Encore Go, any package with an //encore:api endpoint becomes a service:

// hello/hello.go
package hello

import "context"

type Response struct {
    Message string `json:"message"`
}

//encore:api public method=GET path=/hello
func Hello(ctx context.Context) (*Response, error) {
    return &Response{Message: "Hello, World!"}, nil
}

Run Your App

# Start the development server
encore run

# Your API is now available at http://localhost:4000

Open the Local Dashboard

# Opens the local development dashboard
encore run
# Then visit http://localhost:9400

The dashboard shows:

  • All your services and endpoints
  • Request/response logs
  • Database queries
  • Traces and spans

Common CLI Commands

Command Description
encore run Start the local development server
encore test Run tests (uses go test under the hood)
encore db shell <db> Open a psql shell to a database
encore gen client Generate API client code
encore app link Link to an existing Encore Cloud app

Add Path Parameters

type GetUserParams struct {
    ID string
}

type User struct {
    ID   string `json:"id"`
    Name string `json:"name"`
}

//encore:api public method=GET path=/users/:id
func GetUser(ctx context.Context, params *GetUserParams) (*User, error) {
    return &User{ID: params.ID, Name: "John"}, nil
}

Add a Database

// db.go
package hello

import "encore.dev/storage/sqldb"

var db = sqldb.NewDatabase("mydb", sqldb.DatabaseConfig{
    Migrations: "./migrations",
})

Create a migration:

-- hello/migrations/1_create_table.up.sql
CREATE TABLE items (
    id SERIAL PRIMARY KEY,
    name TEXT NOT NULL
);

Query the Database

import "encore.dev/storage/sqldb"

type Item struct {
    ID   int
    Name string
}

func getItem(ctx context.Context, id int) (*Item, error) {
    item, err := sqldb.QueryRow[Item](ctx, db, `
        SELECT id, name FROM items WHERE id = $1
    `, id)
    if err != nil {
        return nil, err
    }
    return item, nil
}

Next Steps

  • Add more endpoints (see encore-go-api skill)
  • Add authentication (see encore-go-auth skill)
  • Add Pub/Sub topics (encore-go-pubsub), cron jobs (encore-go-cron), buckets (encore-go-bucket), secrets (encore-go-secret), or caching (encore-go-cache)
  • Deploy to Encore Cloud: encore app link then git push encore

Source: SKILL.md on GitHub

No third-party reports yet.

Signed by skilld at cb69bb1. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 days ago.

Activeupdated 5 months ago
Other metadata
when_to_use
User has no Encore project yet and is asking how to install the Encore CLI, run `encore app create` for a Go app, scaffold a hello-world Go service, or run their very first `encore run`. SKIP if the user already has an Encore Go project and is asking about architecture, services, endpoints, or specific features β€” those go to `encore-go-service`, `encore-go-api`, `encore-go-pubsub`, etc. Trigger phrases: "completely new to Encore", "first time", "install the CLI", "brew install encoredev", "encore app create", "hello world Go", "just starting out".

README badge

README badge for encoredev/skills/go-getting-started

Installs the Encore CLI and scaffolds a new Go project with a hello-world service, database setup, and local dashboard. For developers initializing their first Encore app or running `encore app create` for the first time.

Generated from the current SKILL.md.

What platforms does the Encore CLI install on?
macOS via Homebrew, Linux/WSL via curl, and Windows via PowerShell. Each has a separate installation command.
Do I need to manually create the encore.app file?
No. The `encore app create` command generates it automatically as part of project initialization.
Can I use this skill if I already have an Encore project?
No. This skill is only for first-time CLI install and creating a brand-new app. For existing projects, use skills like `encore-go-service`, `encore-go-api`, or `encore-go-pubsub`.
What is the local dashboard and how do I access it?
The dashboard displays services, endpoints, request logs, database queries, and traces. Access it at http://localhost:9400 when running `encore run`.
Does this skill cover setting up databases?
Yes, it includes basic instructions for creating a database, writing migrations, and querying with `sqldb.QueryRow`. For advanced database topics, refer to other Encore skills.

Generated from the current SKILL.md. These answers refresh after source changes.