Edit this page

What is Photon?

⚠️ Beta Stage: Photon is currently in beta. APIs may change before stable release.

Photon is designed as an unopinionated and flexible alternative to Nitro, with support for universal server capabilities.

Philosophy

Photon follows these core principles:

Universal Server Support

Unlike other solutions that lock you into specific frameworks, Photon works with any server framework:

  • Hono - Ultrafast web framework for edge runtimes
  • Express - The most popular Node.js web framework
  • Fastify - High-performance web framework
  • Elysia - Bun-optimized framework with end-to-end type safety
  • H3 - Minimal and modern web framework
  • Hattip - Universal web framework built on Web Standards

Deploy Anywhere

Write once, deploy anywhere. Photon applications can be deployed to:

  • Edge Runtimes: Cloudflare Workers, Vercel Edge, Netlify Edge (coming soon)
  • Serverless: Vercel Functions, Netlify Functions (coming soon), AWS Lambda (coming soon)
  • Traditional Servers: Node.js, Docker, VPS
  • Static Hosting: GitHub Pages, Netlify, Vercel (for SSG)

Vite-Powered

Built on top of Vite's Environment API, Photon provides:

  • Hot Module Replacement for server code
  • Fast builds with Vite's optimized bundling
  • Rich ecosystem compatibility with Vite plugins

Key Features

Server Code Splitting

Each page and API route can be deployed as a separate function:

// Each route becomes its own deployable unit
export default {
  entries: {
    'api/users': './src/api/users.ts',
    'api/posts': './src/api/posts.ts',
    'pages/dashboard': './src/pages/dashboard.ts'
  }
}

Universal Middleware

Write middleware once, use everywhere:

// Works across all server frameworks
const authMiddleware = createUniversalMiddleware((context) => {
  // Universal middleware logic
})

Comparison

FeaturePhotonNitroNext.js
Server FrameworkAnyH3 onlyBuilt-in
Deployment TargetsUniversalUniversalVercel-focused
ArchitectureModularMonolithicMonolithic
Framework Lock-inNoneMinimalHigh
Edge Runtime
Code Splitting