init biff project

This commit is contained in:
Travis Shears 2025-06-04 10:47:38 +02:00
commit c652b828e8
26 changed files with 1220 additions and 0 deletions

64
resources/config.edn Normal file
View file

@ -0,0 +1,64 @@
;; See https://github.com/juxt/aero and https://biffweb.com/docs/api/utilities/#use-aero-config.
;; #biff/env and #biff/secret will load values from the environment and from config.env.
{:biff/base-url #profile {:prod #join ["https://" #biff/env DOMAIN]
:default #join ["http://localhost:" #ref [:biff/port]]}
:biff/host #or [#biff/env "HOST"
#profile {:dev "0.0.0.0"
:default "localhost"}]
:biff/port #long #or [#biff/env "PORT" 8080]
:biff.xtdb/dir "storage/xtdb"
:biff.xtdb/topology #keyword #or [#profile {:prod #biff/env "PROD_XTDB_TOPOLOGY"
:default #biff/env "XTDB_TOPOLOGY"}
"standalone"]
:biff.xtdb.jdbc/jdbcUrl #biff/secret "XTDB_JDBC_URL"
:biff.beholder/enabled #profile {:dev true :default false}
:biff.beholder/paths ["src" "resources" "test"]
:biff/eval-paths ["src" "test"]
:biff.middleware/secure #profile {:dev false :default true}
:biff.middleware/cookie-secret #biff/secret COOKIE_SECRET
:biff/jwt-secret #biff/secret JWT_SECRET
:biff.refresh/enabled #profile {:dev true :default false}
:mailersend/api-key #biff/secret MAILERSEND_API_KEY
:mailersend/from #biff/env MAILERSEND_FROM
:mailersend/reply-to #biff/env MAILERSEND_REPLY_TO
:recaptcha/secret-key #biff/secret RECAPTCHA_SECRET_KEY
:recaptcha/site-key #biff/env RECAPTCHA_SITE_KEY
:biff.nrepl/port #or [#biff/env NREPL_PORT "7888"]
:biff.nrepl/args ["--port" #ref [:biff.nrepl/port]
"--middleware" "[cider.nrepl/cider-middleware,refactor-nrepl.middleware/wrap-refactor]"]
:biff.system-properties/user.timezone "UTC"
:biff.system-properties/clojure.tools.logging.factory "clojure.tools.logging.impl/slf4j-factory"
:biff.tasks/server #biff/env DOMAIN
:biff.tasks/main-ns snippets
:biff.tasks/on-soft-deploy "\"(snippets/on-save @snippets/system)\""
:biff.tasks/generate-assets-fn snippets/generate-assets!
:biff.tasks/css-output "target/resources/public/css/main.css"
:biff.tasks/deploy-untracked-files [#ref [:biff.tasks/css-output]
"config.env"]
;; `clj -M:dev prod-dev` will run the soft-deploy task whenever files in these directories are changed.
:biff.tasks/watch-dirs ["src" "dev" "resources" "test"]
;; The version of the Taliwind standalone bin to install. See `clj -M:dev css -h`. If you change
;; this, run `rm bin/tailwindcss; clj -M:dev install-tailwind`.
:biff.tasks/tailwind-version "v3.4.17"
;; :rsync is the default if rsync is on the path; otherwise :git is the default. Set this to :git
;; if you have rsync on the path but still want to deploy with git.
;; :biff.tasks/deploy-with :rsync
;; Uncomment this line if you're deploying with git and your local branch is called main instead of
;; master:
;; :biff.tasks/git-deploy-cmd ["git" "push" "prod" "main:master"]
:biff.tasks/git-deploy-cmd ["git" "push" "prod" "master"]
;; Uncomment this line if you have any ssh-related problems:
;; :biff.tasks/skip-ssh-agent true
}

View file

@ -0,0 +1,34 @@
# This file contains config that is not checked into git. See resources/config.edn for more config
# options.
# Where will your app be deployed?
DOMAIN=example.com
# Mailersend is used to send email sign-in links. Sign up at https://www.mailersend.com/
MAILERSEND_API_KEY=
# This must be an email address that uses the same domain that you've verified in MailerSend.
MAILERSEND_FROM=
# This is where emails will be sent when users hit reply. It can be any email address.
MAILERSEND_REPLY_TO=
# Recaptcha is used to protect your sign-in page from bots. Go to
# https://www.google.com/recaptcha/about/ and add a site. Select v2 invisible. Add localhost and the
# value of DOMAIN above to your list of allowed domains.
RECAPTCHA_SITE_KEY=
RECAPTCHA_SECRET_KEY=
XTDB_TOPOLOGY=standalone
# Uncomment these to use Postgres for storage in production:
#PROD_XTDB_TOPOLOGY=jdbc
#XTDB_JDBC_URL=jdbc:postgresql://host:port/dbname?user=alice&password=abc123&sslmode=require
# What port should the nrepl server be started on (in dev and prod)?
NREPL_PORT=7888
## Autogenerated. Create new secrets with `clj -M:dev generate-secrets`
# Used to encrypt session cookies.
COOKIE_SECRET={{ new-secret 16 }}
# Used to encrypt email sign-in links.
JWT_SECRET={{ new-secret 32 }}

10
resources/fixtures.edn Normal file
View file

@ -0,0 +1,10 @@
;; Biff transaction. See https://biffweb.com/docs/reference/transactions/
[{:db/doc-type :user
:xt/id :db.id/user-a
:user/email "a@example.com"
:user/foo "Some Value"
:user/joined-at :db/now}
{:db/doc-type :msg
:msg/user :db.id/user-a
:msg/text "hello there"
:msg/sent-at :db/now}]

Binary file not shown.

View file

@ -0,0 +1 @@
// When plain htmx isn't quite enough, you can stick some custom JS here.

View file

@ -0,0 +1,12 @@
module.exports = {
content: [
'./src/**/*',
'./resources/**/*',
],
theme: {
extend: {},
},
plugins: [
require('@tailwindcss/forms'),
],
}

35
resources/tailwind.css Normal file
View file

@ -0,0 +1,35 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
p {
@apply mb-3;
}
ul {
@apply list-disc;
}
ol {
@apply list-decimal;
}
ul, ol {
@apply my-3 pl-10;
}
}
@layer components {
.btn {
@apply bg-blue-500 hover:bg-blue-700 text-center py-2 px-4 rounded disabled:opacity-50 text-white;
}
}
@layer utilities {
.link {
@apply text-blue-600 hover:underline;
}
}
.grecaptcha-badge { visibility: hidden; }