This application supports both local PostgreSQL and Neon cloud databases.
-
Install PostgreSQL on your system
-
Create a database:
psql -U your_username CREATE DATABASE gansytems; \q
-
Update
.env:DATABASE_URL=postgresql://your_username@localhost:5432/gansytems
-
Run migrations:
npm run migrate
-
Create a Neon account at https://neon.tech
-
Create a new project and database
-
Copy the connection string from the Neon dashboard
-
Update
.env:DATABASE_URL=postgresql://user:pass@ep-xxx.neon.tech/dbname?sslmode=require
-
Run migrations:
npm run migrate
The application automatically detects which database driver to use based on the connection string:
- Local PostgreSQL: Uses
postgresdriver (standard PostgreSQL protocol) - Neon Cloud: Uses
@neondatabase/serverlessdriver (HTTP-based)
No code changes needed - just update the DATABASE_URL environment variable!
To switch from local to cloud (or vice versa):
- Update
DATABASE_URLin.env - Run
npm run migrateto apply schema to the new database - Restart your dev server
The application will automatically use the correct driver.