Docs/architecture/Tech Stack

Tech Stack

NextShip is built with a modern, production-ready technology stack.

Core Framework

TechnologyVersionPurpose
Next.js16.xReact full-stack framework
React19.xUI library
TypeScript5.xType safety
pnpm9.xPackage manager

Frontend

UI & Styling

  • Tailwind CSS v4 - Atomic CSS with JIT compilation
  • shadcn/ui - Accessible, customizable components based on Radix UI
  • Lucide React - Beautiful icon library
  • Framer Motion - Declarative animations

State Management

LibraryPurpose
TanStack QueryServer state (API data caching)
ZustandClient state (UI state, preferences)
nuqsURL state (filters, pagination)

Backend

Database

  • Drizzle ORM - Lightweight, type-safe SQL ORM
  • Neon - Serverless PostgreSQL with branching

Why Drizzle over Prisma?

  • No Rust engine, lighter weight
  • SQL-like syntax, lower learning curve
  • Complete type inference without generation
  • Edge runtime compatible

Authentication

  • Better Auth - Modern auth library designed for Next.js
    • OAuth (Google, GitHub)
    • Email/password
    • Magic links
    • Two-factor authentication
    • Fully type-safe

Authorization (RBAC)

  • Casbin - Powerful, flexible access control
    • Role hierarchy (superadmin > admin > user)
    • Policy-based permissions
    • Dynamic policy management
    • Admin UI for permission management

Payments

ProviderFeatures
StripeSubscriptions, one-time payments, customer portal
CreemAlternative payment provider, same features

Configurable via PAYMENT_PROVIDER environment variable.

Credits System

  • SKU-based credit packages
  • Usage tracking per API call
  • Balance management with transactions

Email

  • Resend - Email delivery service
  • React Email - Build emails with React components

File Storage

  • Cloudflare R2 or AWS S3 - Object storage
  • Presigned URLs for secure uploads
  • Image optimization support

AI Gateway

  • API proxy for AI services (OpenAI, Anthropic, etc.)
  • Credit-based billing per request
  • Usage logging and analytics
  • Rate limiting

API Layer

TechnologyPurpose
Server ActionsType-safe server mutations
ZodSchema validation
API RoutesREST endpoints for external APIs

Infrastructure

ServicePurpose
VercelHosting and deployment
NeonServerless PostgreSQL
Cloudflare R2File storage
ResendEmail delivery

Development Tools

  • Biome - Fast linter and formatter (replaces ESLint + Prettier)
  • Drizzle Kit - Database migrations and studio
  • Velite - MDX content processing
  • TypeScript - Static type checking

Logging

  • Pino - Fast, structured logging
  • next-logger - Next.js log interception
  • pino-pretty - Development log formatting