https://github.com/magnusmay/astro-worker-assets
A template for building high-performance Astro applications with Cloudflare Workers and Assets. Optimized for developer experience and global content delivery.
https://github.com/magnusmay/astro-worker-assets
astro cdn cloudflare-workers performance serverless static-site template typescript web-development
Last synced: about 1 year ago
JSON representation
A template for building high-performance Astro applications with Cloudflare Workers and Assets. Optimized for developer experience and global content delivery.
- Host: GitHub
- URL: https://github.com/magnusmay/astro-worker-assets
- Owner: magnusmay
- Created: 2025-02-17T11:38:58.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-17T11:40:01.000Z (over 1 year ago)
- Last Synced: 2025-02-17T12:38:09.373Z (over 1 year ago)
- Topics: astro, cdn, cloudflare-workers, performance, serverless, static-site, template, typescript, web-development
- Language: Astro
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AstroWorkerAssets
A template for building Astro applications with Cloudflare Workers and Assets, optimized for performance and developer experience.
## Features
- 🚀 [Astro](https://astro.build) for fast, content-focused websites
- ⚡️ [Cloudflare Workers](https://workers.cloudflare.com/) for serverless deployment
- 📦 Asset handling with Cloudflare's global CDN
- 🔧 TypeScript support out of the box
- 🛠️ Development tools:
- Wrangler for local development and deployment
- Smart placement for optimal performance
- Built-in observability
## Prerequisites
- Node.js (Latest LTS version recommended)
- [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/install-and-update/) installed globally
- A Cloudflare account
## Getting Started
1. Create a new project using this template:
```bash
git clone https://github.com/yourusername/astro-worker-assets.git my-project
cd my-project
```
2. Install dependencies:
```bash
npm install
```
3. Generate Worker types:
```bash
npm run types
```
4. Start the development server:
```bash
npm run dev
```
## Scripts
- `npm run dev` - Start the Astro development server
- `npm run build` - Build the project for production
- `npm run preview` - Preview the production build locally using Wrangler
- `npm run deploy` - Deploy to Cloudflare Workers
- `npm run types` - Generate TypeScript types for Cloudflare Workers
## Project Structure
```
/
├── src/
│ ├── components/
│ ├── layouts/
│ └── pages/
├── public/
│ └── .assetsignore # Assets to exclude from deployment
├── astro.config.mjs # Astro configuration
├── wrangler.jsonc # Cloudflare Workers configuration
└── tsconfig.json # TypeScript configuration
```
## Configuration
### Astro Configuration
The project uses `@astrojs/cloudflare` adapter with platform proxy enabled. You can modify the configuration in `astro.config.mjs`.
### Cloudflare Workers Configuration
The `wrangler.jsonc` file contains all the Cloudflare Workers-specific configuration:
- Asset binding for static files
- Node.js compatibility settings
- Smart placement for optimal performance
- Observability settings
## Deployment
1. Make sure you're logged in to Cloudflare:
```bash
wrangler login
```
2. Deploy your application:
```bash
npm run deploy
```
## Development
- The development server runs on `http://localhost:4321` by default
- Changes to files in `src/` will trigger hot module replacement
- The `preview` command will build and run your application locally using Wrangler
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## License
MIT License - feel free to use this template for your own projects.
## Support
For questions and support:
- [Astro Documentation](https://docs.astro.build)
- [Cloudflare Workers Documentation](https://developers.cloudflare.com/workers/)
- [Create an issue](https://github.com/yourusername/astro-worker-assets/issues)