RubricLab / create-rubric-app

CLI tool to get started with a full-stack AI project.
https://todo.rubric.sh
Other
133 stars 9 forks source link

New template for expo universal native app #17

Open bidah opened 10 months ago

bidah commented 10 months ago

Hey there 👋, Wanted to know if it a universal app agent template could be added by me. I have already ported a project from Next.js to universal expo app http://dub.sh/universalmedusa and I think it could be really cool to have it as an option in the CLI to get part mobile developers to use it

LMK what you think.

tedspare commented 10 months ago

Hey Rodrigo! This sounds like a great way to help mobile devs build agents 🔥

Something like npx create-rubric-app --expo and it would scaffold + run a mobile app, ready for deployment on App Store and Google Play Store?

bidah commented 10 months ago

Yes. Some considerations are that it would need to be a monorepo to have an app for the mobile app and another one for Next.js to use the router API. I have been looking at the codebase, and it uses streaming, but React Native can't handle it. So the idea is to fallback to no streaming on mobile for now. I would use NativeWind to port the same Tailwind styles of the boilerplate. All this using Expo and Expo Router to utilize the Metro bundler for the web version.

Regarding deployment, there are various ways to deploy apps. The starter could be either opinionated or not about it.

tedspare commented 10 months ago

Monorepo eg. with Turborepo seems totally fine imo.

Falling back to non-streaming also seems like a fair trade-off!

NativeWind looks awesome. I'm a big fan of Tailwind.

As for deployment, I would trust your judgment! We're going for strong opinions here to optimize for time-to-MVP.

Heads up, @sarimrmalik has much more mobile dev experience than me.

sarimrmalik commented 9 months ago

@bidah I have been thinking of adding an expo template as well, do you want to collaborate on this?

I've never ported a web-app to a mobile app using Expo, does this mean updating the web app will also update the mobile app in realtime? This could be really cool.

bidah commented 9 months ago

Hey, all thoughts LGTM. I would love to know more about those "strong opinions to optimize for time-to-MVP" so I can try to apply them. It would be cool to build this together, @sarimrmalik . Yes, you can achieve fast refresh on all platforms by using Expo CLI and Metro Bundler.

There are different approaches to setting up a universal app. I have previously used the solito.dev stack, where you have a Next.js app and an Expo app that share screens, providers, etc. However, now we have NativeWind v4 working on Expo with Expo Router, so we can skip the Next app. When it comes to the fast MVP approach, this would be a better choice, for example, since a monorepo always introduces some complexities and you end up with two apps.

I am referring to Nativewind since the project is using tailwind so we should keep those styles and add some minor platform differences to make them work.

I have just open-sourced a repository with an initial setup for universal apps using NativeWind v4. You can find it here: https://github.com/bidah/universal-nativewind-v4-starter could be a good starting point.

We would still need a monorepo setup, but only to serve the API endpoints for the Next app and another workspace for the universal app.

bidah commented 9 months ago

I am going to start flexing that fast time-to-MVP muscle over here. I will add you, @sarimrmalik, to a private repo once I have the initial setup.

My latest thoughts on app structure are that we don't need the monorepo setup in the end. First, no monorepo makes the project more similar to a web project, simpler and more familiar for React.js/React Native users. It is also less complex. Like it or not, monorepos do have inherent complexities, and you need some familiarity with them. Additionally, by using Expo for web setup, the code re-sharing happens right away. There is no need to reuse RN components in the Next.js project, for example. Next.js is for the API only. Talking about Next.js API, it goes right into the app itself. Simple insight, but it works. https://twitter.com/bidah/status/1728061138342904254

If anybody else wants to be added to the repo, LMK.

iamshanvy commented 9 months ago

@bidah might not able to contribute much but would be happy to be invited, perhaps I could help with testing