bagsy/README.md

4.3 KiB

ShopList — Family Shopping List App

A full-stack monorepo for a family shopping list application built with Turborepo, Next.js, Expo, and TypeScript.

Quick Start

Prerequisites

  • bun 1.2.9+ (install here)
  • Node.js 20+ (for npm/npx tooling)
  • PostgreSQL 13+ (for database)

Setup

  1. Install dependencies

    bun install
    
  2. Configure environment

    cp apps/api/.env.example apps/api/.env.local
    cp apps/mobile/.env.example apps/mobile/.env
    
  3. Set up database (in apps/api/.env.local)

    DATABASE_URL=postgresql://user:password@localhost:5432/shoplist
    BETTER_AUTH_SECRET=$(openssl rand -base64 32)
    OPENROUTER_API_KEY=your-key-here
    
  4. Apply migrations

    cd apps/api
    bun run db:push
    

Development

Terminal 1 — Backend

cd apps/api
bun run dev  # Runs on http://localhost:3001

Terminal 2 — Mobile

cd apps/mobile
bun run dev  # Starts Expo, scan QR with Expo Go app

Terminal 3 — Monorepo commands

bun build      # Build all packages
bun lint       # Lint all packages
bun typecheck  # Type-check all packages
bun format     # Format all files

Project Structure

/
├── apps/
│   ├── api/              # Next.js 16 backend (API routes)
│   └── mobile/           # Expo 55 app (iOS + Android)
├── packages/
│   └── types/            # Shared TypeScript types
├── package.json          # Workspace root
├── turbo.json            # Turborepo config
├── tsconfig.json         # Shared TypeScript config
└── AGENTS.md             # AI implementation guide

Tech Stack

  • Monorepo: Turborepo + bun workspaces
  • Backend: Next.js 16 App Router
  • Database: PostgreSQL + Drizzle ORM
  • Auth: better-auth (email/password, passkey, organization)
  • Mobile: Expo 55 + Expo Router + Zustand
  • UI: Expo UI (SwiftUI on iOS, Jetpack Compose on Android)
  • AI: Vercel AI SDK + OpenRouter
  • Linting: ESLint + Prettier

Documentation

  • AGENTS.md — Complete implementation guide for AI agents and developers
  • Backend API endpoints: See AGENTS.md "Backend" section
  • Mobile screens: See AGENTS.md "Mobile App" section

Implementation Phases

  • ✅ Phase 1: Scaffold (monorepo, types, skeleton apps)
  • ⏳ Phase 2: Backend core (auth, database, API routes)
  • ⏳ Phase 3: Mobile auth & navigation
  • ⏳ Phase 4: Mobile UI screens
  • ⏳ Phase 5: Polish & testing

Key Files

File Purpose
packages/types/src/index.ts Shared types (User, Household, Store, Item, etc.)
apps/api/lib/auth.ts better-auth configuration
apps/api/db/schema.ts Drizzle ORM schema
apps/mobile/lib/auth-client.ts Expo auth client
apps/mobile/store/*.ts Zustand state stores

Environment Variables

Backend (apps/api/.env.local)

DATABASE_URL=postgresql://...
BETTER_AUTH_SECRET=<32-char key>
BETTER_AUTH_URL=http://localhost:3001
OPENROUTER_API_KEY=<your-api-key>
NEXT_PUBLIC_APP_URL=http://localhost:3001
NODE_ENV=development

Mobile (apps/mobile/.env)

EXPO_PUBLIC_API_URL=http://localhost:3001
NODE_ENV=development

Common Issues

TypeScript errors in node_modules (mobile)

  • These are library compatibility issues (Expo + React Native + better-auth)
  • Run bun typecheck --skipLibCheck to skip
  • Our application code is fully typed and strict

Port 3001 already in use

  • Change port in apps/api/package.json dev script or kill existing process

Database connection fails

  • Ensure PostgreSQL is running
  • Verify DATABASE_URL format: postgresql://user:password@host:port/database

Resources

License

MIT