Skip to content

staging#10

Merged
daveio merged 10 commits intoproductionfrom
staging
Feb 8, 2026
Merged

staging#10
daveio merged 10 commits intoproductionfrom
staging

Conversation

@daveio
Copy link
Member

@daveio daveio commented Feb 8, 2026

  • 🗃️ (db): integrate Drizzle ORM with Cloudflare D1 and setup CI/CD

    • Add Drizzle ORM and Drizzle Kit dependencies and configuration.
    • Define initial database schema for users and generate migrations.
    • Create useDB utility for type-safe database access in server routes.
    • Implement GitHub Actions for staging and production deployments.
    • Update wrangler.jsonc with D1 bindings and environment settings.
    • Expand README with database architecture and migration guides.

    Enable persistent storage and automated deployment pipelines to ensure
    database schema consistency across environments. Using Drizzle with D1
    provides a serverless SQL solution at the edge with a developer-friendly
    migration workflow.

  • 🏷️ (worker-configuration.d.ts): update environment types and formatting
    Add a new StagingEnv interface and update the main Env interface to
    reflect changes in the Cloudflare Worker configuration. Optional
    bindings are now correctly marked as such to improve type safety.

    These changes are necessary to support staging-specific environment
    variables and to accurately represent which bindings are guaranteed to
    be present at runtime. The file has also been reformatted to use
    consistent indentation.

  • 🎨 (worker-configuration.d.ts): reformat with consistent indentation
    Standardize indentation to 2 spaces across the entire file. Improve the
    readability of complex union types and interface definitions by breaking
    them into multiple lines. This ensures the generated type definitions
    align with the project's formatting standards.

  • 🌈 sync

  • 📝 Add AI agent development guide and track context files

    • Create AGENTS.md with project overview, commands, and patterns.
    • Add CLAUDE.md as a reference to the agent guide.
    • Remove AI context files from .gitignore to track them in the repository.

    Provide AI assistants and developers with clear context on the project
    architecture and workflows to improve development efficiency. Tracking
    these files ensures instructions are shared across the team and available
    to AI tools.

  • ⬆️ Upgrade @unhead/vue and enhance TypeScript configuration
    Update @unhead/vue to version 2.1.4 and add @types/node to the project
    dependencies. Modify tsconfig.json to enable strict type checking and
    enforce consistent casing in filenames.

    These changes keep dependencies up to date, provide better type safety
    for Node.js APIs, and enforce stricter coding standards to prevent
    potential runtime errors and cross-platform file naming issues.

  • 📌 Pin dependencies to specific versions
    Replace "latest" version tags with explicit version numbers for all
    dependencies and devDependencies in the lockfile.

    Using "latest" makes builds non-deterministic and prone to breaking when
    upstream packages release updates. Pinning these versions ensures
    environment stability and consistent behavior across different
    installations.

  • 📝 simplify database documentation and rename migration script
    Rename db:migrate:local to db:migrate in package.json and AGENTS.md.
    Remove the extensive database documentation section from README.md.

    The database documentation is removed from the main README to keep the
    file concise and focused on the project overview. The migration script is
    renamed to provide a shorter and more standard command for local
    development.

  • 👷 Consolidate CI workflows and update deployment branches

    • Move staging deployment logic into ci.yaml
    • Update production deployment trigger to use production branch
    • Remove redundant .github/workflows/staging.yaml file
    • Update worker-configuration.d.ts by removing unused types

    Centralizing the CI/CD pipeline into a single file improves
    maintainability and ensures consistent build steps across environments.
    Updating the production branch reference aligns the workflow with the
    project's branching strategy.

daveio added 10 commits February 7, 2026 22:26
- Add Drizzle ORM and Drizzle Kit dependencies and configuration.
- Define initial database schema for users and generate migrations.
- Create `useDB` utility for type-safe database access in server routes.
- Implement GitHub Actions for staging and production deployments.
- Update `wrangler.jsonc` with D1 bindings and environment settings.
- Expand README with database architecture and migration guides.

Enable persistent storage and automated deployment pipelines to ensure
database schema consistency across environments. Using Drizzle with D1
provides a serverless SQL solution at the edge with a developer-friendly
migration workflow.
Add a new `StagingEnv` interface and update the main `Env` interface to
reflect changes in the Cloudflare Worker configuration. Optional
bindings are now correctly marked as such to improve type safety.

