Skip to content

Commit

Permalink
chore: restructure documentation (#6)
Browse files Browse the repository at this point in the history
* chore: restructure documentation

* feat: enable github edit links for docs

* chore: update home page

* feat: teaser getting started article
  • Loading branch information
sourcec0de authored Oct 2, 2024
1 parent 806ef0e commit 1410f63
Show file tree
Hide file tree
Showing 48 changed files with 310 additions and 137 deletions.
3 changes: 3 additions & 0 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export default defineConfig({
dark: './src/assets/logo dark.svg',
light: './src/assets/logo light.svg',
},
editLink: {
baseUrl: 'https://github.com/kibu-sh/kibu/edit/main/docs',
},
social: {
github: 'https://github.com/kibu-sh/kibu',
youtube: 'https://www.youtube.com/@kibu-sh',
Expand Down
Binary file removed docs/src/assets/houston.webp
Binary file not shown.
3 changes: 3 additions & 0 deletions docs/src/assets/icon dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/src/assets/icon light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
119 changes: 119 additions & 0 deletions docs/src/content/docs/guides/000 getting started.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
---
title: Getting Started
description: Quickly get started with Kibu
slug: guides/getting-started
sidebar:
order: 0
label: Getting Started
---
import { Steps } from '@astrojs/starlight/components';
import { Aside } from '@astrojs/starlight/components';

<Aside type="tip" title="Kibu is in Alpha">
Discern has been using Kibu since 2022.
We're excited to share this with the community.

Please keep in mind that we are actively porting this code from a closed source repo.
Part of this project is implementing new features that we want for ourselves and are excited to build with the community.

Until we reach a public 1.0 release, these guides may change in backwards incompatible ways.
</Aside>

# I want to skip the tutorial
If you're eager to see the outcome of this tutorial,
jump straight to our [templates' repo](https://github.com/kibu-sh/templates).


# Starting from scratch
<Steps>

1. Start a new go project

```shell
mkdir example
cd example
go mod init example
```

2. Install kibu's base tool chain

```shell
go install github.com/google/wire/cmd/wire@latest
go install github.com/kibu-sh/kibu/internal/toolchain/kibugenv2/cmd/kibugenv2@main
go install github.com/kibu-sh/kibu/internal/toolchain/kibuwire/cmd/kibuwire@main
```

3. Jump start the project structure
```shell
# this will be our code generation entrypoint
touch generate.go

# we need a place to put our first service
mkdir -p src/backend/systems/health/services
touch src/backend/systems/health/health.go
```
</Steps>


## Let's write a simple service interface in Kibu

`src/backend/systems/health/health.go`

```go
package health

import (
"context"
)

type CheckRequest struct {}

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

// Activities stub until bug is fixed
//kibu:activity
type Activities interface{}

// Service checks the health of the entire system
//
//kibu:service
type Service interface {
// Check returns a message letting us know the service is alive
//
//kibu:service:method method=GET
Check(ctx context.Context, req CheckRequest) (res CheckResponse, err error)
}
```

## Now, generate some plumbing

`generate.go`
```go
package generate

// analyze each module and generate system plumbing code
//go:generate kibugenv2 ./...

// execute a second pass to generate wire superset
//go:generate kibuwire ./...
```

```shell
go generate generate.go
```

Two new files have manifested
System plumbing for the interfaces we defined.
`src/backend/systems/health/health.gen.go`

A managed wire superset of all the `//kibu:provider` directives in the system.
At scale, kibu makes managing wire sets a breeze across hundreds of services.
`kibuwire/kibuwire.gen.go`


<Aside type="note" title="Stay Tuned">
We will be pushing updates to these docs and tutorials daily.
Keep up over on our [Discord](https://discord.gg/5sga863FVB) to stay up to date.
</Aside>
33 changes: 33 additions & 0 deletions docs/src/content/docs/guides/001 project structure.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: Project Structure
description: TODO
---
import { FileTree } from '@astrojs/starlight/components';

This is our recommended project structure.
While kibu doesn't enforce this specific structure, we recommend this for long term maintainability.

<FileTree>
- docker-compose.core.yaml
- docker-compose.yaml
- go.mod
- go.sum
- kibu.go
- src/
- backend/
- cmd/
- server/ this is where your main.go lives
- database/
- migrations/
- models/
- queries/
- systems/
- billingv1/
- **billingv1.go** your interfaces go here
- activities/ implementations go in these subdirectories
- services/
- workflows/
- ... many more systems
- gen/
- kibuwire/ kibu generates a wire super set
</FileTree>
48 changes: 0 additions & 48 deletions docs/src/content/docs/guides/001_start.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: FAQ
description: Frequently asked questions
sidebar:
hidden: true
---

Should I ignore generated files?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: Managing Secrets & Configurations
title: Secrets & Configurations
description: TODO
sidebar:
hidden: true
---

# Managing Secrets &amp; Configurations
Expand Down
4 changes: 0 additions & 4 deletions docs/src/content/docs/guides/client-gen.md

This file was deleted.

4 changes: 0 additions & 4 deletions docs/src/content/docs/guides/filewatching.md

This file was deleted.

8 changes: 0 additions & 8 deletions docs/src/content/docs/guides/go-gen.md

This file was deleted.

4 changes: 0 additions & 4 deletions docs/src/content/docs/guides/graphql.md

This file was deleted.

4 changes: 0 additions & 4 deletions docs/src/content/docs/guides/grpc.md

This file was deleted.

4 changes: 0 additions & 4 deletions docs/src/content/docs/guides/middleware.md

This file was deleted.

4 changes: 0 additions & 4 deletions docs/src/content/docs/guides/pub-sub.md

This file was deleted.

4 changes: 0 additions & 4 deletions docs/src/content/docs/guides/testing.md

This file was deleted.

6 changes: 0 additions & 6 deletions docs/src/content/docs/guides/transports.md

This file was deleted.

4 changes: 0 additions & 4 deletions docs/src/content/docs/guides/webhooks.md

This file was deleted.

7 changes: 0 additions & 7 deletions docs/src/content/docs/guides/websockets.md

This file was deleted.

35 changes: 19 additions & 16 deletions docs/src/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,44 @@ hero:
title: |
Welcome to
<span
class="font-black text-transparent
bg-clip-text bg-gradient-to-b
from-accent-700 to-accent-400
dark:from-accent-500 dark:to-accent-200"
class="text-kibu-light"
>
Kibu
Kibu (Alpha)
</span>
tagline: A developer productivity toolkit written in Go powered by Temporal
image:
file: ../../assets/houston.webp
file: ../../assets/icon dark.svg
actions:
- text: Get Started
link: /guides/001_start
link: /guides/getting-started
icon: right-arrow
- text: Check out the source
link: https://github.com/kibu-sh/kibu
icon: external
variant: minimal
---

import { Card, CardGrid } from '@astrojs/starlight/components';
import { Card, CardGrid } from '@astrojs/starlight/components'

## Next steps
## Build with developers in mind

<CardGrid stagger>
<Card title="Update content" icon="pencil">
Edit `src/content/docs/index.mdx` to see this page change.
<Card title="Battle Tested" icon="seti:bicep">
Powerful open source technologies like [Temporal][tmpl], [Postgres][pg], and [Go][go].
Two years of production use at [Discern][disc] before OSS alpha.
</Card>
<Card title="Add new content" icon="add-document">
Add Markdown or MDX files to `src/content/docs` to create new pages.
<Card title="Automate" icon="rocket">
Generate plumbing, live-reloading, stay focused, deploy faster!
</Card>
<Card title="Configure your site" icon="setting">
Edit your `sidebar` and other config in `astro.config.mjs`.
<Card title="Modular" icon="setting">
Use only what you need, or adopt a full stack way of building Go <apps className=""></apps>
</Card>
<Card title="Read the docs" icon="open-book">
Learn more in [the Starlight Docs](https://starlight.astro.build/).
Learn more in [the Kibu Docs](/guides/getting-started).
</Card>
</CardGrid>

[tmpl]: https://temporal.io/
[pg]: https://www.postgresql.org/
[go]: https://go.dev/
[disc]: https://discern.com/
6 changes: 6 additions & 0 deletions docs/src/content/docs/reference/cli/000 kibu dev.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: kibu init
description: TODO
sidebar:
order: 0
---
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
title: Encoding
title: kibu build
description: TODO
---
Loading

0 comments on commit 1410f63

Please sign in to comment.