Skip to content

Instantly share code, notes, and snippets.

@cedricvidal
Created December 28, 2025 17:12
Show Gist options
  • Select an option

  • Save cedricvidal/8761a53a7117b5ac1cc1224fd2b9a7d2 to your computer and use it in GitHub Desktop.

Select an option

Save cedricvidal/8761a53a7117b5ac1cc1224fd2b9a7d2 to your computer and use it in GitHub Desktop.
API Backend for iOS Mobile app prompt

Now that my iPhone mobile app is working as intented functionally, I need to persist the data of my users using my own backend API and database instead of locally on the iPhone.

Create a Next.js API backend for this iOS mobile app with the following stack and structure:

Tech Stack

  • Next.js with App Router (API routes only, no frontend pages needed)
  • Neon PostgreSQL database
  • Drizzle ORM for database access
  • NextAuth with Auth0 provider for authentication
  • TypeScript with strict mode
  • Deploy to Vercel

Authentication

Auth0 must be configured to protect the API and authenticate users of the iOS mobile app.

Database schema

Analyse the code of the mobile app and create the database schema required to store the user's data in the database instead of locally on the phone.

Project Structure

/app/api/ # API routes /lib/db/ # Database configuration

  • index.ts # Drizzle client setup
  • schema.ts # Database schema definitions /lib/auth.ts # NextAuth configuration /lib/permissions.ts # Authorization utilities /drizzle/ # Migration files /types/ # TypeScript type augmentations
  • next-auth.d.ts # Extended session types

Generate all the boilerplate files with this structure, ready to customize for my specific data model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment