Skip to content

๐Ÿณ Opinionated recipe to use as a template for building fast dynamic web applications with cutting-edge technologies.

License

Notifications You must be signed in to change notification settings

AaronBeaudoin/omelette

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation


๐Ÿณ Omelette

Omelette is an opinionated recipe that demonstrates how to build a fast dynamic website/application. It was created as a foundation for a real-world ecommerce website and jump-starts you with:

  • A flexible architecture suitable for production websites.
  • Hand-picked tools and libraries for painless development.
  • A cost-effective and scalable preset deployment platform.

Core Ingredients

  • ๐Ÿฏ โ€” brillout/vite-plugin-ssr โ€”ย The binding agent that makes everything stick!
  • ๐Ÿฅ˜ โ€” vitejs/vite โ€”ย The base that gives the recipe its delicious flavor.
  • ๐Ÿซ โ€” vuejs/core โ€” The sweetener that makes the recipe so good.
  • ๐Ÿ‡ โ€” unocss/unocss โ€” The garnish for decorating the recipe.
  • ๐Ÿฝ โ€” Cloudflare Workers โ€”ย The dish for serving the recipe.

For a less silly deep dive into the reasoning behind why these ingredients were chosen over potential alternatives, see the chemistry section below. The section also explains some of the recipe's custom features.


๐Ÿ“™ Table of Contents


๐Ÿฃ Getting Started

  1. Clone this repository.

    $ git clone https://github.com/AaronBeaudoin/omelette
    
  2. Install project dependencies.

    $ npm install
    
  3. Run the development setup.

    $ npm run dev
    
  4. Explore the project and make it your own! โœจ


๐Ÿš€ Deployment

  1. Create a Cloudflare account here if you don't already have one. After doing so, make sure to go to the Workers page in the dashboard and complete the setup steps.

  2. Login to Wrangler, the CLI for working with Cloudflare Workers.

    $ npx wrangler login
    
  3. Create a Workers KV namespace for production and another one for preview.

    $ npx wrangler kv:namespace create PRODUCTION
    $ npx wrangler kv:namespace create PREVIEW
    
  4. Bind the namespaces to FUNCTIONS in your worker environment. To do this, replace id under [[kv_namespaces]] in your wrangler.toml config with the ID of the PRODUCTION namespace you just created and replace preview_id with the ID of the PREVIEW namespace.

    [[kv_namespaces]]
    id = "<your-production-namespace-id-here>"
    preview_id = "<your-preview-namespace-id-here>"
    binding = "FUNCTIONS"

    The ID for each namespace should be in the terminal output under each command from the last step. If you can't find them, you can easily get them again via another command.

    $ npx wrangler kv:namespace list
    
  5. Update the name of your worker in your wrangler.toml config to whatever you want.

  6. Create a Workers Secret named SECRET to enable function ?preview= and ?refresh=.

    $ npx wrangler secret put SECRET
    
  7. Preview your build output before actually deploying, if you want.

    $ npm run preview
    
  8. Deploy your project and sit back and relax! Watch a movie. Whatever you want! ๐Ÿน

    $ npm run deploy
    

Deploy on Push โ€” Optional

  1. Create an API token in your Cloudflare account here. If you're not sure exactly what permissions you want, just use the Edit Cloudflare Workers template.

  2. Copy the token into a GitHub Secret called CLOUDFLARE_API_TOKEN under your repository.

  3. Copy your account ID into a GitHub Secret called CLOUDFLARE_ACCOUNT_ID under your repository. You can find your Cloudflare account ID on the right hand side of the Workers page in the dashboard.

  4. Push a new commit! From now on, pushing to the main branch of your repository should use the .github/workflows/deploy.yaml GitHub Action to deploy your project automatically!


๐Ÿฅผ The Chemistry

This section is a work in progress.

About

๐Ÿณ Opinionated recipe to use as a template for building fast dynamic web applications with cutting-edge technologies.

Topics

Resources

License

Stars

Watchers

Forks