# Getting Started

> **Warning:** You are viewing the **Feeds v2** documentation. Feeds v2 is in maintenance mode and no longer receives new features. New projects should use [Feeds v3](https://getstream.io/activity-feeds/docs/go-golang/), a major upgrade in performance, capabilities, and developer experience. To move an existing app, follow the [migration guide](https://getstream.io/activity-feeds/docs/go-golang/v2-to-v3-migration/).

## Learn How Easy It Can Be To Build Scalable Newsfeeds and Activity Streams

Stream has official clients for JS/Node, Ruby, Python, PHP, Go, Java and C#/.NET.

## Setup

Let's get set up! First, install the client as specified below:

```go label="Go"
// install from the command line
go get github.com/GetStream/stream-go2/v8

// import it in your code
import stream "github.com/GetStream/stream-go2/v8"
```

>
> **Info:** All source code can be found on [GitHub](https://github.com/GetStream).
>

To instantiate the client you need an `API key` and `secret` . You can find the key and secret on the [dashboard.](https://getstream.io/signin/?product=feeds) The examples below already include your key and secret.

```go label="Go"
import stream "github.com/GetStream/stream-go2/v8"

client, err := stream.New("{{ api_key }}", "{{ api_secret }}")
if err != nil {
	panic(err)
}
```

If you want to use Stream on your mobile or web application, you need to generate a token server-side that the client can use to authenticate as a user of your application.

### Generate User Token Server-Side

This code generates the token for one of your users; a common place to do this is at signup or login. The token is then passed to the frontend.

```go label="Go"
userToken, err := client.CreateUserToken("the-user-id")
```

### Use Stream API client-side

```js label="JavaScript"
const stream = require("getstream");

// Instantiate new client with a user token
const client = stream.connect(
  "{{ api_key }}",
  "{{ feed_token }}",
  "{{ app_id }}",
);

// OR

import stream from "getstream";

const client = stream.connect(
  "{{ api_key }}",
  "{{ feed_token }}",
  "{{ app_id }}",
);
```

>
> **Info:** More details about authentication can be found in the REST docs
>

### Quick Start

The quick start below shows you how to build a scalable social network. It highlights the most common API calls:

```go label="Go"
chris, err := client.FlatFeed("user", "chris")
	if err != nil {
		panic(err)
	}

	// Add an Activity; message is a custom field - tip: you can add unlimited custom fields!
	_, err = chris.AddActivity(context.TODO(), stream.Activity{
		Actor:   "chris",
		Verb:   "add",
		Object:  "picture:10",
		ForeignID: "picture:10",
		Extra: map[string]any{
			"message": "Beautiful bird!",
		},
	})
	if err != nil {
		panic(err)
	}

	// Create a following relationship between Jack's "timeline" feed and Chris' "user" feed:
	jack, err := client.FlatFeed("timeline", "jack")
	if err != nil {
		panic(err)
	}

	_, err = jack.Follow(context.TODO(), chris)
	if err != nil {
		panic(err)
	}

	// Read Jack's timeline and Chris' post appears in the feed:
	resp, err := jack.GetActivities(context.TODO(), stream.WithActivitiesLimit(10))
	if err != nil {
		panic(err)
	}
	for _, activity := range resp.Results {
		fmt.Println(activity)
	}

	// Remove an Activity by referencing it's foreign_id
	_, err = chris.RemoveActivityByForeignID(context.TODO(), "picture:10")
	if err != nil {
		panic(err)
	}
```

That was a good deal of information at once. The [getting started](https://getstream.io/activity-feeds/tour/) docs provide a more detailed and interactive explanation.

---

For the most recent version of this documentation, visit [https://getstream.io/activity-feeds/docs/go-golang/v2/](https://getstream.io/activity-feeds/docs/go-golang/v2/).