ATOM Documentation

← Back to App

šŸš€ Quick Start - Next Steps

Immediate Actions (Do Now)

1. Clear Redis Data (5 minutes)

# SSH into production
fly ssh console -a atom-saas

# In the console, run:
cd app
export REDIS_URL=$UPSTASH_REDIS_URL
python3 -c "
import redis
import os

r = redis.from_url(os.getenv('REDIS_URL'))
brennan_id = '31c06fc4-db22-4740-83ea-48ac14f25810'

# Get all keys
all_keys = []
cursor = '0'
while cursor != 0:
    cursor, keys = r.scan(cursor=cursor, count=1000)
    all_keys.extend(keys)

# Filter out Brennan's keys
keys_to_delete = [k for k in all_keys if brennan_id not in str(k)]

# Delete in batches
for i in range(0, len(keys_to_delete), 100):
    batch = keys_to_delete[i:i+100]
    r.delete(*batch)
    print(f'Deleted {min(i+100, len(keys_to_delete))}/{len(keys_to_delete)}')

print(f'Done! Remaining: {r.dbsize()} keys')
"

2. Deploy Prevention Service (10 minutes)

# Add prevention check to signup flow
# Edit: backend-saas/api/routes/tenants.py

# Add this import at the top:
from core.test_data_prevention_service import get_test_data_prevention_service

# Add this check at the beginning of create_tenant function:
@router.post("/tenants")
async def create_tenant(
    request: Request,
    tenant_data: TenantCreate,
    prevention: TestDataPreventionService = Depends(get_test_data_prevention_service)
):
    # Check for test data patterns
    is_suspicious, reason = prevention.check_tenant_creation(
        name=tenant_data.name,
        subdomain=tenant_data.subdomain,
        email=tenant_data.email
    )

    if is_suspicious:
        prevention.log_suspicious_request(
            endpoint="/tenants",
            data=tenant_data.dict(),
            reason=reason,
            ip_address=request.client.host
        )

        raise HTTPException(
            status_code=400,
            detail="Suspicious request detected. Please use a real business name and email."
        )

    # Continue with existing code...

# Deploy
git add .
git commit -m "feat: add test data prevention service"
git push origin main
fly deploy -a atom-saas

3. Verify (2 minutes)

# Test that suspicious data is blocked
curl -X POST https://atom-saas.fly.dev/api/tenants \
  -H "Content-Type: application/json" \
  -d '{"name": "Test Company", "subdomain": "test-123", "email": "test@example.com"}'

# Should return: HTTP 400 - Suspicious request detected

# Test that real data works
curl -X POST https://atom-saas.fly.dev/api/tenants \
  -H "Content-Type: application/json" \
  -d '{"name": "Acme Corp", "subdomain": "acme-corp", "email": "contact@acme.com"}'

# Should return: HTTP 200/201 - Success

---

Weekly Maintenance (5 minutes)

Run diagnostic to check for test data:

cd backend-saas
python3 scripts/diagnostic_prevent_test_data.py

If test data found, run cleanup:

python3 scripts/cleanup_all_tenants_except_brennan.py

---

Summary

āœ… **Database:** Clean (3 tenants: Brennan + 2 system)

ā³ **Redis:** Needs cleanup

ā³ **Prevention:** Ready to deploy

**Total time to complete: 20 minutes**