A minimal Python backend API service based on Flask framework, optimized for Vercel deployment.
- 🚀 Simple RESTful API based on Flask
- ⚡ Lightweight with minimal dependencies
- 📦 Optimized for Vercel deployment
- 🔍 Health check endpoint for monitoring
python-backend-Vercel/
├── app.py # Flask application main file
├── requirements.txt # Python dependencies (minimal)
├── vercel.json # Vercel deployment configuration
└── README.md # Project documentation
# Clone the repository
git clone <your-repo-url>
cd python-backend-Vercel
# Install dependencies
pip install -r requirements.txt
# Run locally
python app.pyThe service will start at http://localhost:5000
- Push your code to GitHub
- Connect your GitHub repository to Vercel
- Vercel will automatically deploy
# Install Vercel CLI
npm install -g vercel
# Deploy
vercel deploy --prodGET /- Service informationGET /api/health- Health check
curl https://your-app.vercel.app/Response:
{
"name": "Python Backend API Service",
"description": "Universal Python backend API service",
"version": "1.0.0",
"endpoints": {
"health": "/api/health"
}
}curl https://your-app.vercel.app/api/healthResponse:
{
"status": "success",
"message": "API service is running normally",
"version": "1.0.0"
}- Flask 3.0.0 - Web framework
- Flask-CORS 4.0.0 - Cross-Origin Resource Sharing support
- Package Size: Optimized to stay under Vercel's 250MB limit
- Runtime: Python 3.9+ (automatically detected by Vercel)
- Cold Start: Fast startup due to minimal dependencies
To add new endpoints, simply add new routes to app.py:
@app.route('/api/new-endpoint', methods=['GET'])
def new_endpoint():
return jsonify({
'message': 'New endpoint working!'
})The API includes built-in error handling for:
- 404 - Endpoint not found
- 500 - Internal server error
MIT License