Agent Skill
2/7/2026

fastapi

FastAPI production patterns with Pydantic v2 and SQLAlchemy async. Use when: setup or building Python APIs, async database, JWT auth. Do not use for: API design decisions (use api-design skill). Workflow: api-design (design) → this skill (implementation).

Z
zzoohub
0GitHub Stars
1Views
npx skills add zzoohub/mealio

SKILL.md

Namefastapi
DescriptionFastAPI production patterns with Pydantic v2 and SQLAlchemy async. Use when: setup or building Python APIs, async database, JWT auth. Do not use for: API design decisions (use api-design skill). Workflow: api-design (design) → this skill (implementation).

Mealio

Photo-first meal tracking app. Snap a photo, log your meal, track your nutrition.

Features

  • Photo-first capture — Camera as the primary action; log a meal in seconds
  • Nutrition tracking — Calories, macros, and ingredients per meal
  • Visual diary — Week-based calendar with meal photo cards
  • Statistics — Nutrition trends, meal type distribution, top ingredients
  • Location tagging — Attach locations to meals with map view
  • Search & filter — Find meals by keyword, meal type, or date range
  • Guest mode — Use the app without an account (MMKV local storage, up to 10 entries)
  • Bilingual — English and Korean

Architecture

Monorepo with three packages:

mealio/
├── mobile/       React Native 0.83 / Expo 55
├── api/          Rust / Axum 0.8
├── infra/        Pulumi (GCP, Cloudflare, Neon)
└── diagrams/     D2 architecture & infrastructure diagrams

Infrastructure

<picture> <source media="(prefers-color-scheme: dark)" srcset="./diagrams/infrastructure-simplified-dark.svg"> <source media="(prefers-color-scheme: light)" srcset="./diagrams/infrastructure-simplified-light.svg"> <img alt="Infrastructure Overview" src="./diagrams/infrastructure-simplified-light.svg"> </picture>

System Architecture

<picture> <source media="(prefers-color-scheme: dark)" srcset="./diagrams/architecture-simplified-dark.svg"> <source media="(prefers-color-scheme: light)" srcset="./diagrams/architecture-simplified-light.svg"> <img alt="Architecture Overview" src="./diagrams/architecture-simplified-light.svg"> </picture>

More diagrams →

Tech Stack

Mobile

CategoryTechnology
FrameworkReact Native 0.83, Expo 55
LanguageTypeScript 5.9
NavigationExpo Router (file-based, typed routes)
StateZustand 5 (client), TanStack Query 5 (server), MMKV 4 (persistence)
FormsTanStack Form + Zod 4
UIReanimated 4, FlashList, expo-image
AuthGoogle Sign-In, Apple Authentication
Cameraexpo-camera, expo-image-picker
Mapsreact-native-maps, expo-location
i18ni18next + react-i18next (en, ko)
TestingJest 30, Testing Library
MonitoringSentry

API

CategoryTechnology
FrameworkAxum 0.8
LanguageRust (2021 edition)
DatabasePostgreSQL 18 (Neon)
QueriesSQLx 0.8 (compile-time checked)
AuthJWT + JWKS (Google & Apple OAuth)
StorageCloudflare R2 (S3-compatible, presigned URL uploads)
DocsOpenAPI via utoipa + Swagger UI
Rate Limitingtower_governor (10/min auth, 60/min global)
MonitoringSentry, tracing

Infrastructure

ServiceProvider
DatabaseNeon (PostgreSQL)
API HostingGCP Cloud Run (us-east4, scales 0–3)
Object StorageCloudflare R2
EmailCloudflare Email Routing
Error TrackingSentry
AnalyticsPostHog
Mobile BuildsEAS (Expo Application Services)
IaCPulumi (GCP, Cloudflare, Neon)

Getting Started

Prerequisites

  • Bun — mobile package management
  • Rust — API
  • Docker — local PostgreSQL
  • iOS Simulator (Xcode) or Android Emulator

API

cd api
cp .env.example .env     # configure environment variables
docker compose up -d     # start local PostgreSQL
cargo run                # dev server on port 8080

Swagger UI at http://localhost:8080/swagger-ui.

Mobile

cd mobile
bun install
bun start                # Expo dev server
bun run ios              # iOS simulator
bun run android          # Android emulator

Project Structure

Mobile — Feature-Sliced Design

mobile/src/
├── app/                 # Providers, global config
├── widgets/             # entry-grid, recent-entries
├── features/
│   ├── auth/            # Google & Apple sign-in
│   ├── capture-meal/    # Camera capture & meal form
│   ├── entry-feed/      # Diary calendar & feed
│   ├── entry-detail/    # View/edit entry
│   ├── search-entries/  # Search & filter
│   └── settings/        # User preferences
├── entities/
│   ├── entry/           # Entry CRUD, upload queue, photos, nutrition, statistics
│   ├── meal/            # Meal type definitions
│   └── user/            # User profile
└── shared/
    ├── api/             # HTTP client (auto token refresh, retry on 401)
    ├── lib/             # Auth, i18n, storage, deeplink, location, utils
    ├── ui/              # Design system (tokens, themes, styled + headless components)
    ├── config/          # Constants, query keys, feature flags
    └── types/           # Shared TypeScript types

