From Development to Production: Best Practices for Staging, Bug Tracking, and Supabase Workflows

 


Managing a modern web application requires a clear workflow that keeps development, testing, and production environments organized and safe. Developers often face questions like: Should I create a separate staging database or use Supabase’s branch feature? Where should I fix bugs I find during testing? How do I keep track of issues efficiently? 

In this post, we’ll break down the best practices for working with Supabase branches, staging environments, and production databases, explain how to handle bugs effectively, and show how tools like GitHub Issues streamline communication between developers and QA teams. 

Whether you’re a solo developer or part of a growing team, understanding these workflows will save time, reduce mistakes, and ensure smoother deployments.


In supabase i am given the option to Create branch. is this the same as a staging version of the database? Should i use this option to Create a branch, or should i create a separate Staging database?
ChatGPT said:

In Supabase, the “Create branch” feature is very similar to a staging version of your database, but with some nuances. Let me break it down clearly:


What “Create Branch” Does

  • Creates a copy of your production database at a specific point in time.

  • You can make schema changes, test queries, or development changes without affecting production.

  • Branches are linked to the main database, so you can later merge changes back.

  • You can also connect your app to this branch for testing without touching production data.


Differences Between Branch and Separate Staging DB

FeatureSupabase BranchSeparate Staging DB
SetupClick “Create branch” in the dashboardSpin up a new Supabase project
DataSnapshot of production dataCould be empty or seeded manually
CostSlightly cheaper than a full new projectFull cost of a new project
MergeCan merge schema changes back to productionManual migration if you want to sync
Use caseTesting schema changes, small QAIndependent environment for larger tests, long-term staging

When to Use Branch

  • You want a short-term staging environment.

  • You need to test schema migrations or queries against real data.

  • You want to quickly iterate without creating a new project.

When to Use a Separate Staging Database

  • You need a long-lived staging environment for QA or feature testing.

  • You want to simulate production with independent data and access rules.

  • You plan to run automated tests without risk of merging or affecting production.


💡 Recommendation:
If you just want a temporary staging for testing schema or queries, use Create Branch. If you need a permanent staging environment with independent access for a team or automated tests, create a separate staging database/project.


If you want, I can also explain how to safely merge schema changes from a branch back to production in Supabase, which is the trickiest part. Do you want me to?

You said:
when i am testing in staging, do i make fixes or changes to code? or do i do that in development?
ChatGPT said:

Here’s the usual workflow broken down clearly:


1. Development Environment

  • Purpose: Writing and testing new features, bug fixes, experiments.

  • Where changes happen:

    • Code: Yes, this is where you actually write and modify your application code.

    • Database: You can use a local database or a dev branch in Supabase to test schema changes.

  • Key idea: This is your “sandbox.” It’s okay to break things here.


2. Staging Environment

  • Purpose: Simulate production to catch issues before deployment.

  • Where changes happen:

    • Code: No major feature development here. You deploy code from your dev branch to staging to test it.

    • Database: You test migrations, queries, and schema changes. You can also test real data interactions safely.

  • Key idea: Think of it as a QA mirror of production. You verify fixes and features here, but you don’t write new code here.


3. Production Environment

  • Purpose: Real users, real data.

  • Where changes happen:

    • Code: Only stable, tested releases from staging/dev go here.

    • Database: Migrations applied carefully after testing in staging.


Rule of thumb:

  • Write and fix code in development.

  • Deploy to staging to test and validate your changes.

  • Only push to production after passing staging tests.


If you want, I can draw a simple diagram showing Dev → Staging → Prod flow with code and database changes. It makes this process super clear. Do you want me to do that?

You said:
if i find bugs, or think of fixes in staging, do i make notes? how do i record bugs and problems? should i just fix them as i find them in development?
ChatGPT said:

Exactly — you don’t fix bugs directly in staging. Staging is just for testing and validation. Here’s a clean workflow for handling bugs you find in staging:


1. Record Bugs / Problems

  • Make notes immediately in a structured way, so nothing gets lost.

  • Tools you can use:

    • Issue trackers: GitHub Issues, Jira, Linear, Trello, or Notion.

    • Bug format to capture:

      • Title: Short summary of the bug

      • Description: Steps to reproduce the bug

      • Environment: Dev, Staging, Browser/OS, database state if relevant

      • Expected vs Actual: What you expected and what actually happened

      • Screenshots / Logs: Any relevant context

  • This becomes your single source of truth for bugs.


2. Move Bugs to Development

  • Create tasks/issues in your dev workflow based on your notes.

  • Assign or prioritize them just like any new feature or improvement.


3. Fix Bugs in Development

  • Work on code or database changes in development, not staging.

  • Test fixes locally or in dev branch until confident they work.


4. Deploy Fixes to Staging

  • After fixing in development, deploy to staging to verify:

    • The bug is fixed.

    • Nothing else is broken (regression testing).


5. Deploy to Production

  • Once staging confirms the fix, push the change to production safely.


💡 Rule of thumb:

Staging = Observe & Test
Development = Fix & Implement


If you want, I can make a simple step-by-step workflow diagram showing Dev → Staging → Prod and bug handling, so you can follow it every time. It’s really handy for teams. Do you want me to make that?

You said:
how doesGitHub Issues works? where do i access it? how does developer in development environment see it?
ChatGPT said:

Here’s a clear overview of GitHub Issues and how it fits into your workflow:


1. What GitHub Issues Is

  • A built-in bug/feature tracker for GitHub repositories.

  • Lets you record bugs, feature requests, tasks, or notes in a structured way.

  • Each “issue” is like a ticket with:

    • Title – short summary of the problem or feature.

    • Description – details, reproduction steps, screenshots, logs.

    • Labels – categorize issues (bug, feature, high priority, etc.).

    • Assignees – assign to a developer.

    • Comments – discussion and updates on the issue.

    • Status / Projects / Milestones – track progress.


2. Where to Access GitHub Issues

  1. Go to your GitHub repository.

  2. Click the “Issues” tab at the top.

  3. From there, you can:

    • Create a new issue

    • View open/closed issues

    • Filter by labels, assignees, or milestones


3. How Developers Use It in Development

  • Developers check the Issues tab to see assigned tasks.

  • They can comment on issues for clarification.

  • Once they fix a bug in their code:

    • They commit the fix in their development branch.

    • Link the commit to the issue using #issue_number in the commit message.

      • Example: git commit -m "Fix login bug #23" → GitHub automatically links it to issue #23.

  • When ready, they close the issue on GitHub after verification.


4. Typical Workflow

  1. Bug found in staging → Create GitHub issue

  2. Developer sees issue → Fix in dev branch

  3. Deploy fix to staging → Verify

  4. Close issue → Deploy to production


💡 Tip: You can also integrate GitHub Issues with Slack, Notion, or project boards so your team sees new bugs immediately.


Comments