A simple Node.js + Express REST API for an Amazon clone, built with TypeScript, Drizzle ORM, Postgres, and Clerk authentication. Designed for use with a React Native frontend.
- User authentication with Clerk
 - REST endpoints for articles and orders
 - Webhook endpoint for Clerk user creation
 - PostgreSQL database with Drizzle ORM
 - TypeScript and live reload for development
 
- Node.js (v18+ recommended)
 - PostgreSQL (local or remote)
 - Clerk account (for authentication)
 
npm installCopy .env.example to .env and fill in your values:
DATABASE_URL=postgres://user:password@localhost:5432/amazon_clone
CLERK_SECRET_KEY=your-clerk-secret-key
CLERK_PUBLISHABLE_KEY=your-clerk-publishable-key
CLERK_JWT_KEY=
STRIPE_SECRET_KEY=
STRIPE_PUBLISHABLE_KEY=
- Development (with live reload):
npm run dev
 - Production:
npm run build && npm start 
To generate and apply migrations, use:
npm run migrate:generate # Generate migration files from schema
npm run migrate:push     # Apply migrations to your databaseMake sure your DATABASE_URL is set in your .env file before running migrations.
GET /health— Returns{ status: 'ok' }
GET /articles— List all articlesGET /articles/:id— Get a single article by IDPOST /articles— Create a new article (with optional image upload)PATCH /articles/:id— Update an articleDELETE /articles/:id— Delete an articleGET /articles/image/:imageUrl— Serve an article image by filenameGET /articles/glb/:glbUrl— Serve a GLB file by filename
POST /orders/payment-sheet— Create a Stripe payment sheet (for mobile payments)GET /orders— List orders for the authenticated userGET /orders/all— List all orders (admin, no auth)GET /orders/:id— Get a specific order by IDPOST /orders— Create a new order (authenticated user)PATCH /orders/:id— Update an order (e.g., items or status)
POST /webhooks/clerk— Handles Clerk user creation events
Playstation GLB from https://sketchfab.com/3d-models/ps5-d788de3735964151a3e24fd59c0f1956