Deploying a Next.js application at 3 different budgets

Written by Sam Haakman, Full-Stack Developer

Two women at a computer
Josephmark Studio

1. Static Deploy @ 1c/mo

Static Deploy — Breeder Studio

The stack

pipelines:
branches:
main:
- step:
name: Build & Export site to HTML
caches:
- node
- next
image: node:17-alpine
script:
- npm i --production
- npm run build
- npm run export
artifacts:
- out/**
- step:
name: Push Site to S3
deployment: production
image: atlassian/pipelines-awscli:latest
script:
- aws configure set aws_access_key_id "${AWS_ACCESS_KEY}"
- aws configure set aws_secret_access_key "${AWS_SECRET_ACCESS_KEY}"
- aws s3 sync --delete --exclude "*.html" --cache-control "public,max-age=31536000,immutable" out s3://${AWS_S3_BUCKET}
- aws s3 sync --delete --exclude "*" --include "*.html" out s3://${AWS_S3_BUCKET}
- step:
name: Purge Cloudflare
image: curlimages/curl
script:
- >
curl -X POST "<https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONE}/purge_cache>"
-H "Authorization: Bearer ${CLOUDFLARE_KEY}"
--data '{"purge_everything":true}'
definitions:
caches:
next: .next
const https = require("https")exports.handler = async (event) => {
const secret = JSON.parse(event?.body)?.secret
if (!secret) {
return {
statusCode: 401,
body: JSON.stringify({ message: "No auth found", request: event })
}
}
const data = await new Promise((resolve) => {
const req = https.request(
{
hostname: "api.bitbucket.org",
port: 443,
path: `/2.0/repositories/${process.env.BITBUCKET_REPOSITORY}/pipelines/`,
method: "POST",
headers: {
Authorization: `Basic ${secret}`,
"Content-Type": "application/json"
},
},
(resp) => {
let d = ''
resp.on("data", chunk => {
d += chunk
})
resp.on("end", () => {
resolve(d)
})
}
)
req.write(JSON.stringify({
target: {
ref_type: "branch",
type: "pipeline_ref_target",
ref_name: "main",
},
})
)
req.end()
})

const response = {
statusCode: data?.code || 200,
body: JSON.stringify({"message": "Yeah good", data, input: event}),
};
return response;
};

Pricing

2. Managed hosting @ $20/month

Managed Hosting — SWOP

The stack

pipelines:
branches:
main:
- step:
image: node:17-alpine
name: Prod Deploy
deployment: production
caches:
- node
script:
- npx vercel --prod -b BITBUCKET_COMMIT=$BITBUCKET_COMMIT -t $VERCEL_TOKEN

Pricing

3. Containerized Hosting @ $150+/month

Containerized Hosting — Josephmark

The stack

Pricing

By Sam Haakman, Full-Stack Developer

--

--

Design is our language. Venture is our mindset. We are Josephmark.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Josephmark

Design is our language. Venture is our mindset. We are Josephmark.