Move your data from Google Sheets to Neon PostgreSQL for better performance and reliability.
- Go to neon.tech and sign up/login
- Create a new project
- Copy these from the connection details:
- Host (looks like:
ep-xxx-xxx.region.aws.neon.tech) - Database (usually
neondb) - User (usually
neondb_owneror your email) - Password (save it!)
- Host (looks like:
Add to your .env.local file:
PG_HOST=ep-xxx-xxx.us-east-2.aws.neon.tech
PG_USER=neondb_owner
PG_PASSWORD=your_password_hereNote: The migration script will automatically create three databases: dc, dc_pos, and dc_sys
bun run test-dbExpected output:
✅ Successfully connected to PostgreSQL!
📊 Database info: PostgreSQL 16.x ...
bun run migrateExpected output:
🚀 Starting migration...
✅ Connected to PostgreSQL
✅ Schema created successfully
✅ Migrated 12 parameters
✅ Migrated 3 currencies
✅ Migrated 5 payment methods
...
✨ Migration completed successfully!
Your app now uses PostgreSQL automatically. No code changes needed!
- Restart your app (if running)
- Check the console - you should see faster load times
- Your data is now in PostgreSQL instead of Google Sheets
- ✅ Shop parameters (name, address, email, etc.)
- ✅ Currencies and exchange rates
- ✅ Payment methods
- ✅ Products and categories
- ✅ Users and roles
- ✅ Theme colors
- ✅ Printer configurations
- Check your Neon database isn't paused (it auto-pauses after inactivity)
- Verify credentials are correct
- Try copying connection string directly from Neon console
- Make sure all
PG_*variables are in.env.local - No spaces around the
=sign - No quotes needed around values
- Verify
GOOGLE_API_KEYandSHOP_SPREADSHEET_IDare still in.env.local - Check sheet names match exactly (case-sensitive)
Just remove the PG_* variables from .env.local and restart. Your app will use Google Sheets again.
- Detailed guide:
scripts/MIGRATION_README.md - Technical details:
scripts/MIGRATION_SUMMARY.md - Migration script:
scripts/migrate-sheets-to-postgres.ts
- Run migration during low traffic - takes 1-2 minutes
- Keep Google Sheets as backup - don't delete it yet
- Test thoroughly - verify all features work
- Monitor Neon dashboard - check query performance
- Set up alerts - Neon can notify you of issues
Questions? Check the detailed guides or test your connection with bun run test-db