I posted this Expo starter a couple weeks ago, and I promised an SDK 58 update soon. A commenter also suggested generating the query keys from the OpenAPI spec instead of hand writing key factories, and I said I'll add it on the next drop. Both are out now. It's on SDK 58, the spec-derived queries and mutations cover the whole data layer, and it's now an npm package, so you can start a project with:
npx create-expo-app my-app --template u/amirgazerani/expo-starter-pack
There's a LOT more into this release, so here's all of it.
SDK 58
The starter now runs on Expo SDK 58 with React Native 0.88, React 19.3 and the New Architecture, with expo-router's typed routes. If you're still on SDK 57, that version stays available on GitHub under the sdk-57 tag.
Query keys and mutations come from the spec
Before, every resource had a key factory I had to keep in sync with the backend:
ts
export const itemKeys = {
all: ["items"] as const,
lists: () => [...itemKeys.all, "list"] as const,
detail: (id: number) => [...itemKeys.all, "detail", id] as const,
};
Now keys and query options are derived from the method and path, so there are no factories, and a create mutation is this:
ts
export function useCreateItem() {
const queryClient = useQueryClient();
return $api.useMutation("post", "/v1/items", {
onSuccess: () =>
queryClient.invalidateQueries({
queryKey: $api.queryOptions("get", "/v1/items").queryKey,
}),
meta: { skipGlobalError: true },
});
}
I invalidate with the same call I fetch with, and the mutation variables are the request itself: mutate({ body, params }). If the backend renames something, I regenerate the types and TypeScript lists every call that broke.
Mutations that need to shape the request, like login, which adds the device name and stores the token, are still written by hand using the same predesigned conventions as before.
A complete UI kit instead of scattered components
This is the biggest visual change. The kit now has buttons (solid, outline, ghost and gradient), inputs, text areas, switches, checkboxes, radio groups, chips, badges, avatars, cards, dropdowns, modals and toasts. Modals come as center, bottom sheet, fullscreen and side drawer. Everything that used to be decided per component is now centralized:
- Theme tokens for colors, radius and spacing, with light and dark mode. To rebrand, edit one file.
- Typography in one file. List your font files, map them to the four weights and pick a default family. Body text, button labels and field labels each get their own default weight, so changing the font of the whole app is one setting, and no component hard-codes a font.
- One size scale (sm, md, lg) shared by every control, so a md button and a md input are the same height. To make the whole kit a bit bigger, change the numbers once. A single component can still override.
I also replaced sonner-native with my own toast store, so toast.error() works from anywhere, not only inside components. It has swipe to dismiss, a countdown bar and dedupe, and the modal mounts its own host so toasts show above it.
The app documents itself
The Home tab documents every component with its props, an import line and live variants. The Data tab explains the networking, mutations, how the token is stored and how errors are handled. A demo dashboard shows an infinite list, create and delete, and a profile form with inline validation errors, and each section names the file it's built from.
When you start a real project, npm run strip-example removes all of it, plus any API resource only the demo used, and leaves a Hello world home screen and an empty dashboard under the same auth guard. It shows you the plan first, won't run on a dirty git tree, and type-checks before and after.
Backend
The mock backend is still there, and the template assumes a Laravel-style JSON API for your real backend. If yours is different, no worries, the README lists the files you need to change.
Links:
Give it a shot and tell me how it goes. If you like it, a star on the repo helps. If you have a suggestion, open an issue; they'll be evaluated.