Skip to main content

Installation

Learn how to install Edge-Utils and integrate it into your edge computing project.

Package Installation

npm

yarn

pnpm

Deno

Platform-Specific Setup

Cloudflare Workers

  1. Install Wrangler CLI (if not already installed):
  1. Create a new project:
  1. Install Edge-Utils:
  1. Configure wrangler.toml:
  1. Example usage in src/index.js:

Vercel Edge Functions

  1. Install Vercel CLI (if not already installed):
  1. Create a new project:
  1. Install Edge-Utils:
  1. Create an edge function in api/graphql.js:
  1. Set environment variables:

Deno Deploy

  1. Install Deno CLI (if not already installed):
  1. Create a new project:
  1. Create deno.json:
  1. Create main.ts:
  1. Deploy to Deno Deploy:

TypeScript Support

Edge-Utils comes with full TypeScript support. If you’re using TypeScript, the types will be automatically available.

TypeScript Configuration

For optimal TypeScript experience, ensure your tsconfig.json includes:

Bundle Size Optimization

Edge-Utils is designed to be lightweight. You can import only the utilities you need:

Environment Variables

Set up the following environment variables for your deployment:

Required

  • GRAPHQL_ENDPOINT - Your GraphQL API endpoint
  • JWT_SECRET - Secret key for JWT token signing

Optional

  • REDIS_URL - Redis URL for distributed caching
  • DATABASE_URL - Database connection string
  • API_KEYS - Comma-separated list of API keys

Testing Your Installation

Create a simple test file to verify your installation:
Run the test:

Troubleshooting

Common Issues

Module not found error
  • Ensure you’ve installed the package correctly
  • Check that your import paths are correct
  • For Deno, verify the import URL in deno.json
TypeScript errors
  • Update your TypeScript version to 4.5+
  • Check your tsconfig.json configuration
  • Ensure you’re importing types correctly
Runtime errors
  • Verify environment variables are set
  • Check network connectivity to external APIs
  • Ensure your edge platform supports all Web APIs used

Getting Help

Next Steps

Now that you have Edge-Utils installed, check out: