An open API service indexing awesome lists of open source software.

https://github.com/ainsleydev/webkit

A webkit framework and SDK for ainsley.dev. WebKit is a tool that transforms a single app.json manifest into production-ready infrastructure and CI/CD pipelines.
https://github.com/ainsleydev/webkit

golang payload svelte-kit webkit

Last synced: 4 months ago
JSON representation

A webkit framework and SDK for ainsley.dev. WebKit is a tool that transforms a single app.json manifest into production-ready infrastructure and CI/CD pipelines.

Awesome Lists containing this project

README

          




WebKit




Infrastructure-as-code framework for full-stack web applications


Documentation ·
Getting Started ·
Examples ·

[![Go Report Card](https://goreportcard.com/badge/github.com/ainsleydev/webkit)](https://goreportcard.com/report/github.com/ainsleydev/webkit)
[![Release](https://img.shields.io/github/v/release/ainsleydev/webkit?color=brightgreen&label=Release)](https://github.com/ainsleydev/webkit/releases)
[![Maintainability](https://api.codeclimate.com/v1/badges/f5912a1dec11b8003850/maintainability)](https://codeclimate.com/github/ainsleydev/webkit/maintainability)
[![Coverage](https://codecov.io/gh/ainsleydev/webkit/branch/main/graph/badge.svg)](https://codecov.io/gh/ainsleydev/webkit)
![Made with Go](https://img.shields.io/badge/Made%20with-Go-00ADD8.svg?logo=go)
[![Go Reference](https://pkg.go.dev/badge/github.com/ainsleydev/webkit.svg)](https://pkg.go.dev/github.com/ainsleydev/webkit)
[![License](https://img.shields.io/github/license/ainsleydev/webkit?color=orange)](https://github.com/ainsleydev/webkit/blob/main/LICENSE)
[![ainsley.dev](https://img.shields.io/badge/-ainsley.dev-black?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAAB3RJTUUH5wEYDzUGL1b35AAABA1JREFUWMPtlttvFVUUxn977ZnZu+W0tLalqRovBAUvQag0xNQbpSIosSSIJC198YknJfHJxDf9A/DBJ0x8MbFACjVqvCASq6FYFLFBvJA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jGbgqbgLcQcqCQ8NL5EUAPuBsRKqz8UVYB+F97QXcSyatSXoWJ8zvB04AFQlkoaBp4HhhaqPR1TdUsLjeVni8TjhVX0odCAkd4AdKeQAHxIwXEb1Odt+Az5IeVQVcTmhgDBWAhtTNl8G9qGAwKfU2N3SnJvi/RFGMjYCD8UFdACNKRsHgZMA6v0j5ZpAlPtNyvqSiJO/AKik60y0ALlUAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIzLTAxLTI0VDE1OjUzOjA2KzAwOjAwm5vntAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMy0wMS0yNFQxNTo1MzowNiswMDowMOrGXwgAAABXelRYdFJhdyBwcm9maWxlIHR5cGUgaXB0YwAAeJzj8gwIcVYoKMpPy8xJ5VIAAyMLLmMLEyMTS5MUAxMgRIA0w2QDI7NUIMvY1MjEzMQcxAfLgEigSi4A6hcRdPJCNZUAAAAASUVORK5CYII=)](https://ainsley.dev)
[![Twitter Handle](https://img.shields.io/twitter/follow/ainsleydev)](https://twitter.com/ainsleydev)

## WebKit

WebKit is a CLI tool that transforms a single `app.json` manifest into production-ready
infrastructure and CI/CD pipelines. It generates Terraform configurations, GitHub Actions workflows,
and project files - all without cluttering your project repository with infrastructure code.

**Key Features:**

- **Single source of truth**: Define apps, resources, and environments in `app.json`
- **Clean repositories**: No `infra/` folder needed - workflows contain everything
- **Infrastructure as code**: Automated Terraform generation with centralized modules
- **Secrets management**: Built-in SOPS/Age encryption with environment-specific decryption
- **CI/CD automation**: GitHub Actions workflows for plans, deploys, and drift detection
- **Developer experience**: Idempotent updates, local testing, and zero-config defaults

> **Note:** For user documentation and guides,
> visit [webkit.ainsley.dev](https://webkit.ainsley.dev)

## Packages

- ![npm](https://img.shields.io/npm/v/@ainsleydev/payload-helper?label=@ainsleydev/payload-helper&logo=npm&style=badge)
- ![npm](https://img.shields.io/npm/v/@ainsleydev/eslint-config?label=@ainsleydev/eslint-config&logo=npm&style=badge)
- ![npm](https://img.shields.io/npm/v/@ainsleydev/prettier-config?label=@ainsleydev/prettier-config&logo=npm&style=badge)

## Installation

**Quick install:**

```bash
curl -sSL https://raw.githubusercontent.com/ainsleydev/webkit/main/bin/install.sh | sh
```

Or download binaries from
the [latest release](https://github.com/ainsleydev/webkit/releases/latest).

**Verify installation:**

```bash
webkit version
```

## Development Setup

Run the following to get setup with `webkit`.

```bash
make setup
```

### Prerequisites

- **Go** 1.23 or higher
- **pnpm** (for task runners and local workflow testing)
- **act** (for testing GitHub Actions locally)
- **age** (for secrets encryption)

### Project Structure

```
webkit/
├── cmd/webkit/ # CLI entry point
├── internal/
│ ├── appdef/ # App manifest parsing and validation
│ ├── cmd/ # CLI command implementations
│ │ ├── cicd/ # GitHub Actions workflow generation
│ │ ├── env/ # Environment variable management
│ │ ├── docs/ # Documentation generation
│ │ ├── files/ # Project file generation
│ │ ├── infra/ # Terraform infrastructure commands
│ │ └── secrets/ # SOPS encryption/decryption
│ ├── infra/ # Terraform wrapper and state management
│ ├── manifest/ # File tracking and manifest source tagging
│ ├── scaffold/ # Template scaffolding system
│ ├── secrets/ # SOPS/Age integration
│ ├── templates/ # Embedded project templates
│ └── util/ # Shared utilities
└── platform/ # Terraform modules (separate infra repository)
├── providers/ # Provider-specific modules (DO, B2, etc.)
└── modules/ # Orchestration modules (apps, resources)
```

### Architecture Overview

**Key Components:**

- **appdef**: Defines the structure of `app.json` and handles unmarshaling with validation
- **scaffold**: Template rendering engine with file tracking and idempotent updates
- **manifest**: Tracks which files are generated and their sources (app/resource/project)
- **secrets**: SOPS integration for encrypting/decrypting environment variables
- **infra**: Terraform wrapper that manages state and tfvars generation

## Local Workflow Testing

You can simulate GitHub Actions workflows locally using [act](https://github.com/nektos/act). `act`
runs from your local computer, whatever files are currently in your working directory, including
any uncommitted changes.

```bash
# Test lint workflow
pnpm act:lint

# Test test workflow
pnpm act:test

# Dry-run release workflow (shows what would run without executing)
pnpm act:release
```

## Releasing

*For maintainers only*

WebKit uses [GoReleaser](https://goreleaser.com/) for automated releases. The release process is
triggered by creating and pushing a git tag.

### Quick Release

Use the interactive tag tool:

```bash
pnpm tag
```

This will guide you through:

1. Choosing between creating or deleting a tag.
2. Selecting the version bump type (`patch`, `minor`, or `major`).
3. Confirming the version.
4. Creating and pushing the tag.

When a tag is pushed, the version will be injected then GitHub Actions automatically triggers the
GoReleaser workflow, builds binaries for each platform and creates a GitHub release with the
binaries attached.

### Semantic Versioning

WebKit follows [Semantic Versioning](https://semver.org/).

- **Patch** (v1.0.1): Bug fixes and minor changes
- **Minor** (v1.1.0): New features, backwards compatible
- **Major** (v2.0.0): Breaking changes

## Publishing npm packages

WebKit uses [Changesets](https://github.com/changesets/changesets) for automated package versioning and publishing. When merging changes to npm packages in the `packages/` directory, create a changeset to document the change and specify the version bump type. See [packages/README.md](packages/README.md) for detailed instructions.

## Copyright

You may not, except with our express written permission, distribute or commercially exploit the
content found within this repository or any written text within this repository. Nor may you
transmit
it or store it in any other website or other form of electronic retrieval system.

Any redistribution or reproduction of part or all of the contents in any form is prohibited other
than the following:

- You may print or download to a local hard disk extracts for your personal and non-commercial use
only.
- You may copy the content to individual third parties for their personal use, but only if you
acknowledge the website
as the source of the material,

## License

Code Copyright 2023 ainsley.dev. Code released under the [BSD-3 Clause](LICENSE).