A single serving website that provides random epigrams from Alan Perlis, built for fun.
Whenever I see one of these quotes, I tend to be impressed by how relevant a lot of them still seem, and how insane of a Twitter poster he'd probably have been if he was still around today.
Hosted with Fly.io, using Redis for vote tracking and reCAPTCHA for preventing abuse.
To test the entire application locally, run:
docker-compose up --build
Navigate to localhost:8080
to see the application, and localhost:8080/random
to get a random quote.
To stop the containers, run:
docker-compose down
For local development of the frontend against the live backend, set the NEXT_PUBLIC_API_URL
environment variable to https://perl.is
and run npm run dev
from the frontend
directory:
NEXT_PUBLIC_API_URL=https://perl.is npm run dev
Whenever you make changes to your TypeScript code, the browser will automatically refresh.
For local development of the backend, you can run the Go server directly with go run main.go
. But you must first ensure:
- The frontend has been built (
cd frontend && npm run build
) - You have an instance of Redis running locally. For example, you can run one with Docker:
docker run --name perlis-redis -d redis
- The
REDIS_URL
environment variable is set toredis://localhost:6379
. - The
RECAPTCHA_DISABLED
environment variable is set totrue
to disable reCAPTCHA.
(If you do want to use reCAPTCHA, you must set the RECAPTCHA_PROJECT_ID
and RECAPTCHA_KEY
environment variables to your Google Cloud Project ID and reCAPTCHA site key, respectively. You'll also need to authenticate locally with the gcloud CLI).
For hot reloading, you can use air to automatically restart the server when you make changes:
air -build.exclude_dir "frontend/node_modules"
Other helpful commands:
cd frontend && npm run build
- build the frontendcd frontend && npm run dev
- run the frontend locallyfly deploy
- deploy to Fly.iofly secrets
,fly certs
,fly redis
- manage Fly.io resources for this app