GithubHelp home page GithubHelp logo

fake-cloudflare-api's Introduction

fake-cloudflare-api

Warning: this repository is deprecated, use this Api instead

The "Fake Cloudflare API" is a tool designed to simplify the deployment of Cloudflare Workers by emulating the functionality of the Cloudflare API, allowing seamless integration with the default Cloudflare CLI, Wrangler.

Overview

  1. Installation
  2. Running the Server
  3. How to use
  4. How it works

Installation

First, clone this project: git clone https://github.com/clementreiffers/fake-cloudflare-api.git

Then navigate to the directory: cd fake-cloudflare-api and install all dependencies by running yarn or npm i

Use aws configure to connect to your S3 bucket.

Note: This example has been coded using Scaleway Object Storage, which is compatible with AWS S3. If you are using scaleway, follow this tutorial to proceed with the AWS CLI configuration.

Running the Server

You can run the server directly using: yarn start or npm start. There is also a dev mode available. Run: yarn dev or npm dev. It automatically restarts the server if you change a file using nodemon.

How to Use

Note: The login feature has not been implemented yet. Currently, the server only allows publishing code to a server.

Once you have implemented your first worker (see examples here), you can use this fake API.

Previously, when publishing to the Cloudflare server, you needed to use the wrangler publish command, which did it automatically.

Now, if you run this server using yarn start, you can run CLOUDFLARE_API_BASE_URL=http://YOUR_SERVER:3000/client/v4 wrangler publish. Wrangler will build your project and send it to the server. Then, the server will directly send it to your S3 bucket.

How It Works

Imagine someone who has finished coding their own Worker. They will use Wrangler to push their code, which in turn will fetch this API. This API will then publish the code directly to an S3 bucket.

once all code published, the fake API will call a Kubernetes controller to update the architecture. this feature can be deactivated.

Warning: the feature to call a Kubernetes Controller has not been implemented yet

flowchart LR
    subgraph Cloud 
        subgraph Kubernetes
            fake-cloudflare-api --> |trigger| capnp-generator 
            capnp-generator --> |trigger| build-step     
            build-step --> |trigger| deployment-step
        end
        fake-cloudflare-api --> |push code| S3
        capnp-generator --> |push capnp| S3
    end
    client --> wrangler --> |https| fake-cloudflare-api

fake-cloudflare-api's People

Contributors

clementreiffers avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.