Integration patterns
How AISquare fits into different application architectures, and which pattern to pick.
AISquare is a backend service layer. Your application calls it through your own backend, which keeps your credentials safe and gives you a place to add caching, business logic, and personalization. This page walks the three integration shapes and helps you choose one.
Most integrations follow the same spine:
Frontend -> Your backend -> AISquare APIYour backend sits between your application and AISquare. The patterns below are variations on where that backend lives and what it does.
Pattern 1: Frontend and backend (recommended)
The common case. A client talks to your backend, and your backend talks to AISquare.
Client (web or mobile)
|
Your backend
|
AISquare APIHow a request flows:
- The user does something in your app.
- Your backend calls the AISquare API.
- Your backend processes the response and applies any business logic.
- The frontend renders the result.
This pattern keeps API keys on the server, lets you add caching and transformations, and is where per-user personalization lives. Use it for content feeds, recommendations, and dashboards.
Pattern 2: Server to server
No frontend in the loop. Your backend calls AISquare as part of an internal workflow.
Your backend -> AISquare APIThe call runs inside a service or a scheduled job rather than in response to a user action. Use it for syncing user data, generating reports, and running analytics jobs.
Pattern 3: Platform embedding
AISquare powers features inside another product, such as a learning or gaming platform. Your platform owns the users and authentication, and calls AISquare on their behalf.
User -> Your platform -> AISquare APIHere AISquare acts as a data and intelligence layer. Your platform manages users, handles authentication, and maps your own user IDs to AISquare users. See User onboarding for how to register users and keep that mapping.
Map your users
When you embed AISquare, register each of your users through the API and store their key against your own user ID. A shared account merges everyone's activity and breaks personalization.
Choosing a pattern
| Use case | Recommended pattern |
|---|---|
| Web or mobile app | Frontend and backend |
| Internal services | Server to server |
| Partner platform | Platform embedding |
Best practices
Whichever pattern you pick, the same rules apply.
- Keep credentials on the backend. Never call AISquare from the frontend with a workspace key, and never ship a key in client-side code. See Authentication.
- Handle errors gracefully. Retry transient failures, refresh expired tokens, and validate inputs before sending a request. See Errors.
- Page through large results. Do not fetch everything at once. Use the shared list parameters in Search and filtering.
Putting it together
A typical integration, end to end:
- The user opens your app.
- Your backend authenticates the user.
- Your backend fetches AISquare data.
- The frontend renders the content.
- The user interacts, and your backend records or acts on it.