Development Framework Guide
CloudBase HTTP cloud functions support multiple mainstream Web development frameworks, enabling you to rapidly build and deploy Web applications using familiar technology stacks. This guide introduces various supported frameworks and their characteristics to help you choose the most suitable development solution for your project requirements.
Supported Development Frameworks
JavaScript/TypeScript Frameworks
📄️ Express.js
A lightweight and flexible Node.js Web application framework, simple and easy to use with a rich ecosystem, ideal for rapid development of RESTful APIs and Web applications.
📄️ NestJS
An enterprise-level Node.js framework based on TypeScript, adopting modular design and dependency injection, suitable for building large-scale, maintainable backend applications.
📄️ Next.js
A full-stack React development framework that supports features such as SSR, SSG, and API routes, suitable for building modern full-stack Web applications.
Framework Features Comparison
| Framework | Type | Learning Curve | Applicable Scenarios | Key Features |
|---|---|---|---|---|
| Express.js | Micro-framework | Gentle | API services, small applications | Lightweight, flexible, rich middleware |
| NestJS | Enterprise-level framework | Moderate | Large-scale backend applications | TypeScript, dependency injection, modularity |
| Next.js | Full-stack framework | Moderate | Full-stack applications, SSR applications | React, SSR/SSG, API routes |
Python Frameworks
📄️ Django
A fully-featured Python Web framework with built-in ORM, admin backend, authentication, and other functionalities, suitable for rapid development of complex Web applications.
📄️ Flask
A lightweight Python Web micro-framework, concise and flexible with high extensibility, ideal for building API services and small-scale Web applications.
📄️ FastAPI
A modern, high-performance Python Web framework that supports automatic API documentation generation, type checking, and asynchronous processing, suitable for building high-performance APIs.
Framework Features Comparison
| Framework | Type | Learning Curve | Applicable Scenarios | Key Features |
|---|---|---|---|---|
| Django | Fully-featured framework | Moderate | Complex Web applications | ORM, Admin backend, comprehensive ecosystem |
| Flask | Micro-framework | Gentle | API services, small applications | Lightweight, flexible, extensible |
| FastAPI | Modern framework | Gentle | High-performance APIs | Asynchronous, type checking, automatic documentation |
How to Choose a Framework
Select Based on Project Requirements
🚀 Rapid Prototyping
- Recommended: Express.js, Flask
- Reasons: Gentle learning curve, fast development speed, suitable for quickly validating ideas
🏢 Enterprise-Grade Applications
- Recommended: NestJS, Django
- Reasons: Complete architecture, strong maintainability, suitable for team collaborative development
🌐 Full-Stack Applications
- Recommended: Next.js
- Reasons: Integrated frontend-backend, supports SSR/SSG, suitable for modern Web applications
⚡ High-Performance API
- Recommended: FastAPI, Express.js
- Reasons: Excellent performance, asynchronous support, suitable for high-concurrency scenarios
Select Based on Team Skills
JavaScript/TypeScript Team
- Preferred: Express.js (for simple projects), NestJS (for complex projects), Next.js (for full-stack projects)
- Advantages: Unified tech stack, reduces the learning curve
Python Team
- Preferred: Flask (simple projects), Django (complex projects), FastAPI (API projects)
- Advantages: Leverages the existing Python ecosystem and expertise
Deployment Requirements
All frameworks must meet the following requirements when deployed on CloudBase HTTP cloud functions:
General Requirements
- Port Configuration: The application must listen on port
9000 - Startup Script: The
scf_bootstrapstartup script must be provided. - Runtime: Node.js 16.13+, Python 3.8+, and other supported runtime versions
- Memory Limit: Select an appropriate memory configuration (128MB-3008MB) based on application complexity
Configuration Example
Node.js Application scf_bootstrap
#!/bin/sh
export PORT=9000
export NODE_ENV=production
npm start
Python Application scf_bootstrap
#!/bin/sh
export PORT=9000
python app.py