Setup Instructions
Current Status
Base URL: https://morphos-api-40731981859.us-central1.run.app
Tenant ID: 93ca83e5-0082-4823-991f-5bf1190c76eb
API Key: mph_dcCHS_jVk_XDmXVc...
Start Morphos
First, make sure Morphos is running locally:
# From the Morphos project directory
cd ~/Development/Scripts/Morphos
docker-compose up -d
docker-compose run --rm migrate
# Verify it's running
curl http://localhost:8000/health
Create a Tenant
Create a tenant to get your API credentials:
# Create a tenant (replace SECRET_KEY with your Morphos secret)
curl -X POST http://localhost:8000/api/v1/tenants \
-H "Content-Type: application/json" \
-H "X-Platform-Key: dev-secret-key-change-in-production" \
-d '{
"name": "Sample App",
"slug": "sample-app",
"allowed_origins": ["http://localhost:5000"]
}'
# Response will include:
# - id (your TENANT_ID)
# - api_key (your API_KEY)
# - api_secret (save this - only shown once!)
Configure Environment
Set the environment variables for this sample app:
# Create .env file in examples/sample-app/
cat > .env << 'EOF'
MORPHOS_BASE_URL=http://localhost:8000
MORPHOS_TENANT_ID=your-tenant-id-from-step-2
MORPHOS_API_KEY=mph_your-api-key-from-step-2
MORPHOS_API_SECRET=your-api-secret-from-step-2
MORPHOS_SECRET_KEY=dev-secret-key-change-in-production
FLASK_SECRET_KEY=your-flask-secret-key
EOF
Note: The MORPHOS_SECRET_KEY must match the SECRET_KEY configured in your Morphos instance. This is used for signing embed tokens.
Run the Sample App
cd ~/Development/Scripts/Morphos/examples/sample-app
# Install dependencies
pip install -r requirements.txt
# Load environment variables
export $(cat .env | xargs)
# Run the app
python app.py
Visit http://localhost:5000 to see the demos.
Create Test Data (Optional)
Create a lab concept to test with:
# Using the API
curl -X POST http://localhost:8000/api/v1/labs/admin/concepts \
-H "Content-Type: application/json" \
-H "X-API-Key: $MORPHOS_API_KEY" \
-H "X-API-Secret: $MORPHOS_API_SECRET" \
-d '{
"name": "AI-Powered Search",
"problem_narrative": "Users struggle to find relevant content in our app. They often give up after a few searches.",
"tags": ["search", "ai", "ux"]
}'
# Add a mockup
curl -X POST http://localhost:8000/api/v1/labs/admin/concepts/{concept_id}/mockups \
-H "Content-Type: application/json" \
-H "X-API-Key: $MORPHOS_API_KEY" \
-H "X-API-Secret: $MORPHOS_API_SECRET" \
-d '{
"name": "Smart Search Bar",
"html_content": "AI-powered suggestions appear as you type
"
}'
Troubleshooting
CORS errors in browser
Make sure your origin (http://localhost:5000) is in the tenant's allowed_origins list.
Token validation fails
Ensure MORPHOS_SECRET_KEY matches the SECRET_KEY in your Morphos .env file.
API returns 401
Verify your API key and secret are correct and the tenant is active.