These changes are necessary to support staging-specific environment
variables and to accurately represent which bindings are guaranteed to
be present at runtime. The file has also been reformatted to use
consistent indentation.
Standardize indentation to 2 spaces across the entire file. Improve the
readability of complex union types and interface definitions by breaking
them into multiple lines. This ensures the generated type definitions
align with the project's formatting standards.
- Create `AGENTS.md` with project overview, commands, and patterns.
- Add `CLAUDE.md` as a reference to the agent guide.
- Remove AI context files from `.gitignore` to track them in the repository.

Provide AI assistants and developers with clear context on the project
architecture and workflows to improve development efficiency. Tracking
these files ensures instructions are shared across the team and available
to AI tools.
Update @unhead/vue to version 2.1.4 and add @types/node to the project
dependencies. Modify tsconfig.json to enable strict type checking and
enforce consistent casing in filenames.

These changes keep dependencies up to date, provide better type safety
for Node.js APIs, and enforce stricter coding standards to prevent
potential runtime errors and cross-platform file naming issues.
Replace "latest" version tags with explicit version numbers for all
dependencies and devDependencies in the lockfile.

Using "latest" makes builds non-deterministic and prone to breaking when
upstream packages release updates. Pinning these versions ensures
environment stability and consistent behavior across different
installations.
Rename `db:migrate:local` to `db:migrate` in package.json and AGENTS.md.
Remove the extensive database documentation section from README.md.

The database documentation is removed from the main README to keep the
file concise and focused on the project overview. The migration script is
renamed to provide a shorter and more standard command for local
development.
- Move staging deployment logic into `ci.yaml`
- Update production deployment trigger to use `production` branch
- Remove redundant `.github/workflows/staging.yaml` file
- Update `worker-configuration.d.ts` by removing unused types

Centralizing the CI/CD pipeline into a single file improves
maintainability and ensures consistent build steps across environments.
Updating the production branch reference aligns the workflow with the
project's branching strategy.
Copilot AI review requested due to automatic review settings February 8, 2026 20:19
@daveio daveio merged commit b90fcb9 into production Feb 8, 2026
15 of 16 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Integrates Drizzle ORM + D1 into the Nuxt/Cloudflare Workers stack, adds initial schema/migrations, and introduces staging/production deployment automation with environment-specific D1 configuration.

Changes:

  • Add Drizzle ORM/Kit configuration, initial users schema, and generated D1 migrations.
  • Introduce a useDB helper for type-safe access to the Cloudflare D1 binding from Nitro server handlers.
  • Extend Wrangler + CI to support a staging environment and automated migrations/deploys on staging/production branches.

Reviewed changes

Copilot reviewed 16 out of 20 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
wrangler.jsonc Adds migrations_dir and defines env.staging with its own D1 binding.
worker-configuration.d.ts Updates generated Cloudflare environment typing (incl. optional bindings + staging env type).
tsconfig.json Enables strict mode and adds Node types.
server/utils/db.ts Adds useDB(event) helper returning a Drizzle D1 client bound to the Worker DB.
server/database/schema.ts Introduces initial users table schema.
server/database/migrations/** Adds initial SQL migration and Drizzle migration metadata.
server/database/index.ts Re-exports schema module.
package.json Adds Drizzle dependencies and DB tooling scripts (generate/migrate/push/studio).
drizzle.config.ts Adds Drizzle Kit config targeting D1 HTTP driver and env-based credentials.
bun.lock Lockfile updates for new/updated dependencies.
README.md Updates project structure docs to include server/database and server/utils.
PROMPTS.md Adds agent prompt documentation for DB workflows.
AGENTS.md Adds agent/developer workflow guide covering DB and deployment commands.
CLAUDE.md Adds agent guide file (currently duplicates the guide content).
.trunk/trunk.yaml Bumps trufflehog linter version.
.gitignore Stops ignoring AI context files so they can be committed.
.github/workflows/ci.yaml Adds staging + production deploy jobs including migration steps.
.env.example Adds CLOUDFLARE_DATABASE_ID placeholder.
Comments suppressed due to low confidence (1)

CLAUDE.md:3

  • CLAUDE.md currently contains a full copy of the agent guide content rather than just referencing AGENTS.md as described in the PR. Duplicating the same guide in two files will likely drift over time; prefer making CLAUDE.md a short pointer (or a symlink) to AGENTS.md so there’s a single source of truth.
# Agent Guide for Affirm

This document outlines the development workflow, commands, and patterns for working in this codebase.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +52 to +55
deploy-staging:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/staging' && github.event_name == 'push'
steps:
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deploy-staging does not depend on the lint job, so it can deploy even when lint/typecheck/build fails (jobs run in parallel by default). Add needs: lint (and/or gate with if: success()) to prevent deploying broken commits to staging.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant