Deployment and subdomains
Deploy your app wherever suits you, then request a hasanat.dev subdomain if you want one. A maintainer connects it in the way that fits your host.
Deploying the starter
Section titled “Deploying the starter”The starter uses Astro 5 with Cloudflare Pages: wrangler.toml contains pages_build_output_dir = "./dist". You need a Cloudflare account, then:
npx wrangler loginnpm run buildnpx wrangler pages deploy dist/- Set the project name in
wrangler.toml, plusPUBLIC_SITE_URLandPUBLIC_APP_NAMEunder[vars]. - Shared sign-in needs no secrets. If your app needs a secret of its own, set it with
npx wrangler pages secret put NAME, never in the repository. - The starter’s
public/_headersfile adds basic security headers to every page. - Deploy only after
npm run checkandnpm run buildpass.
Automatic deploys from GitHub
Section titled “Automatic deploys from GitHub”You can deploy on every merge to the main branch with GitHub Actions:
name: Deployon: push: branches: [main]
jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 22 - run: npm ci - run: npm run build - uses: cloudflare/wrangler-action@v3 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} command: pages deploy dist/ --project-name=your-app-nameStore CLOUDFLARE_API_TOKEN as a secret in the repository’s GitHub settings, never in the code.
Request a subdomain
Section titled “Request a subdomain”Request a “subdomain” from the platform dashboard once your app works. Include:
- The name you want: lowercase letters, digits, and hyphens, one level only, such as
your-app.hasanat.dev. Shared sign-in does not accept two-level names such asapp.your-app.hasanat.dev. - Where the app runs: a Cloudflare Pages project or Worker, and in which account, or another host.
- Its current URL: for example
your-app.pages.dev.
How the subdomain is connected
Section titled “How the subdomain is connected”Worker in the Hasanat account
Section titled “Worker in the Hasanat account”- You: nothing.
- The maintainer: adds the name as a Custom Domain on the Worker; Cloudflare creates the DNS record and certificate.
Pages project in the Hasanat account
Section titled “Pages project in the Hasanat account”- You: nothing.
- The maintainer: adds the domain in the project’s settings; Cloudflare creates the DNS record.
Pages project in your account
Section titled “Pages project in your account”- You: add the domain first: Workers & Pages → your project → Custom domains → Set up a domain.
- The maintainer: adds a CNAME record pointing to
your-app.pages.dev.
Another host, such as Vercel or Netlify
Section titled “Another host, such as Vercel or Netlify”- You: add the domain in the host’s settings, and copy the records it asks for into the request.
- The maintainer: adds the DNS records the host asked for.
Worker in your own Cloudflare account
Section titled “Worker in your own Cloudflare account”It cannot be connected directly: Cloudflare requires the Worker to be in the account that owns the hasanat.dev zone. Agree in the request on deploying to Pages or to the Hasanat account.
After it is connected, open https://name.hasanat.dev and check that the page loads with a valid certificate. If your app uses shared sign-in, try it now: it does not work on localhost, *.pages.dev, or *.workers.dev.
Hosting outside Cloudflare
Section titled “Hosting outside Cloudflare”You don’t have to use Cloudflare. Deploy your app anywhere and request a subdomain that points to it. Shared sign-in works when the app is served on its hasanat.dev subdomain and its server asks the auth service for the session, as described in sign-in.