| name | flyio-hello-world |
| description | Deploy your first app to Fly.io with flyctl launch and the Machines API.
Use when starting a new Fly.io project, deploying a container globally,
or testing edge compute deployment.
Trigger: "fly.io hello world", "fly launch", "deploy to fly.io", "first fly app".
|
| allowed-tools | Read, Write, Edit, Bash(fly:*), Bash(curl:*), Bash(docker:*) |
| version | 1.6.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","edge-compute","flyio"] |
| compatibility | Designed for Claude Code |
Fly.io Hello World
Overview
Deploy a minimal app to Fly.io using fly launch. Fly.io runs Docker containers on Firecracker microVMs across 30+ regions worldwide. Two paths: flyctl CLI (simple) or Machines API (programmatic).
Instructions
Step 1: Launch with flyctl
mkdir fly-hello && cd fly-hello
cat > Dockerfile << 'EOF'
FROM node:20-alpine
WORKDIR /app
COPY server.js .
EXPOSE 3000
CMD ["node", "server.js"]
EOF
cat > server.js << 'EOF'
const http = require('http');
const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({
message: 'Hello from Fly.io!',
region: process.env.FLY_REGION,
app: process.env.FLY_APP_NAME,
}));
});
server.listen(3000, () => console.log('Listening on :3000'));
EOF
fly launch --name hello-fly --region iad --now
Step 2: Verify Deployment
fly status
fly open
fly logs
curl https://hello-fly.fly.dev/
Step 3: Deploy via Machines API
const FLY_API = 'https://api.machines.dev';
const headers = {
'Authorization': `Bearer ${process.env.FLY_API_TOKEN}`,
'Content-Type': 'application/json',
};
const app = await (, {
: ,
headers,
: .({
: ,
: ,
}),
}).( r.());
machine = (, {
: ,
headers,
: .({
: ,
: {
: ,
: [{
: [{ : , : [, ] }],
: ,
: ,
}],
: { : , : , : },
},
}),
}).( r.());
.();