Back to Templates

Node Functions on EdgeOne Pages - Koa Demo Website

A demonstration website for function requests developed with Next.js + Tailwind CSS + shadcn/ui technology stack, showcasing how to deploy and run Node Functions based on the Koa framework on EdgeOne Pages.

View Demo
A demonstration website for function requests developed with Next.js + Tailwind CSS + shadcn/ui technology stack, showcasing how to deploy and run Node Functions based on the Koa framework on EdgeOne Pages.

Node Functions on EdgeOne Pages - Koa Demo Website

A demonstration website for function requests developed with Next.js + Tailwind CSS + shadcn/ui technology stack, showcasing how to deploy and run Node Functions based on the Koa framework on EdgeOne Pages.

๐Ÿš€ Features

  • Modern UI Design๏ผšAdopting a black background with white text theme, using #1c66e5 as the accent color
  • Responsive Layout๏ผšSupporting desktop and mobile devices, providing the best user experience
  • Real-time API Demo๏ผšIntegrating Express backend, supporting real-time function call testing
  • Componentized Architecture๏ผšUsing shadcn/ui style component system
  • TypeScript Support๏ผšComplete type definitions and type safety

๐Ÿ› ๏ธ Technology Stack

Frontend

  • Next.js 15 - React full-stack framework
  • React 19 - User interface library
  • TypeScript - Type-safe JavaScript
  • Tailwind CSS 4 - Utility-first CSS framework

UI Components

  • shadcn/ui - High-quality React components
  • Lucide React - Beautiful icon library
  • class-variance-authority - Component style variant management
  • clsx & tailwind-merge - CSS class name merging tool

Backend

  • Express.js - Node.js Web application framework
  • Node Functions - EdgeOne Pages serverless function

๐Ÿ“ Project Structure

express-template/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ app/                 # Next.js App Router
โ”‚   โ”‚   โ”œโ”€โ”€ globals.css     # Global styles
โ”‚   โ”‚   โ”œโ”€โ”€ layout.tsx      # Root layout
โ”‚   โ”‚   โ””โ”€โ”€ page.tsx        # Main page
โ”‚   โ”œโ”€โ”€ components/         # React components
โ”‚   โ”‚   โ””โ”€โ”€ ui/            # UI basic components
โ”‚   โ”‚       โ”œโ”€โ”€ button.tsx  # Button component
โ”‚   โ”‚       โ””โ”€โ”€ card.tsx    # Card component
โ”‚   โ””โ”€โ”€ lib/               # Utility functions
โ”‚       โ””โ”€โ”€ utils.ts       # General utilities
โ”œโ”€โ”€ public/                # Static resources
โ”œโ”€โ”€ package.json           # Project configuration
โ””โ”€โ”€ README.md             # Project documentation

๐Ÿš€ Quick Start

Environment Requirements

  • Node.js 18+
  • npm or yarn

Install Dependencies

npm install
# or
yarn install

Development Mode

edgeone pages dev

Access http://localhost:8088 to view the application.

Build Production Version

edgeone pages build

๐ŸŽฏ Core Features

1. Main Page Display

  • Project title and description
  • One-click deployment and documentation view button
  • Express code example display

2. API Call Demo

  • Real-time function call testing
  • Loading status display
  • Result display

3. Responsive Design

  • Mobile-friendly layout
  • Adaptive component sizing
  • Touch-friendly interaction

๐Ÿ”ง Configuration Explanation

Tailwind CSS Configuration

The project uses Tailwind CSS 4, supporting custom color variables:

:root {
  --primary: #1c66e5;        /* Primary color */
  --background: #000000;     /* Background color */
  --foreground: #ffffff;     /* Foreground color */
}

Component Style

Using class-variance-authority to manage component style variants, supporting multiple preset styles.

๐Ÿ“š Documentation Entry

๐Ÿš€ Deployment Guide

EdgeOne Pages Deployment

  1. Push the code to a GitHub repository
  2. Create a new project in the EdgeOne Pages console
  3. Select the GitHub repository as the source
  4. Configure the build command: npm run build
  5. Configure the output directory: .next
  6. Deploy the project

Node Functions Configuration

Create a node-functions/ folder in the project root directory, adding an Express application:

// node-functions/express/[[default]].js
import express from "express";
const app = express();

app.get("/", (req, res) => {
  res.json({ message: "Hello from Express on Node Functions!" });
});

export default app;

๐Ÿ“„ License

This project uses the MIT License - see the LICENSE file for details.