npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

spanwright

v2.6.4

Published

CLI tool to generate Cloud Spanner E2E testing framework projects with Go database tools and Playwright browser automation

Readme

Spanwright

CLI tool for generating Cloud Spanner E2E testing framework projects with Go database tools and Playwright browser automation.

npm version CI Ask DeepWiki

Features

  • Scenario-based Testing - Structured tests with seed data and browser automation
  • Zero Config Setup - Docker Spanner emulator management included
  • Go + Playwright - Database tools with browser testing integration
  • Multi-database Support - Handle 1 or 2 Spanner databases per project

Architecture Overview

Spanwright consists of two main components:

  • Generator (TypeScript CLI) - Interactive project creation tool
  • Template (Complete project scaffold) - Go database tools + Playwright tests + Make workflows

Generated Project Architecture

your-project/
├── cmd/seed-injector/          # Go CLI for database seeding
├── internal/spanwright/        # Go internal packages (config, db, retry)
├── scenarios/                  # Test scenarios with fixtures
├── tests/                      # Test infrastructure
└── Makefile                   # Workflow automation

Tech Stack

Generated projects use:

Configuration Options

Interactive Mode (Default)

npx spanwright my-project
# Interactive prompts guide you through setup

Non-Interactive Mode

# Single database setup
export SPANWRIGHT_DB_COUNT=1
export SPANWRIGHT_PRIMARY_DB_NAME=primary-db
export SPANWRIGHT_PRIMARY_SCHEMA_PATH=./schema
npx spanwright my-project --non-interactive

# Two database setup
export SPANWRIGHT_DB_COUNT=2
export SPANWRIGHT_PRIMARY_DB_NAME=primary-db
export SPANWRIGHT_PRIMARY_SCHEMA_PATH=./schema
export SPANWRIGHT_SECONDARY_DB_NAME=secondary-db
export SPANWRIGHT_SECONDARY_SCHEMA_PATH=./schema2
npx spanwright my-project --non-interactive

Environment Variables Reference

| Variable | Description | Default | |----------|-------------|---------| | SPANWRIGHT_DB_COUNT | Number of databases (1 or 2) | Interactive prompt | | SPANWRIGHT_PRIMARY_DB_NAME | Primary database name | Interactive prompt | | SPANWRIGHT_PRIMARY_SCHEMA_PATH | Path to primary schema | Interactive prompt | | SPANWRIGHT_SECONDARY_DB_NAME | Secondary database name | Interactive prompt | | SPANWRIGHT_SECONDARY_SCHEMA_PATH | Path to secondary schema | Interactive prompt | | SPANWRIGHT_NON_INTERACTIVE | Skip interactive prompts | false |

Usage Examples

Single Database E2E Testing

Perfect for microservices or simple applications:

npx spanwright e-commerce-tests
# Choose: 1 database
# Database name: main-db
# Schema path: ./sql/schema

Multi-Database Testing

Ideal for complex systems with separate read/write databases:

npx spanwright multi-tenant-tests
# Choose: 2 databases
# Primary: main-db (./schema/main)
# Secondary: analytics-db (./schema/analytics)

Test Scenarios

Generated projects include three example scenarios. These are example scenarios to demonstrate the framework structure. You should customize or replace them with scenarios specific to your application's business logic and testing requirements.

Each scenario includes:

  • YAML fixtures - Minimal seed data for testing
  • Expected state files - Database validation definitions
  • Playwright tests - Browser automation with inline SQL validation

Prerequisites

Project Structure

your-project-name/
├── Makefile                    # Workflow automation
├── schema/                     # Database schemas (.sql files)
├── cmd/seed-injector/         # Go data seeding tool
├── scenarios/                  # Test scenarios
├── tests/                      # Test infrastructure
└── playwright.config.ts       # Playwright configuration

Common Commands

# Project setup
make init                       # Initialize project and install dependencies
make start                      # Start Spanner emulator
make setup                      # Setup databases and schemas

# Testing
make test                       # Run complete E2E test workflow
make test-scenario SCENARIO=name  # Run E2E test for a specific scenario

# Utilities
make stop                       # Stop Spanner emulator
make help                       # Show available commands

Troubleshooting

Common Issues

Docker/Emulator Problems

# Check if emulator is running
make start

# Reset emulator state
make stop && make start

Schema Migration Issues

# Verify wrench installation
wrench version

# Check schema files
ls -la schema/

# Manually apply migrations
make setup

Go Build Errors

# Check Go version (requires Go from .tool-versions)
go version

# Clean and rebuild
go mod tidy
go build ./cmd/seed-injector

Environment Issues

  • Node.js version: Requires >= 22.15.1 for CLI
  • Path issues: Ensure schema paths exist and are accessible
  • Permission issues: Check Docker daemon permissions

Development

For Contributors

Setup

git clone https://github.com/nu0ma/spanwright.git
cd spanwright
pnpm install

Development Workflow

# Build and test
pnpm run build
pnpm test  # Runs unit + E2E tests

# Development mode
pnpm run dev  # Watch mode with auto-rebuild

# Code quality
pnpm run lint
pnpm run format

Project Structure

  • src/ - TypeScript CLI generator
  • template/ - Complete project template
  • e2e/ - End-to-end integration tests
  • scripts/ - Build and development utilities

For Template Development

  1. Edit files in template/ directory
  2. Test changes: pnpm run build && pnpm test
  3. Commit only after E2E tests pass

License

MIT License - see LICENSE for details.