Compare commits
30 Commits
remove-day
...
dce993322b
| Author | SHA1 | Date | |
|---|---|---|---|
| dce993322b | |||
| 873dbd00be | |||
| e29b31f25e | |||
| 9534954bcb | |||
| 8ae8de3a03 | |||
| db8834f9eb | |||
| 348082ad96 | |||
| b7cd0c5997 | |||
| fbb20bada4 | |||
| da82680270 | |||
| 1168cb5c9f | |||
| b165e29e45 | |||
| 81ec91a73f | |||
| 8f14b93817 | |||
| 02fc5f9baa | |||
| 27b87dcc12 | |||
| ef4e314475 | |||
| a6794cdfed | |||
| 38b3ad9326 | |||
| a6f5710521 | |||
| cb0252e1af | |||
| f2937a762e | |||
| 60daac48b4 | |||
| b2a655f73a | |||
| 663081d719 | |||
| 28460a6bac | |||
| 3039d66295 | |||
| 9b96e8f0a5 | |||
| b86b737a82 | |||
| f2951985c2 |
@@ -1,6 +1,6 @@
|
|||||||
FROM golang:1.23.5@sha256:8c10f21bec412f08f73aa7b97ca5ac5f28a39d8a88030ad8a339fd0a781d72b4 AS builder_go
|
FROM golang:1.24.1@sha256:52ff1b35ff8de185bf9fd26c70077190cd0bed1e9f16a2d498ce907e5c421268 AS builder_go
|
||||||
WORKDIR /web-app-template
|
WORKDIR /web-app-template
|
||||||
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.62.2
|
RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||||
RUN go install github.com/a-h/templ/cmd/templ@latest
|
RUN go install github.com/a-h/templ/cmd/templ@latest
|
||||||
RUN go install github.com/vektra/mockery/v2@latest
|
RUN go install github.com/vektra/mockery/v2@latest
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
@@ -13,7 +13,7 @@ RUN golangci-lint run ./...
|
|||||||
RUN go build -o /web-app-template/web-app-template .
|
RUN go build -o /web-app-template/web-app-template .
|
||||||
|
|
||||||
|
|
||||||
FROM node:22.13.1@sha256:ae2f3d4cc65d251352eca01ba668824f651a2ee4d2a37e2efb22649521a483fd AS builder_node
|
FROM node:22.14.0@sha256:c7fd844945a76eeaa83cb372e4d289b4a30b478a1c80e16c685b62c54156285b AS builder_node
|
||||||
WORKDIR /web-app-template
|
WORKDIR /web-app-template
|
||||||
COPY package.json package-lock.json ./
|
COPY package.json package-lock.json ./
|
||||||
RUN npm clean-install
|
RUN npm clean-install
|
||||||
@@ -21,7 +21,7 @@ COPY . ./
|
|||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
|
||||||
FROM debian:12.9@sha256:321341744acb788e251ebd374aecc1a42d60ce65da7bd4ee9207ff6be6686a62
|
FROM debian:12.10@sha256:18023f131f52fc3ea21973cabffe0b216c60b417fd2478e94d9d59981ebba6af
|
||||||
WORKDIR /web-app-template
|
WORKDIR /web-app-template
|
||||||
RUN apt-get update && apt-get install -y ca-certificates && echo "" > .env
|
RUN apt-get update && apt-get install -y ca-certificates && echo "" > .env
|
||||||
COPY migration ./migration
|
COPY migration ./migration
|
||||||
|
|||||||
14
Readme.md
14
Readme.md
@@ -7,11 +7,11 @@ A basic template with authentication to easily host on a VPC.
|
|||||||
|
|
||||||
This template includes everything essential to build an app. It includes the following features:
|
This template includes everything essential to build an app. It includes the following features:
|
||||||
|
|
||||||
- Authentication: Users can login, logout, register and reset their password. For increased security TOTP is available aswell.
|
- Authentication: Users can login, logout, register and reset their password. (for increased security TOTP is planned aswell.)
|
||||||
- Observability: The stack contains an Grafana+Prometheus instance for basic monitoring. You are able to add alerts and get notified on your phone.
|
- Observability: The stack contains an Grafana+Prometheus instance for basic monitoring. You are able to add alerts and get notified on your phone.
|
||||||
- Mail: You are able to send mail with SMTP. You still need an external Mail Server, but a guide on how to set that up with a custom domain is included.
|
- Mail: You are able to send mail with SMTP. You still need an external Mail Server, but a guide on how to set that up with a custom domain is included.
|
||||||
- SSL: This is included by using traefik as reverse proxy. It handles SSL certificates automatically. Furthermore all services are accessible through subdomains. Best thing is, you can add your more with 3 lines of code
|
- SSL: This is included by using traefik as reverse proxy. It handles SSL certificates automatically. Furthermore all services are accessible through subdomains.
|
||||||
- Actual Stack: Tailwindcss + HTMX + DaisyUI + GO Backend with templ and sqlite
|
- Stack: Tailwindcss + HTMX + GO Backend with templ and sqlite
|
||||||
|
|
||||||
|
|
||||||
## Architecture Design Decisions
|
## Architecture Design Decisions
|
||||||
@@ -51,13 +51,13 @@ Instead of implementing authentication from scratch, an external OAuth2 provider
|
|||||||
|
|
||||||
Pros:
|
Pros:
|
||||||
- The Systems of BigTech are probably safer. They have security experts employed.
|
- The Systems of BigTech are probably safer. They have security experts employed.
|
||||||
- The other external system needs to prevent credential stuffing attacks, etc.
|
- The other external system is responsible to prevent credential stuffing attacks, etc.
|
||||||
- Users don't have to create new credentials
|
- Users don't have to create new credentials
|
||||||
Cons:
|
Cons:
|
||||||
- High dependency on those providers
|
- High dependency on those providers
|
||||||
- Single Point of failure (If your account is banned, your application access get's lost as well)
|
- Single Point of failure (If your account is banned, your application access get's lost as well.)
|
||||||
- It's possible that these providers ban the whole application
|
- It's possible that these providers ban the whole application (All users lose access)
|
||||||
- There still needs to be implemented some logic server side
|
- There still needs to be implemented some logic
|
||||||
- Full application integration can be difficult
|
- Full application integration can be difficult
|
||||||
|
|
||||||
#### 3. Using OAuth2 with Keycloak
|
#### 3. Using OAuth2 with Keycloak
|
||||||
|
|||||||
20
go.mod
20
go.mod
@@ -1,19 +1,19 @@
|
|||||||
module web-app-template
|
module web-app-template
|
||||||
|
|
||||||
go 1.23
|
go 1.23.0
|
||||||
|
|
||||||
toolchain go1.23.5
|
toolchain go1.24.1
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/a-h/templ v0.3.833
|
github.com/a-h/templ v0.3.856
|
||||||
github.com/golang-migrate/migrate/v4 v4.18.2
|
github.com/golang-migrate/migrate/v4 v4.18.2
|
||||||
github.com/google/uuid v1.6.0
|
github.com/google/uuid v1.6.0
|
||||||
github.com/joho/godotenv v1.5.1
|
github.com/joho/godotenv v1.5.1
|
||||||
github.com/mattn/go-sqlite3 v1.14.24
|
github.com/mattn/go-sqlite3 v1.14.24
|
||||||
github.com/prometheus/client_golang v1.20.5
|
github.com/prometheus/client_golang v1.21.1
|
||||||
github.com/stretchr/testify v1.10.0
|
github.com/stretchr/testify v1.10.0
|
||||||
golang.org/x/crypto v0.32.0
|
golang.org/x/crypto v0.36.0
|
||||||
golang.org/x/net v0.34.0
|
golang.org/x/net v0.37.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@@ -22,15 +22,15 @@ require (
|
|||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||||
github.com/klauspost/compress v1.17.9 // indirect
|
github.com/klauspost/compress v1.17.11 // indirect
|
||||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/prometheus/client_model v0.6.1 // indirect
|
github.com/prometheus/client_model v0.6.1 // indirect
|
||||||
github.com/prometheus/common v0.55.0 // indirect
|
github.com/prometheus/common v0.62.0 // indirect
|
||||||
github.com/prometheus/procfs v0.15.1 // indirect
|
github.com/prometheus/procfs v0.15.1 // indirect
|
||||||
github.com/stretchr/objx v0.5.2 // indirect
|
github.com/stretchr/objx v0.5.2 // indirect
|
||||||
go.uber.org/atomic v1.11.0 // indirect
|
go.uber.org/atomic v1.11.0 // indirect
|
||||||
golang.org/x/sys v0.29.0 // indirect
|
golang.org/x/sys v0.31.0 // indirect
|
||||||
google.golang.org/protobuf v1.34.2 // indirect
|
google.golang.org/protobuf v1.36.1 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
32
go.sum
32
go.sum
@@ -1,5 +1,5 @@
|
|||||||
github.com/a-h/templ v0.3.833 h1:L/KOk/0VvVTBegtE0fp2RJQiBm7/52Zxv5fqlEHiQUU=
|
github.com/a-h/templ v0.3.856 h1:rMSlGIaQCqctylqM49VinpN7LlrptrFj0dMbYDj9GEQ=
|
||||||
github.com/a-h/templ v0.3.833/go.mod h1:cAu4AiZhtJfBjMY0HASlyzvkrtjnHWPeEsyGK2YYmfk=
|
github.com/a-h/templ v0.3.856/go.mod h1:qhrhAkRFubE7khxLZHsBFHfX+gWwVNKbzKeF9GlPV4M=
|
||||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||||
@@ -19,8 +19,8 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l
|
|||||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||||
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
||||||
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
||||||
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
|
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
||||||
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
|
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
||||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
@@ -35,12 +35,12 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
|
|||||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
|
github.com/prometheus/client_golang v1.21.1 h1:DOvXXTqVzvkIewV/CDPFdejpMCGeMcbGCQ8YOmu+Ibk=
|
||||||
github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
|
github.com/prometheus/client_golang v1.21.1/go.mod h1:U9NM32ykUErtVBxdvD3zfi+EuFkkaBvMb09mIfe0Zgg=
|
||||||
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
|
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
|
||||||
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
|
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
|
||||||
github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc=
|
github.com/prometheus/common v0.62.0 h1:xasJaQlnWAeyHdUBeGjXmutelfJHWMRr+Fg4QszZ2Io=
|
||||||
github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8=
|
github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkqml0W5zIY1I=
|
||||||
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
||||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||||
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
|
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
|
||||||
@@ -51,14 +51,14 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf
|
|||||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
|
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
|
||||||
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
|
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
|
||||||
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
|
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
|
||||||
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
|
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
|
||||||
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
|
golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=
|
||||||
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
|
golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
||||||
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
|
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
|
||||||
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
|
google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk=
|
||||||
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
|
google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
|
|||||||
18
input.css
Normal file
18
input.css
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
@import 'tailwindcss';
|
||||||
|
|
||||||
|
@source './static/**/*.js';
|
||||||
|
@source './template/**/*.templ';
|
||||||
|
|
||||||
|
@theme {
|
||||||
|
--animate-fade: fadeOut 0.25s ease-in;
|
||||||
|
|
||||||
|
@keyframes fadeOut {
|
||||||
|
0% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
10
main_test.go
10
main_test.go
@@ -333,7 +333,7 @@ func TestIntegrationAuth(t *testing.T) {
|
|||||||
resp, err = httpClient.Do(req)
|
resp, err = httpClient.Do(req)
|
||||||
timeEnd := time.Now()
|
timeEnd := time.Now()
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
if timeEnd.Sub(timeStart) > 253*time.Millisecond || timeEnd.Sub(timeStart) <= 250*time.Millisecond {
|
if timeEnd.Sub(timeStart) > 260*time.Millisecond || timeEnd.Sub(timeStart) <= 250*time.Millisecond {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
t.Logf("Time did not match: %v", timeEnd.Sub(timeStart))
|
t.Logf("Time did not match: %v", timeEnd.Sub(timeStart))
|
||||||
}
|
}
|
||||||
@@ -367,7 +367,7 @@ func TestIntegrationAuth(t *testing.T) {
|
|||||||
resp, err = httpClient.Do(req)
|
resp, err = httpClient.Do(req)
|
||||||
timeEnd = time.Now()
|
timeEnd = time.Now()
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
if timeEnd.Sub(timeStart) > 253*time.Millisecond || timeEnd.Sub(timeStart) <= 250*time.Millisecond {
|
if timeEnd.Sub(timeStart) > 260*time.Millisecond || timeEnd.Sub(timeStart) <= 250*time.Millisecond {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
t.Logf("Time did not match: %v", timeEnd.Sub(timeStart))
|
t.Logf("Time did not match: %v", timeEnd.Sub(timeStart))
|
||||||
}
|
}
|
||||||
@@ -401,7 +401,7 @@ func TestIntegrationAuth(t *testing.T) {
|
|||||||
resp, err = httpClient.Do(req)
|
resp, err = httpClient.Do(req)
|
||||||
timeEnd = time.Now()
|
timeEnd = time.Now()
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
if timeEnd.Sub(timeStart) > 253*time.Millisecond || timeEnd.Sub(timeStart) <= 250*time.Millisecond {
|
if timeEnd.Sub(timeStart) > 260*time.Millisecond || timeEnd.Sub(timeStart) <= 250*time.Millisecond {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
t.Logf("Time did not match: %v", timeEnd.Sub(timeStart))
|
t.Logf("Time did not match: %v", timeEnd.Sub(timeStart))
|
||||||
}
|
}
|
||||||
@@ -571,7 +571,7 @@ func TestIntegrationAuth(t *testing.T) {
|
|||||||
timeEnd := time.Now()
|
timeEnd := time.Now()
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
timeTaken := timeEnd.Sub(timeStart)
|
timeTaken := timeEnd.Sub(timeStart)
|
||||||
assert.LessOrEqual(t, timeTaken, 253*time.Millisecond)
|
assert.LessOrEqual(t, timeTaken, 260*time.Millisecond)
|
||||||
assert.GreaterOrEqual(t, timeTaken, 250*time.Millisecond)
|
assert.GreaterOrEqual(t, timeTaken, 250*time.Millisecond)
|
||||||
|
|
||||||
assert.Equal(t, http.StatusOK, resp.StatusCode)
|
assert.Equal(t, http.StatusOK, resp.StatusCode)
|
||||||
@@ -608,7 +608,7 @@ func TestIntegrationAuth(t *testing.T) {
|
|||||||
timeEnd := time.Now()
|
timeEnd := time.Now()
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
timeTaken := timeEnd.Sub(timeStart)
|
timeTaken := timeEnd.Sub(timeStart)
|
||||||
assert.LessOrEqual(t, timeTaken, 253*time.Millisecond)
|
assert.LessOrEqual(t, timeTaken, 260*time.Millisecond)
|
||||||
assert.GreaterOrEqual(t, timeTaken, 250*time.Millisecond)
|
assert.GreaterOrEqual(t, timeTaken, 250*time.Millisecond)
|
||||||
|
|
||||||
assert.Equal(t, http.StatusOK, resp.StatusCode)
|
assert.Equal(t, http.StatusOK, resp.StatusCode)
|
||||||
|
|||||||
2073
package-lock.json
generated
2073
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -4,16 +4,15 @@
|
|||||||
"description": "Your (almost) independent tech stack to host on a VPC.",
|
"description": "Your (almost) independent tech stack to host on a VPC.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "mkdir -p static/js && cp -f node_modules/htmx.org/dist/htmx.min.js static/js/htmx.min.js && tailwindcss build -o static/css/tailwind.css --minify",
|
"build": "mkdir -p static/js && cp -f node_modules/htmx.org/dist/htmx.min.js static/js/htmx.min.js && tailwindcss -i input.css -o static/css/tailwind.css --minify",
|
||||||
"watch": "mkdir -p static/js && cp -f node_modules/htmx.org/dist/htmx.min.js static/js/htmx.min.js && tailwindcss build -o static/css/tailwind.css --watch",
|
"watch": "mkdir -p static/js && cp -f node_modules/htmx.org/dist/htmx.min.js static/js/htmx.min.js && tailwindcss -i input.css -o static/css/tailwind.css --watch"
|
||||||
"test": ""
|
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"htmx.org": "2.0.4",
|
"htmx.org": "2.0.4",
|
||||||
"tailwindcss": "3.4.17",
|
"tailwindcss": "4.0.15",
|
||||||
"daisyui": "4.12.23"
|
"@tailwindcss/cli": "4.0.15"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
/** @type {import('tailwindcss').Config} */
|
|
||||||
module.exports = {
|
|
||||||
content: ["./template/**/*.templ", "./static/**/*.js"],
|
|
||||||
theme: {
|
|
||||||
extend: {
|
|
||||||
|
|
||||||
animation: {
|
|
||||||
fade: 'fadeOut 0.25s ease-in',
|
|
||||||
},
|
|
||||||
|
|
||||||
keyframes: _ => ({
|
|
||||||
fadeOut: {
|
|
||||||
'0%': { opacity: '1' },
|
|
||||||
'100%': { opacity: '0' },
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
require('daisyui'),
|
|
||||||
],
|
|
||||||
daisyui: {
|
|
||||||
themes: ["retro"],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ templ DeleteAccountComp() {
|
|||||||
<p class="text-xl text-red-500 mb-4">
|
<p class="text-xl text-red-500 mb-4">
|
||||||
Are you sure you want to delete your account? This action is irreversible.
|
Are you sure you want to delete your account? This action is irreversible.
|
||||||
</p>
|
</p>
|
||||||
<label class="input input-bordered flex items-center gap-2">
|
<label class="flex items-center gap-2">
|
||||||
<input
|
<input
|
||||||
type="password"
|
type="password"
|
||||||
class="grow"
|
class="grow"
|
||||||
@@ -24,7 +24,7 @@ templ DeleteAccountComp() {
|
|||||||
autocapitalize="off"
|
autocapitalize="off"
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<button class="btn btn-error self-end">
|
<button class="self-end">
|
||||||
Delete Account
|
Delete Account
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package auth
|
|||||||
templ UserComp(user string) {
|
templ UserComp(user string) {
|
||||||
<div id="user-info" class="flex gap-5 items-center">
|
<div id="user-info" class="flex gap-5 items-center">
|
||||||
if user != "" {
|
if user != "" {
|
||||||
<div class="group inline-block relative">
|
<div class="inline-block relative">
|
||||||
<button class="font-semibold py-2 px-4 inline-flex items-center">
|
<button class="font-semibold py-2 px-4 inline-flex items-center">
|
||||||
<span class="mr-1">{ user }</span>
|
<span class="mr-1">{ user }</span>
|
||||||
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
|
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
|
||||||
@@ -11,20 +11,20 @@ templ UserComp(user string) {
|
|||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
<div class="absolute hidden group-hover:block w-full">
|
<div class="absolute hidden group-hover:block w-full">
|
||||||
<ul class="menu bg-base-300 rounded-box w-fit float-right mr-4 p-3">
|
<ul class="w-fit float-right mr-4 p-3">
|
||||||
<li class="mb-1">
|
<li class="mb-1">
|
||||||
<a hx-post="/api/auth/signout" hx-target="#user-info">Sign Out</a>
|
<a hx-post="/api/auth/signout" hx-target="#user-info">Sign Out</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="mb-1">
|
<li class="mb-1">
|
||||||
<a href="/auth/change-password">Change Password</a>
|
<a href="/auth/change-password">Change Password</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="/auth/delete-account" class="text-error">Delete Account</a></li>
|
<li><a href="/auth/delete-account" class="">Delete Account</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
} else {
|
} else {
|
||||||
<a href="/auth/signup" class="btn btn-sm">Sign Up</a>
|
<a href="/auth/signup" class="">Sign Up</a>
|
||||||
<a href="/auth/signin" class="btn btn-sm">Sign In</a>
|
<a href="/auth/signin" class="">Sign In</a>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ templ VerifyComp() {
|
|||||||
<p class="text-lg text-center">
|
<p class="text-lg text-center">
|
||||||
Please check your inbox/spam and click on the link to verify your account.
|
Please check your inbox/spam and click on the link to verify your account.
|
||||||
</p>
|
</p>
|
||||||
<button class="btn mt-8" hx-get="/api/auth/verify-resend" hx-sync="this:drop" hx-swap="outerHTML">
|
<button class="mt-8" hx-get="/api/auth/verify-resend" hx-sync="this:drop" hx-swap="outerHTML">
|
||||||
resend verification email
|
resend verification email
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ templ VerifyResponseComp(isVerified bool) {
|
|||||||
<p class="text-lg text-center">
|
<p class="text-lg text-center">
|
||||||
You have completed the verification process. Thank you!
|
You have completed the verification process. Thank you!
|
||||||
</p>
|
</p>
|
||||||
<a class="btn btn-primary mt-8" href="/">
|
<a class="mt-8" href="/">
|
||||||
Go Home
|
Go Home
|
||||||
</a>
|
</a>
|
||||||
} else {
|
} else {
|
||||||
@@ -20,7 +20,7 @@ templ VerifyResponseComp(isVerified bool) {
|
|||||||
<p class="text-lg text-center">
|
<p class="text-lg text-center">
|
||||||
Please try again by sign up process
|
Please try again by sign up process
|
||||||
</p>
|
</p>
|
||||||
<a class="btn btn-primary mt-8" href="/auth/signup">
|
<a class="mt-8" href="/auth/signup">
|
||||||
Sign Up
|
Sign Up
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
package template
|
package template
|
||||||
|
|
||||||
templ Index() {
|
templ Index() {
|
||||||
<div class="hero bg-base-200 h-full">
|
<div class="h-full">
|
||||||
<div class="hero-content text-center">
|
<div class="text-center">
|
||||||
<div class="max-w-md">
|
<div class="max-w-md">
|
||||||
<h1 class="text-5xl font-bold">Next Level Workout Tracker</h1>
|
<h1 class="text-5xl font-bold">Next Level Workout Tracker</h1>
|
||||||
<p class="py-6">
|
<p class="py-6">
|
||||||
Ever wanted to track your workouts and see your progress over time? web-app-template is the perfect
|
Ever wanted to track your workouts and see your progress over time? web-app-template is the perfect
|
||||||
solution for you.
|
solution for you.
|
||||||
</p>
|
</p>
|
||||||
<a href="/workout" class="btn btn-primary">Get Started</a>
|
<a href="/workout" class="">Get Started</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,25 +3,26 @@ package template
|
|||||||
templ Layout(slot templ.Component, user templ.Component) {
|
templ Layout(slot templ.Component, user templ.Component) {
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<title>web-app-template</title>
|
<title>web-app-template</title>
|
||||||
<link rel="icon" href="/static/favicon.svg"/>
|
<link rel="icon" href="/static/favicon.svg"/>
|
||||||
<link rel="stylesheet" href="/static/css/tailwind.css"/>
|
<link rel="stylesheet" href="/static/css/tailwind.css"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||||
<meta name="htmx-config" content='{
|
<meta
|
||||||
|
name="htmx-config"
|
||||||
|
content='{
|
||||||
"includeIndicatorStyles": false,
|
"includeIndicatorStyles": false,
|
||||||
"selfRequestsOnly": true,
|
"selfRequestsOnly": true,
|
||||||
"allowScriptTags": false
|
"allowScriptTags": false
|
||||||
}' />
|
}'
|
||||||
|
/>
|
||||||
<script src="/static/js/htmx.min.js"></script>
|
<script src="/static/js/htmx.min.js"></script>
|
||||||
<script src="/static/js/toast.js"></script>
|
<script src="/static/js/toast.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body hx-headers='{"csrf-token": "CSRF_TOKEN"}'>
|
<body hx-headers='{"csrf-token": "CSRF_TOKEN"}'>
|
||||||
<div class="h-screen flex flex-col">
|
<div class="h-screen flex flex-col">
|
||||||
<div class="flex justify-end items-center gap-2 py-1 px-2 h-12 md:gap-10 md:px-10 md:py-2 shadow">
|
<div class="flex justify-end items-center gap-2 py-1 px-2 h-12 md:gap-10 md:px-10 md:py-2 shadow-sm">
|
||||||
<a href="/" class="flex-1 flex gap-2">
|
<a href="/" class="flex-1 flex gap-2">
|
||||||
<img src="/static/favicon.svg" alt="web-app-template logo"/>
|
<img src="/static/favicon.svg" alt="web-app-template logo"/>
|
||||||
<span>web-app-template</span>
|
<span>web-app-template</span>
|
||||||
@@ -34,12 +35,11 @@ templ Layout(slot templ.Component, user templ.Component) {
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="toast" id="toasts">
|
<div class="" id="toasts">
|
||||||
<div class="hidden alert" id="toast">
|
<div class="hidden" id="toast">
|
||||||
New message arrived.
|
New message arrived.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package template
|
|||||||
|
|
||||||
templ NotFound() {
|
templ NotFound() {
|
||||||
<main class="flex h-full justify-center items-center">
|
<main class="flex h-full justify-center items-center">
|
||||||
<div class="bg-error p-16 rounded-lg">
|
<div class="p-16 rounded-lg">
|
||||||
<h1 class="text-4xl text-error-content mb-5">Not Found</h1>
|
<h1 class="text-4xl mb-5">Not Found</h1>
|
||||||
<p class="text-lg text-error-content mb-5">The page you are looking for does not exist.</p>
|
<p class="text-lg mb-5">The page you are looking for does not exist.</p>
|
||||||
<a href="/" class="btn btn-lg btn-primary">Go back to home</a>
|
<a href="/" class="">Go back to home</a>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,17 +2,21 @@ package workout
|
|||||||
|
|
||||||
templ WorkoutComp(currentDate string) {
|
templ WorkoutComp(currentDate string) {
|
||||||
<main class="mx-2">
|
<main class="mx-2">
|
||||||
<form class="max-w-xl mx-auto flex flex-col gap-4 justify-center mt-10" hx-post="/api/workout"
|
<form
|
||||||
hx-target="#workout-placeholder" hx-swap="outerHTML">
|
class="max-w-xl mx-auto flex flex-col gap-4 justify-center mt-10"
|
||||||
|
hx-post="/api/workout"
|
||||||
|
hx-target="#workout-placeholder"
|
||||||
|
hx-swap="outerHTML"
|
||||||
|
>
|
||||||
<h2 class="text-4xl mb-8">Track your workout</h2>
|
<h2 class="text-4xl mb-8">Track your workout</h2>
|
||||||
<input id="date" type="date" class="input input-bordered" value={ currentDate } name="date" />
|
<input id="date" type="date" class="" value={ currentDate } name="date"/>
|
||||||
<select class="select select-bordered w-full" name="type">
|
<select class="w-full" name="type">
|
||||||
<option>Push Ups</option>
|
<option>Push Ups</option>
|
||||||
<option>Pull Ups</option>
|
<option>Pull Ups</option>
|
||||||
</select>
|
</select>
|
||||||
<input type="number" class="input input-bordered" placeholder="Sets" name="sets" />
|
<input type="number" class="" placeholder="Sets" name="sets"/>
|
||||||
<input type="number" class="input input-bordered" placeholder="Reps" name="reps" />
|
<input type="number" class="" placeholder="Reps" name="reps"/>
|
||||||
<button class="btn btn-primary self-end">Save</button>
|
<button class="self-end">Save</button>
|
||||||
</form>
|
</form>
|
||||||
<div hx-get="/api/workout" hx-trigger="load"></div>
|
<div hx-get="/api/workout" hx-trigger="load"></div>
|
||||||
</main>
|
</main>
|
||||||
@@ -27,7 +31,7 @@ Reps string
|
|||||||
}
|
}
|
||||||
|
|
||||||
templ WorkoutListComp(workouts []Workout) {
|
templ WorkoutListComp(workouts []Workout) {
|
||||||
<div class="overflow-x-auto mx-auto max-w-screen-lg">
|
<div class="overflow-x-auto mx-auto max-w-lg">
|
||||||
<h2 class="text-4xl mt-14 mb-8">Workout history</h2>
|
<h2 class="text-4xl mt-14 mb-8">Workout history</h2>
|
||||||
<table class="table table-auto max-w-full">
|
<table class="table table-auto max-w-full">
|
||||||
<thead>
|
<thead>
|
||||||
|
|||||||
Reference in New Issue
Block a user