Framework Recipes
Ready-to-use configurations and best practices for deploying your favorite frameworks on Tannur. Each recipe includes the correct build and start commands.
Next.js
Next.js with Tannur is a perfect combination. Automatic source maps, serverless functions, and image optimization all work out of the box.
Project Setup
Ensure your Next.js app has these scripts in package.json:
{
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
}
}Provisioning Command
curl -X POST https://api.tannur.xyz/api/projects/prj_xyz/provision \
-H "Authorization: Bearer $TANNUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"projectSlug": "my-nextjs-app",
"buildCommand": "npm run build",
"installCommand": "npm install",
"startCommand": "npm start"
}'Environment Variables
Set environment variables for your Next.js app:
curl -X POST https://api.tannur.xyz/api/projects/prj_xyz/env-vars \
-H "Authorization: Bearer $TANNUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"NEXT_PUBLIC_API_URL": "https://api.example.com",
"DATABASE_URL": "postgresql://...",
"NODE_ENV": "production"
}'Tip: Use NEXT_PUBLIC_* for client-side environment variables.
React (Vite)
Vite's blazing-fast build times and hot module reloading make it perfect for React development. Tannur handles the production build seamlessly.
package.json Scripts
{
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"lint": "eslint ."
}
}Tannur Provisioning
curl -X POST https://api.tannur.xyz/api/projects/prj_xyz/provision \
-H "Authorization: Bearer $TANNUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"projectSlug": "my-react-app",
"buildCommand": "npm run build",
"installCommand": "npm install",
"startCommand": "npm run preview"
}'Note: Vite builds output to dist/ by default. Tannur serves this automatically.
Python (Flask)
Deploy lightweight Python Flask applications with automatic dependency management through requirements.txt.
Project Structure
my-flask-app/ ├── app.py ├── requirements.txt ├── Procfile └── README.md
app.py Example
from flask import Flask, jsonify
import os
app = Flask(__name__)
port = int(os.environ.get('PORT', 5000))
@app.route('/')
def home():
return jsonify({"message": "Hello from Tannur!"})
if __name__ == '__main__':
app.run(host='0.0.0.0', port=port)Tannur Provisioning
curl -X POST https://api.tannur.xyz/api/projects/prj_xyz/provision \
-H "Authorization: Bearer $TANNUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"projectSlug": "my-flask-app",
"buildCommand": "pip install -r requirements.txt",
"installCommand": "pip install -r requirements.txt",
"startCommand": "python app.py"
}'Important: Your app must listen on the PORT environment variable (default 5000).
Go
Deploy high-performance Go applications. Tannur compiles Go binaries and runs them automatically.
main.go Example
package main
import (
"fmt"
"net/http"
"os"
)
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello from Tannur!")
})
fmt.Printf("Server running on port %s\n", port)
http.ListenAndServe(":"+port, nil)
}Tannur Provisioning
curl -X POST https://api.tannur.xyz/api/projects/prj_xyz/provision \
-H "Authorization: Bearer $TANNUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"projectSlug": "my-go-app",
"buildCommand": "go build -o server .",
"installCommand": "go mod download",
"startCommand": "./server"
}'Tip: Go binaries are incredibly fast and small. Perfect for edge deployment!
Best Practices
✅ Listen on PORT Environment Variable
Always read the PORT environment variable. Tannur sets this dynamically.
✅ Keep Build Times Short
Use .gitignore, .dockerignore, or build caching to speed up builds. Aim for under 3 minutes.
✅ Set Environment Variables Securely
Use the API or dashboard to set secrets. Never hardcode API keys or database URLs.
✅ Monitor Logs During Deployment
Use the logs endpoint to debug build failures and deployment issues in real-time.
✅ Test Locally First
Run your build and start commands locally to catch errors before deploying.
