code-docs/plugins/connections/overview.md
Connections enable Lowdefy apps to communicate with external data sources and APIs.
Connections are:
┌──────────────────┐
│ Client Request │
│ (action) │
└────────┬─────────┘
│
▼
┌──────────────────┐
│ @lowdefy/api │
│ Server-side │
└────────┬─────────┘
│
▼
┌──────────────────┐
│ Connection │
│ (plugin) │
└────────┬─────────┘
│
▼
┌──────────────────┐
│ External Data │
│ Source / API │
└──────────────────┘
| Package | Data Source | Request Types |
|---|---|---|
| @lowdefy/connection-mongodb | MongoDB | CRUD, Aggregation |
| @lowdefy/connection-axios-http | REST APIs | GET, POST, PUT, DELETE |
| @lowdefy/connection-knex | SQL (Postgres, MySQL, etc.) | Query, Insert, Update |
| @lowdefy/connection-elasticsearch | Elasticsearch | Search, Index |
| @lowdefy/connection-google-sheets | Google Sheets | Read, Write |
| @lowdefy/connection-redis | Redis | Get, Set, List ops |
| @lowdefy/connection-sendgrid | SendGrid | Send emails |
| @lowdefy/connection-stripe | Stripe | Payments, Customers |
Connections are defined in lowdefy.yaml:
connections:
- id: mongodb
type: MongoDBCollection
properties:
connectionString:
_secret: MONGODB_URI
databaseName: myapp
collection: users
Requests use connections to operate on data:
requests:
- id: getUsers
type: MongoDBFind
connectionId: mongodb
properties:
query:
active: true
options:
sort:
createdAt: -1
Connection credentials use _secret:
properties:
connectionString:
_secret: MONGODB_URI # From environment
Secrets:
Connections can restrict operations:
properties:
read: true # Allow read operations
write: false # Block write operations
Each request can have auth rules:
requests:
- id: deleteUser
auth:
- roles:
- admin
Each connection package exports:
export default {
connections: {
MongoDBCollection: {
schema: { ... }, // JSON schema for properties
requests: [...], // Supported request types
},
},
requests: {
MongoDBFind: {
schema: { ... }, // JSON schema for request props
resolver: async (ctx) => { ... },
},
},
};
Connections run server-side because:
Connection: Shared configuration (credentials, endpoint) Request: Specific operation (query, mutation)
Multiple requests can share one connection.
Operators like _secret and _user enable: