Skip to content

Commit

Permalink
Improve README
Browse files Browse the repository at this point in the history
  • Loading branch information
benvinegar committed Dec 31, 2023
1 parent 392d0fe commit a12aa53
Showing 1 changed file with 29 additions and 15 deletions.
44 changes: 29 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,44 @@
# Welcome to Remix!
# Counterscale

- [Remix Docs](https://remix.run/docs)
Counterscale is a simple web analytics tracker and dashboard that you self-host on Cloudflare.

It's designed to be easy to deploy and maintain, and should cost you near-zero to operate – even at high levels of traffic (i.e. in the millions of pageviews/month).

## Prerequisites

You need a Cloudflare account, and have enabled [Cloudflare Analytics Engine beta](https://developers.cloudflare.com/analytics/analytics-engine/get-started/).

## Configuration

You need to create a [Clouflare API token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/). This token needs `Account.Account Analytics` permissions.

Once you have the token, and your Cloudflare account ID, you need to:

1. Copy `.dev.vars.example` to `.dev.vars`
2. Add `CF_BEARER_TOKEN` (this is your API token)
3. Add `CF_ACCOUNT_ID` (this is your Cloudflare account ID)
4. Open up the Cloudflare Dashboard (web), and add both values as environment variables

## Development

You will be running two processes during development:
Install dependencies using `npm`:

```sh
npm install
```

Counterscale is built on Remix and Cloudflare Workers. In development, you'll run two servers:

- The Miniflare server (miniflare is a local environment for Cloudflare Workers)
- The Remix development server
- The Miniflare server (local environment for Cloudflare Workers)

Both are started with one command:
You run both using:

```sh
npm run dev
```

Open up [http://127.0.0.1:8787](http://127.0.0.1:8787) and you should be ready to go!
Afterwards, the dashboard should be visible at [http://127.0.0.1:8787](http://127.0.0.1:8787).

If you want to check the production build, you can stop the dev server and run following commands:

Expand All @@ -26,15 +49,6 @@ npm start

Then refresh the same URL in your browser (no live reload for production builds).

## Cloudflare Config

You need to create a [Clouflare API token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/). This token needs `Account.Account Analytics` permissions.

Once you have the token, and your Cloudflare account ID, you need to:

1. Specify both values in `.dev.vars`
2. Add both values as environment variables to your Cloudflare project's settings.

## Deployment

If you don't already have an account, then [create a cloudflare account here](https://dash.cloudflare.com/sign-up) and after verifying your email address with Cloudflare, go to your dashboard and set up your free custom Cloudflare Workers subdomain.
Expand Down

0 comments on commit a12aa53

Please sign in to comment.