Web Installation
1 Prerequisites
Section titled “1 Prerequisites”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.devor your custom domain)
2 Clone the Repository
Section titled “2 Clone the Repository”git clone https://github.com/https://github.com/IranNetworkState/web.gitcd web3 Environment Configuration
Section titled “3 Environment Configuration”Create a .env file in the root directory with the following environment variables:
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.
4 Install Dependencies
Section titled “4 Install Dependencies”# Using pnpmpnpm install5 Local Development
Section titled “5 Local Development”Start the development server:
# Using pnpmpnpm devThe application will be available at http://localhost:4321 (default Astro port).
6 Build for Production
Section titled “6 Build for Production”Generate the production build:
# Using pnpmpnpm buildThis creates optimized static files in the dist/ directory.
7 Cloudflare Deployment (Recommended)
Section titled “7 Cloudflare Deployment (Recommended)”7.1 Cloudflare Pages Setup
Section titled “7.1 Cloudflare Pages Setup”-
Connect Repository:
- Go to Cloudflare Dashboard
- Navigate to Pages → Create a project
- Connect your Git repository (GitHub/GitLab)
-
Build Configuration:
Framework preset: AstroBuild command: npm run buildBuild output directory: distRoot directory: / (or your frontend directory) -
Environment Variables:
- In Cloudflare Pages settings, add:
PUBLIC_BASE_URL:https://api.irannation.dev
- In Cloudflare Pages settings, add:
7.2 Custom Domain Setup
Section titled “7.2 Custom Domain Setup”-
Add Domain:
- In Pages project settings → Custom domains
- Add your domain (e.g.,
irannation.dev)
-
DNS Configuration:
- Update your domain’s nameservers to Cloudflare
- Or create CNAME record pointing to your Pages deployment
7.3 Build Optimization
Section titled “7.3 Build Optimization”Cloudflare automatically provides:
- Global CDN: Fast content delivery worldwide
- Automatic HTTPS: SSL certificates
- Build Caching: Faster subsequent builds
- Preview Deployments: For branches and PRs
8 Verification
Section titled “8 Verification”After deployment, verify the installation:
- Frontend Access: Visit your deployed domain
- API Connection: Check that frontend connects to
BASE_URL - SSL Certificate: Ensure HTTPS is working