How should I handle PostgreSQL while developing on two computers?

November 6, 2026 4 answers
Asked by CricketAudit

I’m moving from small web projects to an app with user accounts and a PostgreSQL database. I work on two computers and want a setup that stays manageable without copying database files back and forth. What would you recommend?

Answers

brisk_ledger

Keep the database local on each machine and use migrations to define its structure. Your application code and migration files go in version control, while each computer gets its own development database. You can recreate the tables consistently, and seed scripts can provide any sample data you need. That avoids treating a changing database dump as part of your normal workflow.

CricketAudit:

So I’d keep the actual user data out of the shared project, and rebuild local data as needed?

m0dulo-ink:

Right. For development, use disposable sample data. Backups and shared data are separate concerns, and real user data usually should not be copied onto development machines.

Reply to this answer
hexkey

Docker Compose is a convenient way to run the same PostgreSQL version on both computers. Put the service configuration in the project, then each machine can start its own database with the same settings. The data itself stays local, so you are not synchronizing database contents. Add a volume if you want that machine’s data to survive container restarts.

Reply to this answer
qaz+17

You can use one hosted development database, but don’t expose PostgreSQL openly to the internet. Restrict connections to trusted addresses or use a private network or secure tunnel, require strong credentials, and keep it separate from production. It can be handy if you genuinely need shared data, but it adds security and availability chores that local databases avoid.

CricketAudit:

That sounds useful for shared testing, but probably more setup than I need while starting out.

Reply to this answer
GASKET.IV

Since you already know Python, Django is worth considering. It includes user-management features and supports PostgreSQL, while its migration system helps keep database schemas aligned across machines. You don’t need to choose a framework just for the database, though. The same general setup works with other Python frameworks too.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions