Mobile app
Wasp: 0.13.x
Hello, I am planning to make a native app for my platform, and since actions and queries relies on context, I am not sure if there is a way to be able to make it as API calls, so it can be implemented in a native mobile app.
Any idea how could this be done? The platform uses lots of actions and queries. Would be the only solution to make API calls for each one of the actions and queries already implemented?
Thanks in advance
3 Replies
Hi @mgp25. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Currently, Wasp doesn't have official support for native mobile apps, but there are a few approaches you could take to connect a native mobile app to your Wasp backend.
Current Options
1. Custom HTTP API Endpoints: You can create custom API endpoints using Wasp's
api
declaration to expose your server functionality to external clients like mobile apps:
This would require you to create API endpoints for each of your actions and queries, which might be tedious if you have many of them Custom HTTP API Endpoints.
2. Manual Implementation: You could manually replicate the functionality of your actions and queries in your mobile app by making HTTP requests to your Wasp server, as demonstrated in a proof of concept by a community member:
Github Issue: Mobile app support
Future Possibilities
The Wasp team is aware of this need and has been discussing several potential solutions:
1. Automatically Exposed API: There's an open issue about automatically exposing a documented API based on defined Operations, which would help with building mobile clients that can use the existing Wasp backend Github Issue: Auto API exposure.
2. SDK Generation: Another idea being explored is providing SDKs for different languages that would allow interaction with your app's functionality. This could include TypeScript SDKs for your queries and actions that could be used in mobile apps Github Issue: Multiple clients.
3. Direct Mobile Support: The team is also considering direct support for mobile app generation, possibly using React Native or Expo Github Issue: Mobile app support.
For now, the most straightforward approach would be to create custom API endpoints for the functionality you need in your mobile app. While this requires duplicating some effort, it gives you the most control over the interface between your server and mobile client.
The Wasp team has indicated that better mobile support is on their roadmap, but there's no specific timeline yet for when these features might be available.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @mgp25, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?Hey, I've created this example recently (Wasp 0.16 + Expo 52) https://github.com/wasp-lang/wasp-expo-app
GitHub
GitHub - wasp-lang/wasp-expo-app: Example of using Wasp's auth and ...
Example of using Wasp's auth and API in an Expo mobile app - wasp-lang/wasp-expo-app
Already paying dividends, nice!