For Teams

Quickstart

Install Astapa and run your first isolated session.

1. Install

bash
# macOS
brew install astapa/tap/astapa

# Linux
curl -fsSL https://astapa.com/install.sh | sh

# Or download binary
# https://github.com/namulaki/astapa/releases

2. Start the proxy

bash
export DATABASE_URL=postgres://user:pass@localhost:5432/mydb
astapa-proxy

# Proxy: localhost:5433
# API:   localhost:8080

3. Create a session

bash
# Via API
curl -X POST http://localhost:8080/sessions \
  -H "Content-Type: application/json" \
  -d '{"project_id": "test"}'

# Returns: {"id": "sess_abc123", "status": "active"}

4. Connect through proxy

bash
# Use any Postgres client
psql "postgres://user:pass@localhost:5433/mydb?options=-c%20astapa.session_id=sess_abc123"

# Or with SDK
pip install astapa
python
from astapa import Astapa

client = Astapa()
session = client.create_session(project_id="test")
session.connect(database="mydb", user="user", password="pass")

# Reads see production
users = session.execute("SELECT * FROM users")

# Writes go to shadow tables
session.execute("UPDATE users SET status = 'active' WHERE id = 1")

# View staged changes
print(session.diff())

5. Review and apply

python
# Propose changes for review
session.propose()

# Later: approve or reject
session.approve()  # Merge to production
session.reject()   # Discard

Next steps