1. Context and scale
This blueprint is for a solo developer building a small task-tracking web application. It has a browser UI, a JSON API, and persistent task data. The production workload is modest; the hard problem is not throughput. It is making small changes often without turning every release into a manual checklist.
The SDLC is part of the architecture. The developer works in short-lived branches, merges to main through pull requests, and deploys production from the tested commit on main. Each pull request can get a temporary Cloud Run preview URL. CI tests the same container image that will be deployed, while preview environments use isolated test data rather than production credentials or records.
The chosen stack is TypeScript on Node.js, PostgreSQL, GitHub Actions, Terraform, and Google Cloud. The application is a single container, not a collection of services. Cloud Run provides the HTTP runtime; Cloud SQL for PostgreSQL stores production data. A Cloud SQL database dedicated to previews keeps preview data separate from production. Preview rows are scoped to a generated workspace identifier, and preview credentials cannot connect to the production database.
A solo developer benefits from reducing the number of decisions made during release. Keep one mainline, one production region, one deployable application, and a small number of automated gates. Use feature flags for work that cannot be completed in one merge, not as a reason to maintain long-lived branches.
| Assumption | Small-scale value |
|---|---|
| Users | 300 daily active users |
| Requests/s | 2 average, 15 short peak |
| Data volume | 5 GB initially; under 50 GB in year one |
| Team size | 1 developer |
| Budget | $100–$180/month before domain and tax |
These are planning assumptions, not capacity guarantees or provider quotes. The estimate varies by region, uptime needs, traffic, and Cloud SQL sizing.
The operating principle is: merge small, reversible changes to main; make CI prove the change is safe enough to deploy. A preview is a fast feedback environment, not a second production system.
2. Requirements
Functional requirements define what the app does. The non-functional requirements define what makes its solo-developer release process sustainable.
| Functional requirement | Acceptance condition |
|---|---|
| Create, list, update, and complete tasks | API tests cover valid requests and expected error responses |
| Store production tasks durably | Production data is stored in Cloud SQL PostgreSQL |
| Review a change in a browser | An open pull request receives a temporary HTTPS preview URL |
| Ship from the main branch | A successful CI run on main deploys the tested image to production |
| Remove stale previews | Closing or merging a pull request triggers preview cleanup |
| Non-functional requirement | Target or constraint |
|---|---|
| Release effort | No manual server login or manual artifact copying |
| Change risk | A failed test, image scan, or migration check blocks deployment |
| Preview isolation | Preview runtime has no production database credentials |
| Availability | 99.5% monthly API availability as an initial, measured SLO |
| Recovery | Daily database backups; target RPO of 24 hours and RTO of one business day |
| Cost | Prefer scale-to-zero application compute and a small managed database |
| Operability | One dashboard, actionable alerts, structured logs, trace correlation |
| Security | Short-lived CI cloud credentials through GitHub OIDC; no long-lived cloud key in GitHub |
The SLO is intentionally moderate. A solo developer should not promise enterprise availability without the operational capacity to deliver it. As real usage and customer expectations become clearer, raise the SLO together with the budget and recovery capability.
3. High-level design
A pull request is the unit of review and preview. CI runs before a preview is deployed; a successful merge to main promotes the same container image to production. Terraform owns stable infrastructure. GitHub Actions owns build, test, and deployment orchestration.
flowchart LR Dev["Developer"] --> Repo["GitHub repository"] Repo --> CI["GitHub Actions CI"] CI --> Tests["Unit and integration tests"] CI --> Registry["Artifact Registry"] Repo --> PR["Pull request"] PR --> Preview["Cloud Run preview service"] Preview --> PreviewDB["Cloud SQL preview database"] Repo --> Main["main branch"] Main --> Release["GitHub Actions release"] Release --> Registry Registry --> Prod["Cloud Run production service"] Prod --> ProdDB["Cloud SQL production database"] Prod --> Logs["Cloud Logging and Monitoring"]
Caption: Pull requests create isolated review targets; only main can update the production service.
There are three important boundaries:
- Source boundary: GitHub branches and pull requests are the change-control surface.
mainis protected, and production deploy permissions are limited to the trusted release workflow. - Artifact boundary: CI builds one immutable image and tags it with the commit SHA. Production deploys that image rather than rebuilding from a moving branch.
- Data boundary: Production and preview use separate databases and separate database credentials. A preview deployment must not receive a production connection string.
Keep the preview system deliberately smaller than production. It needs enough fidelity to review behavior, but it does not need production data, production capacity, or a custom domain. A preview database can be a separate database on the same small Cloud SQL instance, with generated workspace IDs and short retention. For untrusted fork pull requests, do not expose deployment credentials or create cloud resources; run tests only.
The deployment is automated, but not every change should be automatically enabled for users. A feature flag can merge incomplete but harmless code behind a default-off path. Use flags with an owner and a removal condition; otherwise they become permanent configuration.
4. Cloud service mapping
Google Cloud is the selected provider. GitHub remains the source-control and CI platform. The alternatives below are equivalent roles, not claims that the products have identical behavior.
| Component | Google Cloud choice | AWS equivalent | Azure equivalent |
|---|---|---|---|
| Container runtime | Cloud Run | AWS App Runner or ECS on Fargate | Azure Container Apps |
| Container registry | Artifact Registry | Amazon ECR | Azure Container Registry |
| Managed PostgreSQL | Cloud SQL for PostgreSQL | Amazon RDS for PostgreSQL | Azure Database for PostgreSQL |
| Logs and metrics | Cloud Logging and Cloud Monitoring | Amazon CloudWatch | Azure Monitor |
| Secret storage | Secret Manager | AWS Secrets Manager | Azure Key Vault |
| Infrastructure as code | Terraform | Terraform or AWS CDK | Terraform or Bicep |
| Source control and CI | GitHub and GitHub Actions | GitHub and GitHub Actions | GitHub and GitHub Actions |
| CI cloud authentication | Workload Identity Federation | GitHub OIDC with IAM roles | GitHub OIDC with federated credentials |
Cloud Run is a good fit for this scale because it runs a container without requiring a developer to maintain a VM or cluster. Configure production minimum instances according to the latency and budget trade-off; start at zero if cold-start latency is acceptable. Cloud SQL is the main fixed cost, so avoid adding a cache, queue, or extra database until measurements or requirements justify them.
Official documentation: Cloud Run, Cloud SQL for PostgreSQL, Workload Identity Federation, and GitHub Actions.
5. Data design
The production data model is intentionally small. A user owns tasks; a task has a status and timestamps. Preview rows carry a workspace identifier so test data can be deleted without touching production records. Production tables use a fixed production workspace context, while preview deployments receive a generated context value.
erDiagram
USER ||--o{ TASK : owns
USER {
uuid id PK
text email UK
timestamptz created_at
}
TASK {
uuid id PK
uuid user_id FK
text title
text status
text workspace_id
timestamptz created_at
timestamptz updated_at
}Caption: A small relational model is sufficient; workspace scoping supports cleanup and preview isolation.
CREATE TABLE app_user (
id uuid PRIMARY KEY,
email text NOT NULL UNIQUE,
created_at timestamptz NOT NULL DEFAULT now()
);
CREATE TABLE task (
id uuid PRIMARY KEY,
user_id uuid NOT NULL REFERENCES app_user(id) ON DELETE CASCADE,
workspace_id text NOT NULL,
title text NOT NULL CHECK (length(title) BETWEEN 1 AND 240),
status text NOT NULL CHECK (status IN ('open', 'done')),
created_at timestamptz NOT NULL DEFAULT now(),
updated_at timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX task_workspace_user_updated
ON task (workspace_id, user_id, updated_at DESC);
Use versioned migrations committed with the application. A migration is a reviewed code change, not a side effect performed by an application instance at startup. Production migrations run once in the release workflow before the new app version receives traffic. For a schema change that cannot be applied while old and new app versions coexist, use an expand-and-contract sequence: add a compatible column, deploy code that supports both shapes, backfill if needed, then remove obsolete structure in a later release.
Do not copy production data into previews. Seed preview databases with synthetic tasks, and keep their credentials separate. Even with database separation, include workspace scoping in repository queries so preview cleanup is precise and accidental data accumulation is bounded.
6. Low-level design
The application has a small number of layers: HTTP routes validate requests, a task service applies application rules, and a repository owns SQL access. This is not a mandate for a large “clean architecture” project layout. The boundary exists to make domain behavior testable and database access replaceable in tests.
classDiagram
class TaskRoute {
+createTask(request)
+listTasks(request)
}
class TaskService {
+create(ownerId, workspaceId, title)
+list(ownerId, workspaceId)
}
class TaskRepository {
+insert(task)
+findByOwner(ownerId, workspaceId)
}
class PgTaskRepository {
+insert(task)
+findByOwner(ownerId, workspaceId)
}
class Task {
+id
+title
+status
}
TaskRoute --> TaskService
TaskService --> TaskRepository
PgTaskRepository ..|> TaskRepository
TaskService --> TaskCaption: Keep HTTP concerns out of the service and keep SQL details behind the repository contract.
Minimal runnable example: a feature flag allows an incomplete UI path to merge safely while it is disabled.
const flags = {
bulkComplete: process.env.FEATURE_BULK_COMPLETE === "true",
};
export function canBulkComplete(): boolean {
return flags.bulkComplete;
}
if (canBulkComplete()) {
console.log("Bulk completion is enabled");
} else {
console.log("Bulk completion is disabled");
}
Run with FEATURE_BULK_COMPLETE=true node after compiling, or leave it unset to use the safe default. Notice that the default is off; a flag should not accidentally expose unfinished behavior.
A realistic route example validates input, delegates behavior, and returns an explicit response. The service can be tested without an HTTP server; the route can be exercised with an integration test.
import express from "express";
import { randomUUID } from "node:crypto";
type Task = {
id: string;
userId: string;
workspaceId: string;
title: string;
status: "open" | "done";
};
interface TaskRepository {
insert(task: Task): Promise<void>;
findByOwner(userId: string, workspaceId: string): Promise<Task[]>;
}
export function createApp(repository: TaskRepository) {
const app = express();
app.use(express.json());
app.post("/api/tasks", async (req, res, next) => {
try {
const title = req.body?.title;
if (typeof title !== "string" || title.trim().length === 0 || title.length > 240) {
return res.status(400).json({ error: "title must contain 1 to 240 characters" });
}
const task: Task = {
id: randomUUID(),
userId: req.header("x-user-id") ?? "local-user",
workspaceId: process.env.WORKSPACE_ID ?? "production",
title: title.trim(),
status: "open",
};
await repository.insert(task);
return res.status(201).json(task);
} catch (error) {
next(error);
}
});
app.get("/api/tasks", async (req, res, next) => {
try {
const userId = req.header("x-user-id") ?? "local-user";
const workspaceId = process.env.WORKSPACE_ID ?? "production";
return res.json(await repository.findByOwner(userId, workspaceId));
} catch (error) {
next(error);
}
});
return app;
}
Notice that the workspace is runtime configuration and the repository receives it explicitly. In production, authentication middleware must establish the user identity; the example header is only a local-development placeholder, not an authentication design.
7. Key flows
The first flow is the routine pull-request path. CI tests every contribution. Only trusted pull requests can deploy previews, and closing the pull request removes the temporary service and its preview data.
sequenceDiagram actor Developer participant GitHub participant Actions participant Registry participant CloudRun participant CloudSQL Developer->>GitHub: Open pull request GitHub->>Actions: Start CI Actions->>Actions: Lint, test, build image Actions->>Registry: Push SHA-tagged image Actions->>CloudSQL: Create isolated preview data Actions->>CloudRun: Deploy preview service CloudRun->>CloudSQL: Connect with preview credentials Actions-->>Developer: Publish preview URL Developer->>GitHub: Merge pull request
Caption: The preview is produced from the tested commit and does not receive production database access.
The second flow is a release from main. Deploy the image built for the merged commit, apply only backward-compatible migrations, then verify the service. If the new version fails health checks, roll back to the previous image. Database rollback is not assumed to be safe; migrations should be designed so application rollback remains possible.
sequenceDiagram
participant GitHub
participant Actions
participant Registry
participant CloudSQL
participant CloudRun
participant Monitor
GitHub->>Actions: Successful merge to main
Actions->>Registry: Resolve image by commit SHA
Actions->>CloudSQL: Run compatible migration
Actions->>CloudRun: Deploy image
CloudRun->>Monitor: Emit logs and metrics
Monitor-->>Actions: Health check result
alt Health check fails
Actions->>CloudRun: Restore previous image
else Health check passes
Actions-->>GitHub: Mark deployment successful
endCaption: Release automation verifies the deployed application, while schema changes remain compatible with rollback.
8. Build and release
The repository should make the normal path obvious: npm ci, lint, type-check, unit tests, integration tests, then build. Pin action versions to reviewed commit SHAs in a production repository; major-version tags are easier to read but are mutable references. Require pull requests for main, require the CI status check, and prevent direct pushes.
A small Terraform fragment defines the stable runtime and database boundary. The production service account should have only the permissions it needs; secret access is granted separately. Variables and project-specific IAM bindings are omitted from this fragment, but the resource types are standard Terraform Google provider resources.
resource "google_artifact_registry_repository" "app" {
location = var.region
repository_id = "task-app"
format = "DOCKER"
}
resource "google_sql_database_instance" "postgres" {
name = "task-postgres"
region = var.region
database_version = "POSTGRES_17"
settings {
tier = "db-f1-micro"
availability_type = "ZONAL"
backup_configuration {
enabled = true
point_in_time_recovery_enabled = true
}
}
deletion_protection = true
}
resource "google_sql_database" "production" {
name = "task_app"
instance = google_sql_database_instance.postgres.name
}
resource "google_sql_database" "preview" {
name = "task_preview"
instance = google_sql_database_instance.postgres.name
}
resource "google_cloud_run_v2_service" "production" {
name = "task-app"
location = var.region
template {
service_account = google_service_account.runtime.email
containers {
image = var.image
ports {
container_port = 8080
}
env {
name = "APP_ENV"
value = "production"
}
}
}
deletion_protection = true
}
db-f1-micro is a sizing example, not a recommendation for every region or production workload. Confirm current availability, memory needs, and provider pricing before adopting it. Add Secret Manager references for database credentials, a dedicated preview service account, and IAM bindings in the complete configuration. Do not put passwords in Terraform variables stored in source control.
The workflow below shows the release shape. The repository scripts encapsulate database migration and preview lifecycle operations; they must validate pull-request identity, use separate preview credentials, and never accept a production database name from untrusted input. Configure Workload Identity Federation and repository-level environment protection rather than storing a service-account key.
name: delivery
on:
pull_request:
types: [opened, synchronize, reopened, closed]
push:
branches: [main]
permissions:
contents: read
id-token: write
jobs:
verify:
if: github.event.action != 'closed'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- run: npm ci
- run: npm run lint
- run: npm run typecheck
- run: npm test -- --run
- run: npm run test:integration
- run: npm run build
- run: docker build -t task-app:${{ github.sha }} .
- run: docker run --rm task-app:${{ github.sha }} npm run test:smoke
preview:
needs: verify
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
environment: preview
steps:
- uses: actions/checkout@v4
- uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ vars.GCP_WIF_PROVIDER }}
service_account: ${{ vars.PREVIEW_DEPLOYER }}
- uses: google-github-actions/setup-gcloud@v2
- run: gcloud run deploy task-pr-${{ github.event.pull_request.number }} --image ${{ vars.REGION }}-docker.pkg.dev/${{ vars.PROJECT_ID }}/task-app/task-app:${{ github.sha }} --region ${{ vars.REGION }} --project ${{ vars.PROJECT_ID }} --allow-unauthenticated
- run: npm run preview:configure -- --pr ${{ github.event.pull_request.number }}
- run: echo "Preview deployment completed for PR ${{ github.event.pull_request.number }}"
release:
needs: verify
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v4
- uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ vars.GCP_WIF_PROVIDER }}
service_account: ${{ vars.PROD_DEPLOYER }}
- uses: google-github-actions/setup-gcloud@v2
- run: npm ci
- run: npm run db:migrate:production
- run: gcloud run deploy task-app --image ${{ vars.REGION }}-docker.pkg.dev/${{ vars.PROJECT_ID }}/task-app/task-app:${{ github.sha }} --region ${{ vars.REGION }} --project ${{ vars.PROJECT_ID }}
- run: npm run deploy:verify
cleanup:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ vars.GCP_WIF_PROVIDER }}
service_account: ${{ vars.PREVIEW_DEPLOYER }}
- uses: google-github-actions/setup-gcloud@v2
- run: gcloud run services delete task-pr-${{ github.event.pull_request.number }} --region ${{ vars.REGION }} --project ${{ vars.PROJECT_ID }} --quiet
- run: npm run preview:cleanup -- --pr ${{ github.event.pull_request.number }}
This YAML is a workflow skeleton: preview:configure, migration, and cleanup scripts are application-specific and must be implemented before enabling the workflow. In particular, the preview job must build and push the image before deployment; a production pipeline should make that image-publishing step explicit and record its digest. Restrict preview deployment to same-repository pull requests because fork workflows must not receive cloud permissions.
Test strategy should stay proportional:
| Test layer | What it catches | When it runs |
|---|---|---|
| Unit | Validation, task rules, flag defaults | Every pull request |
| Integration | Repository queries, migrations, PostgreSQL behavior using a disposable test database | Every pull request |
| Contract | API response shape and error behavior expected by the UI | Every pull request |
| Load | Latency and resource behavior at assumed peak traffic | Before launch and after material changes |
Keep load tests small and repeatable. They should answer whether the app handles the assumed peak and identify obvious regressions, not create a performance program for a low-traffic service.
9. Observability
CI tells the developer whether a change passed known checks. Production observability tells them whether the software behaves correctly under real traffic. Use structured logs with request and trace identifiers, and avoid logging authorization headers, secrets, or task contents.
{
"severity": "INFO",
"message": "task_created",
"service": "task-app",
"environment": "production",
"request_id": "req_01J8F3K7",
"trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
"route": "POST /api/tasks",
"status_code": 201,
"duration_ms": 18
}
Use RED metrics for the API: request rate, error rate, and duration. Use USE metrics for constrained resources: utilization, saturation, and errors for Cloud SQL connections, CPU, and memory. Cloud Run scaling can hide some pressure; watch database connection count and pool saturation rather than looking only at container CPU.
OpenTelemetry should instrument incoming requests and database calls. This Node.js example initializes the SDK before importing the application so automatic instrumentation can wrap supported libraries.
// instrumentation.ts
import { NodeSDK } from "@opentelemetry/sdk-node";
import { getNodeAutoInstrumentations } from "@opentelemetry/auto-instrumentations-node";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
const sdk = new NodeSDK({
traceExporter: new OTLPTraceExporter(),
instrumentations: [getNodeAutoInstrumentations()],
});
sdk.start();
process.on("SIGTERM", async () => {
await sdk.shutdown();
});
Set the exporter endpoint and resource attributes through deployment configuration, and verify that HTTP and PostgreSQL spans appear before relying on them during an incident. Avoid high-cardinality metric labels such as user IDs, task IDs, and raw URLs.
| SLI | Initial SLO | Measurement |
|---|---|---|
| Successful API requests | 99.5% per calendar month | Non-5xx requests divided by eligible requests |
| API latency | 95% under 500 ms | Server-side request duration, excluding health checks |
| Release health | No sustained elevated error rate after deploy | Error rate and latency before/after deployment |
| Database backup | Daily backup available | Cloud SQL backup status and periodic restore exercise |
The first dashboard should show request rate, 5xx rate, p95 latency, Cloud Run instance count, Cloud SQL CPU, connection count, storage, and recent deploys. Add an error log panel with trace links. A dashboard is for diagnosis; alerts should signal a user-visible problem or a condition likely to become one.
Page or notify on:
- Sustained 5xx rate above the error budget burn threshold.
- Availability probe failures from more than one check interval.
- Cloud SQL unavailable, or connection exhaustion that causes request failures.
- Production deploy health check failure.
Use tickets or a daily review for disk growth, elevated but non-critical latency, and stale preview cleanup. Alert fatigue is especially expensive for one person.
10. Security and compliance
For a solo developer, security controls should be automated where possible and easy to audit.
- Require pull requests and CI checks before merging to
main; limit who can edit protected workflow and environment settings. - Use GitHub OIDC and Google Workload Identity Federation for short-lived CI credentials. Separate production deploy identity from preview deploy identity.
- Grant the production service account access only to production secrets and the required Cloud SQL instance. Grant the preview identity access only to preview resources.
- Do not pass production secrets to preview builds. Do not run deployment workflows for untrusted fork pull requests.
- Store database passwords in Secret Manager, rotate them deliberately, and keep application logs free of credentials and personal data.
- Run dependencies through lockfile-based installs, review dependency updates, and scan container images before release.
- Use TLS for external traffic and managed database connections. Restrict database networking to the application and operational paths.
- Define a retention period for preview services and data. Cleanup should be idempotent and safe to rerun.
- Back up the database and test restoring into a separate instance. A configured backup is not proof of recoverability.
Do not claim compliance based on this blueprint. Applicable privacy, retention, and regulatory obligations depend on the product and its users. If the app begins storing sensitive data, reassess identity, access logging, encryption, retention, and incident response before adding users.
11. Cost
This is an assumption-based monthly estimate for one region, low traffic, a small Cloud SQL instance, and limited preview use. It is not a quote. Provider prices, egress, backups, logs, and region materially affect the bill.
| Cost area | Assumption-based monthly estimate |
|---|---|
| Cloud SQL PostgreSQL | $35–$90 |
| Cloud Run production compute | $0–$20 |
| Cloud Run previews | $0–$15 |
| Artifact Registry, logs, and monitoring | $5–$20 |
| Secret Manager and network overhead | $2–$10 |
| Estimated total | $42–$155 |
The database is the likely baseline cost, not the application container. Avoid provisioning one Cloud SQL instance per pull request. Use the same instance with a separate preview database and scoped preview data, while keeping production and preview credentials distinct. Set a cloud budget notification, review actual spend monthly, and cap preview lifetime. A budget alert is a notification, not a hard spending limit.
12. Failure modes, resilience and disaster recovery
| Failure mode | User impact | Response |
|---|---|---|
| CI is flaky | Changes wait or developers bypass checks | Fix or remove nondeterministic tests; never normalize merging red |
| Preview deploy fails | Review is slower; production is unaffected | Keep CI result visible, inspect deployment logs, retry only after identifying cause |
| Cloud Run release is unhealthy | API errors after deploy | Roll back to previous image and investigate traces and logs |
| Migration fails | Release blocked; schema may be partially changed | Use idempotent migrations, compatible changes, and an explicit migration job |
| Cloud SQL is unavailable | Reads and writes fail | Return controlled errors, preserve request deadlines, alert, and follow recovery runbook |
| Preview cleanup is missed | Unneeded compute or test data remains | Scheduled cleanup by age and PR state; make deletion idempotent |
| CI cloud identity is misconfigured | Deployments stop | Keep a documented federation setup and a break-glass process outside routine credentials |
Cloud Run can restart instances, but it cannot make a database outage disappear. Set request timeouts, bound database connection pools, and fail requests quickly when the database is unavailable. Do not add automatic retries to non-idempotent writes unless requests have an idempotency strategy.
For disaster recovery, enable Cloud SQL automated backups and point-in-time recovery where supported by the selected configuration. Document who can restore, where the restored database goes, how the application is pointed at it, and how DNS or service routing is changed. Run a restore exercise periodically. The initial RPO of 24 hours and RTO of one business day are assumptions that should be revised if the product becomes operationally important.
A rollback is not a database rollback. Keep migrations compatible with the previous application version and defer destructive schema changes until a later release. If a deployment causes data corruption, stop writes and restore or repair from a known recovery point; do not assume redeploying the old container reverses data changes.
13. Evolving to the next scale
Do not split the monolith or add infrastructure because a diagram looks more mature. Change the design when measured constraints or operational requirements make the current choice inadequate.
| Signal | Change to consider | Keep simple until |
|---|---|---|
| Database CPU, storage, or connections approach sustained limits | Resize Cloud SQL, tune queries and indexes, review pooling | A trace or query plan identifies the bottleneck |
| Users require higher availability | Add regional or instance-level resilience and improve restore objectives | The business accepts the current SLO and recovery window |
| Preview deployments collide or exceed budget | Add per-PR quotas, stronger lifecycle automation, or isolated preview projects | PR volume remains low and cleanup is reliable |
| Releases require coordinated operational work | Add a staging gate, canary rollout, or deployment approval | Automated checks and rollback are sufficient |
| One component needs independent scaling or ownership | Extract that component behind a stable interface | The monolith remains easy to change and deploy |
| Multiple developers make conflicting changes | Add code ownership, review rotation, and clearer team conventions | A solo workflow remains low-friction |
A scaling change should improve a measurable property: release safety, recovery time, latency, cost, or team throughput. For example, a queue is justified when a user-facing request must hand work off reliably or processing time exceeds request limits—not merely because background processing is a familiar pattern.
14. Phased implementation plan
A solo developer can establish this process incrementally. Do not start by automating every possible deployment branch. First make the ordinary path reliable.
- Create the application baseline. Add a health endpoint, structured logs, environment-based configuration, database migrations, and a local PostgreSQL setup. Commit the lockfile and document the local test commands.
- Protect the mainline. Require pull requests and passing CI. Keep branches short-lived; merge small changes frequently. Use feature flags only when they let incomplete work remain safely disabled.
- Build the verification pipeline. Add linting, type checking, unit tests, integration tests against a disposable PostgreSQL database, and a container smoke test. Make failures explain themselves in the CI output.
- Provision stable infrastructure. Use Terraform for Artifact Registry, Cloud SQL, Cloud Run, Secret Manager, service accounts, and Workload Identity Federation. Keep production and preview identities separate.
- Deploy production from
main. Build and identify the image by commit SHA, run compatible migrations, deploy, and perform a health check. Record the image digest and retain a known-good prior version. - Add previews. Start with trusted pull requests only. Create a preview service and isolated test data, publish the URL, and automate cleanup on close. Add a scheduled cleanup job for missed events.
- Operate and refine. Build one useful dashboard, configure a small set of actionable alerts, set a budget notification, and rehearse a database restore. Remove flaky checks and stale flags rather than accumulating process.
The desired outcome is not “full DevOps” for its own sake. It is a repeatable path from a small change to production, with enough evidence at each step that one developer can move quickly without relying on memory or hope.