Import rules: app → widgets → features → entities → shared (no upward imports).

Dual-mode architecture: authenticated users get API + TanStack Query; guests get MMKV local storage + Zustand. The useEntryData hook abstracts the difference.

API

api/src/
├── main.rs              # Server bootstrap, middleware, routes
├── lib.rs               # AppState (PgPool, JWT, OAuth, S3/R2)
├── error.rs             # RFC 9457 Problem Details
├── extractors.rs        # Db, AuthUser, Claims
├── response.rs          # Created<T>, Ok<T>, NoContent
├── features/
│   ├── auth/            # OAuth (Google, Apple), JWT, JWKS caching
│   ├── users/           # Profile, settings
│   ├── diary/           # Meal entries with location
│   ├── photos/          # Entry photos
│   ├── uploads/         # Presigned URL generation for R2
│   ├── nutrition/       # Nutrition overrides
│   ├── ai_analyses/     # AI meal analysis (stub)
│   ├── ingredients/     # Ingredient master list & linking
│   └── statistics/      # Aggregated stats
├── shared/              # Cross-feature utilities
└── migrations/          # SQL migrations (0001–0009)

Each feature follows: mod.rs, router.rs, handlers.rs, models.rs.

API Endpoints

All routes prefixed with /api/v1. Migrations run automatically on startup.

GroupEndpoints
AuthPOST /auth/sign-in, /auth/refresh, /auth/revoke
UsersGET/PATCH/DELETE /users/me, GET/PATCH /users/me/settings
DiaryGET/POST /diary, GET/PATCH/DELETE /diary/{id}
LocationGET/PUT/DELETE /diary/{id}/location
PhotosGET/POST /diary/{id}/photos, PATCH/DELETE /diary/{id}/photos/{id}, POST .../primary
NutritionGET/PUT/DELETE /diary/{id}/nutrition
AI AnalysisGET/POST /diary/{id}/analysis (stub — 501)
IngredientsGET/POST /ingredients, GET/POST/PUT /diary/{id}/ingredients, DELETE .../ingredients/{id}
StatisticsGET /statistics/nutrition, /meal-types, /top-ingredients, /overview
UploadsPOST /uploads/presign
HealthGET /health

Testing

Mobile

cd mobile
bun test                             # all tests (38 suites, 1059 tests)
bun test -- --testPathPattern=auth   # tests matching "auth"
bun test -- --watch                  # watch mode

API

cd api
cargo test               # all tests
cargo test error         # tests matching "error"

CI/CD

WorkflowTriggerAction
api.ymlPush/PR to main with api/** changesBuild + test, then deploy to Cloud Run on push
mobile-ci.ymlPR to main with mobile/** changesLint + test
mobile-build.ymlManual dispatchEAS build + optional store submit
mobile-ota.ymlPush to main with mobile/** changesTest, then eas update OTA

Environment Variables

API (api/.env)

VariableDescription
DATABASE_URLPostgreSQL connection string
JWT_SECRETJWT signing key
GOOGLE_CLIENT_IDGoogle OAuth client ID
APPLE_TEAM_IDApple Developer Team ID
APPLE_BUNDLE_IDiOS bundle identifier
R2_ACCOUNT_IDCloudflare R2 account
R2_ACCESS_KEY_IDR2 access key
R2_SECRET_ACCESS_KEYR2 secret key
R2_BUCKET_NAMER2 bucket name
R2_PUBLIC_URLR2 public URL
CORS_ORIGINSAllowed CORS origins
SENTRY_DSNSentry error tracking DSN

Mobile (mobile/.env)

VariableDescription
GOOGLE_MAP_API_KEYGoogle Maps API key
EXPO_PUBLIC_GOOGLE_WEB_CLIENT_IDGoogle OAuth web client ID
EXPO_PUBLIC_GOOGLE_IOS_CLIENT_IDGoogle OAuth iOS client ID
EXPO_PUBLIC_SENTRY_DSNSentry DSN

Deployment

  • API: Multi-stage Docker build → GCP Cloud Run (us-east4, autoscaling 0–3, 1 CPU / 512 MB)
  • Mobile: EAS Build → App Store / Play Store; OTA updates via eas update
  • Database: Neon (managed PostgreSQL)
  • Storage: Cloudflare R2 (direct upload via presigned URLs)
  • IaC: Pulumi manages Cloud Run, Secret Manager, Artifact Registry, R2, Neon

License

Private. All rights reserved.

Skills Info
Original Name:fastapiAuthor:zzoohub