Setup Xata project
Connect this project to your Xata account and database.
Steps
Authenticate with Xata (if not already logged in):
xata auth loginInitialize the project:
xata initFollow the prompts to select your organization, project and branch.
Get the connection string:
xata branch urlCreate
.env.localwith the connection string:echo "DATABASE_URL=<paste connection string>" > .env.localInitialize pgroll (one-time setup):
xata roll initRun all migrations:
xata roll start migrations/001_create_users.yaml xata roll complete xata roll start migrations/002_add_role.yaml xata roll complete xata roll start migrations/003_add_teams.yaml xata roll completeVerify the setup:
psql $(xata branch url) -c "SELECT * FROM users;"
Notes
- The
xata initcommand creates a.xatafolder with configuration - Connection strings include credentials — never commit
.env.local xata roll initonly needs to run once per database