Skip to content

feat: PostgreSQL persistence — data survives Render cold starts - ap… - #11

Merged
ubongn merged 1 commit into
mainfrom
feat/postgres-persistence
Jul 20, 2026
Merged

feat: PostgreSQL persistence — data survives Render cold starts - ap…#11
ubongn merged 1 commit into
mainfrom
feat/postgres-persistence

Conversation

@ubongn

@ubongn ubongn commented Jul 20, 2026

Copy link
Copy Markdown
Owner

…i/state.py: dual-backend store (PostgresStore + MemoryStore) - PostgresStore: psycopg2 connection pool, auto-creates tables, auto-seeds qualification-round data on first boot - MemoryStore: in-memory fallback for local dev (no DATABASE_URL) - Both expose identical interface — main.py unchanged - requirements.txt: added psycopg2-binary - main.py: health endpoint now reports active backend Fixes the 'data disappears on refresh' issue caused by Render free-tier spindown wiping in-memory state. With DATABASE_URL set, all demo invoices/verdicts/transactions persist across restarts. To enable on Render: 1. Create free PostgreSQL instance 2. Add DATABASE_URL env var to web service 3. First boot auto-creates schema + seeds demo data

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Smart contract change (requires redeployment)

Testing

  • Local tests pass (cargo test)
  • Frontend builds without errors
  • Tested on Casper Testnet (if applicable)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

…/state.py: dual-backend store (PostgresStore + MemoryStore) - PostgresStore: psycopg2 connection pool, auto-creates tables, auto-seeds qualification-round data on first boot - MemoryStore: in-memory fallback for local dev (no DATABASE_URL) - Both expose identical interface — main.py unchanged - requirements.txt: added psycopg2-binary - main.py: health endpoint now reports active backend Fixes the 'data disappears on refresh' issue caused by Render free-tier spindown wiping in-memory state. With DATABASE_URL set, all demo invoices/verdicts/transactions persist across restarts. To enable on Render: 1. Create free PostgreSQL instance 2. Add DATABASE_URL env var to web service 3. First boot auto-creates schema + seeds demo data
@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agritrust-casper Ready Ready Preview, Comment Jul 20, 2026 3:03pm

@ubongn
ubongn merged commit c04a68a into main Jul 20, 2026
7 checks passed
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