# Vue and Astro (gosfc)

> gosfc runs real Go in Vue components and .astro files, and lets JavaScript import Go packages. Its documentation is at goesm.dev/gosfc.

[gosfc](https://goesm.dev/gosfc.md) connects goesm to Vue and Astro. A Vue component can have a
`<script setup lang="go">`, an `.astro` file a Go frontmatter (`---go`) and a
`<script lang="go">`, and a JavaScript module or an Astro page can import a Go
package with a `go:` specifier. goesm compiles the Go; Vue, Vite and Astro do the rest as
usual.

```vue
<template>
  <div>
    Total: {{ total }}
  </div>
</template>

<script setup lang="go">
import cart "example.com/app/src/features/cart/pkg"

items := []cart.Item{
	{
		Price:    100,
		Quantity: 2,
	},
}

total := cart.Total(items)
</script>
```

This site is built that way: its theme is Vue components whose script is Go
(see [How this site is built](https://goesm.dev/guide/this-site.md)).

> **gosfc documentation**
>
> Setup, the rules of the Go block, Go in `.astro` files, importing Go from
> JavaScript and the benchmark are in the [gosfc documentation](https://goesm.dev/gosfc/guide.md).
