Skip to content

Web Installation

Before starting, ensure you have:

  • Node.js: v18+ (LTS recommended)
  • npm/yarn/pnpm: Latest version
  • Git: v2.30+
  • Cloudflare Account: For deployment and hosting
  • Domain Name: For frontend access (irannation.dev or your custom domain)
Terminal window
git clone https://github.com/https://github.com/IranNetworkState/web.git
cd web

Create a .env file in the root directory with the following environment variables:

Terminal window
PUBLIC_BASE_URL=https://api.irannation.dev

📝 Note: In Astro, environment variables prefixed with PUBLIC_ are exposed to the client-side code, while others remain server-side only.

Terminal window
# Using pnpm
pnpm install

Start the development server:

Terminal window
# Using pnpm
pnpm dev

The application will be available at http://localhost:4321 (default Astro port).

Generate the production build:

Terminal window
# Using pnpm
pnpm build

This creates optimized static files in the dist/ directory.

  1. Connect Repository:

    • Go to Cloudflare Dashboard
    • Navigate to PagesCreate a project
    • Connect your Git repository (GitHub/GitLab)
  2. Build Configuration:

    Framework preset: Astro
    Build command: npm run build
    Build output directory: dist
    Root directory: / (or your frontend directory)
  3. Environment Variables:

    • In Cloudflare Pages settings, add:
      • PUBLIC_BASE_URL: https://api.irannation.dev
  1. Add Domain:

    • In Pages project settings → Custom domains
    • Add your domain (e.g., irannation.dev)
  2. DNS Configuration:

    • Update your domain’s nameservers to Cloudflare
    • Or create CNAME record pointing to your Pages deployment

Cloudflare automatically provides:

  • Global CDN: Fast content delivery worldwide
  • Automatic HTTPS: SSL certificates
  • Build Caching: Faster subsequent builds
  • Preview Deployments: For branches and PRs

After deployment, verify the installation:

  1. Frontend Access: Visit your deployed domain
  2. API Connection: Check that frontend connects to BASE_URL
  3. SSL Certificate: Ensure HTTPS is working