A simple mobile app where you can browse products, add them to a cart, and see your total. Built with React Native (Expo), Express, Apollo Server, GraphQL, and PostgreSQL.
server/- GraphQL APImobile/- React Native app (Expo Go)
- Node.js 18 or newer
- PostgreSQL
- Expo Go on your phone, or an emulator
Create the database and tables:
createdb ecommerce_mvp
psql -d ecommerce_mvp -f server/schema.sqlCopy the env file and fill in your database details:
cp server/.env.example server/.envIf you're running Postgres locally on Linux with peer auth, leave DATABASE_URL empty and use something like:
PGUSER=your_username
PGDATABASE=ecommerce_mvp
PGHOST=/var/run/postgresql
If port 4000 is taken, set PORT=4001 and update the mobile app's GraphQL URL to match.
Install, seed, and start:
cd server
npm install
npm run seed
npm startThe API will be at http://localhost:4000/graphql.
Get your machine's LAN IP:
hostname -I | awk '{print $1}'Set up the GraphQL endpoint:
cp mobile/.env.example mobile/.envPut your LAN IP in EXPO_PUBLIC_GRAPHQL_URI, for example:
EXPO_PUBLIC_GRAPHQL_URI=http://192.168.1.11:4000/graphql
Use your LAN IP, not localhost. Your phone is a different device and can't reach localhost on your laptop.
Start the app:
cd mobile
npm install
npx expo startScan the QR code with Expo Go.
- Open the Shop tab to see all products
- Tap a product to view details
- Tap Add to Cart to add it (no login needed)
- Open the Cart tab to see your items and total
Stock goes down when you add to cart and goes back up when you remove an item.
products- list all productsproduct(id)- get one productcart(sessionId)- get cart for a sessionaddToCart- add or update quantityremoveFromCart- remove an item
On first launch the app creates a random ID and saves it in AsyncStorage. That ID is used as your cart session. No sign-in required.
Auth, payments, orders, search, product variants, push notifications, and an admin panel.