Skip to content

Commit f56acca

Browse files
committed
Initial commit
0 parents  commit f56acca

139 files changed

Lines changed: 32162 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.git
2+
.codex
3+
.agents
4+
.bin
5+
bin
6+
admin-api
7+
node_modules
8+
dist
9+
apps/admin-frontend/node_modules
10+
apps/admin-frontend/dist

.env.example

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Local development defaults for Push Booster.
2+
# Do not use these secrets or passwords in production.
3+
4+
LOG_LEVEL=info
5+
6+
POSTGRES_DATABASE_URL=postgres://push_booster:push_booster@localhost:5432/push_booster?sslmode=disable
7+
8+
CLICKHOUSE_URL=http://localhost:8123
9+
CLICKHOUSE_DATABASE=push_booster
10+
CLICKHOUSE_USER=push_booster
11+
CLICKHOUSE_PASSWORD=push_booster
12+
13+
REDIS_ADDR=localhost:6379
14+
REDIS_PASSWORD=
15+
REDIS_DB=0
16+
REDIS_TIMEOUT=5s
17+
18+
REDPANDA_BROKERS=localhost:19092,localhost:19093,localhost:19094
19+
20+
ADMIN_API_ADDR=:8080
21+
PUBLIC_API_ADDR=:8082
22+
PAYLOAD_API_ADDR=:8083
23+
24+
PUBLIC_API_BASE_URL=http://localhost:8082
25+
PAYLOAD_API_BASE_URL=http://localhost:8083
26+
27+
AUTH_ENV=local
28+
AUTH_ADMIN_EMAIL=admin@example.com
29+
AUTH_JWT_SECRET=change-me-local-dev-secret
30+
AUTH_JWT_ISSUER=push_booster-admin-api
31+
AUTH_JWT_AUDIENCE=push_booster-admin
32+
AUTH_DEV_RETURN_OTP=true
33+
AUTH_OTP_TTL_SECONDS=600
34+
AUTH_OTP_RATE_LIMIT_MINUTES=1
35+
AUTH_SESSION_TTL_HOURS=24
36+
AUTH_EMAIL_FROM=noreply@example.com
37+
AUTH_RESEND_API_KEY=
38+
AUTH_RESEND_API_URL=https://api.resend.com/emails
39+
AUTH_RESEND_MAX_ATTEMPTS=3
40+
AUTH_RESEND_RETRY_BACKOFF_MS=500
41+
42+
# Optional fallback for local Web Push. Prefer generated source-bound VAPID keys.
43+
VAPID_PUBLIC_KEY=
44+
VAPID_PRIVATE_KEY=
45+
46+
PUBLIC_EVENT_ID_TTL=24h
47+
PAYLOAD_TRIGGER_TTL=5m
48+
49+
SENDER_CONSUMER_GROUP=push_booster-sender
50+
SENDER_TRIGGER_TTL=5m
51+
SENDER_WEB_PUSH_SUBJECT=mailto:admin@example.com
52+
SENDER_WEB_PUSH_TTL_SECONDS=60
53+
SENDER_MAX_ATTEMPTS=3
54+
SENDER_CONCURRENCY=8
55+
SENDER_PROVIDER_RATE_LIMIT_PER_SECOND=50
56+
57+
SCHEDULER_TICK_INTERVAL=1m
58+
59+
CREATIVE_PROVIDER_FETCH_TIMEOUT=15s
60+
CREATIVE_PROVIDER_MAX_BODY_BYTES=2097152
61+
CREATIVE_PROVIDER_MAX_ATTEMPTS=2
62+
CREATIVE_PROVIDER_RETRY_BACKOFF_MS=500
63+
CREATIVE_PROVIDER_ALLOW_PRIVATE_FETCH_URLS=false
64+
65+
POSTGRES_MIGRATIONS_DIR=packages/go/migrations/postgres
66+
CLICKHOUSE_MIGRATIONS_DIR=packages/go/migrations/clickhouse

.github/workflows/ci.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
go:
11+
name: Go
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v5
19+
with:
20+
go-version-file: go.mod
21+
cache: true
22+
23+
- name: Test
24+
run: make test
25+
26+
frontend:
27+
name: Frontend
28+
runs-on: ubuntu-latest
29+
defaults:
30+
run:
31+
working-directory: apps/admin-frontend
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
36+
- name: Set up Node
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: 22
40+
cache: npm
41+
cache-dependency-path: apps/admin-frontend/package-lock.json
42+
43+
- name: Install dependencies
44+
run: npm ci
45+
46+
- name: Lint
47+
run: npm run lint
48+
49+
- name: Build
50+
run: npm run build

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.git/
2+
.codex/
3+
.agents/
4+
/admin-api
5+
/.bin/
6+
/bin/
7+
dist/
8+
node_modules/

LICENSE

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
Required Notice: Copyright (c) 2026 Push Booster contributors
2+
3+
# PolyForm Noncommercial License 1.0.0
4+
5+
<https://polyformproject.org/licenses/noncommercial/1.0.0>
6+
7+
## Acceptance
8+
9+
In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
10+
11+
## Copyright License
12+
13+
The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
14+
15+
## Distribution License
16+
17+
The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
18+
19+
## Notices
20+
21+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
22+
23+
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
24+
25+
## Changes and New Works License
26+
27+
The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
28+
29+
## Patent License
30+
31+
The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
32+
33+
## Noncommercial Purposes
34+
35+
Any noncommercial purpose is a permitted purpose.
36+
37+
## Personal Uses
38+
39+
Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
40+
41+
## Noncommercial Organizations
42+
43+
Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
44+
45+
## Fair Use
46+
47+
You may have "fair use" rights for the software under the law. These terms do not limit them.
48+
49+
## No Other Rights
50+
51+
These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
52+
53+
## Patent Defense
54+
55+
If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
56+
57+
## Violations
58+
59+
The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
60+
61+
## No Liability
62+
63+
***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
64+
65+
## Definitions
66+
67+
The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
68+
69+
**You** refers to the individual or entity agreeing to these terms.
70+
71+
**Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
72+
73+
**Your licenses** are all the licenses granted to you for the software under these terms.
74+
75+
**Use** means anything you do with the software requiring one of your licenses.

Makefile

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
GOFLAGS ?= -buildvcs=false
2+
GOCACHE ?= /tmp/push-booster-go-cache
3+
GOMODCACHE ?= /tmp/push-booster-go-mod-cache
4+
5+
POSTGRES_DATABASE_URL ?= postgres://push_booster:push_booster@localhost:5432/push_booster?sslmode=disable
6+
CLICKHOUSE_URL ?= http://localhost:8123
7+
CLICKHOUSE_DATABASE ?= push_booster
8+
CLICKHOUSE_USER ?= push_booster
9+
CLICKHOUSE_PASSWORD ?= push_booster
10+
11+
.PHONY: infra-up infra-down admin-api public-api payload-api sender scheduler admin-frontend frontend-lint frontend-build migrate-up migrate-status migrate-down migrate-clickhouse dev-seed vapid-keys test build-admin-api build-public-api build-payload-api build-sender build-scheduler build-migrator build-clickhouse-migrator
12+
13+
infra-up:
14+
docker compose -f deploy/docker-compose.yml up -d
15+
16+
infra-down:
17+
docker compose -f deploy/docker-compose.yml down
18+
19+
admin-api:
20+
GOFLAGS=$(GOFLAGS) GOCACHE=$(GOCACHE) GOMODCACHE=$(GOMODCACHE) go run ./apps/admin-api
21+
22+
public-api:
23+
GOFLAGS=$(GOFLAGS) GOCACHE=$(GOCACHE) GOMODCACHE=$(GOMODCACHE) go run ./apps/public-api
24+
25+
payload-api:
26+
GOFLAGS=$(GOFLAGS) GOCACHE=$(GOCACHE) GOMODCACHE=$(GOMODCACHE) go run ./apps/payload-api
27+
28+
sender:
29+
GOFLAGS=$(GOFLAGS) GOCACHE=$(GOCACHE) GOMODCACHE=$(GOMODCACHE) go run ./apps/sender
30+
31+
scheduler:
32+
GOFLAGS=$(GOFLAGS) GOCACHE=$(GOCACHE) GOMODCACHE=$(GOMODCACHE) go run ./apps/scheduler
33+
34+
admin-frontend:
35+
npm --prefix apps/admin-frontend run dev
36+
37+
frontend-lint:
38+
npm --prefix apps/admin-frontend run lint
39+
40+
frontend-build:
41+
npm --prefix apps/admin-frontend run build
42+
43+
migrate-up:
44+
POSTGRES_DATABASE_URL=$(POSTGRES_DATABASE_URL) GOFLAGS=$(GOFLAGS) GOCACHE=$(GOCACHE) GOMODCACHE=$(GOMODCACHE) go run ./apps/migrator up
45+
46+
migrate-status:
47+
POSTGRES_DATABASE_URL=$(POSTGRES_DATABASE_URL) GOFLAGS=$(GOFLAGS) GOCACHE=$(GOCACHE) GOMODCACHE=$(GOMODCACHE) go run ./apps/migrator status
48+
49+
migrate-down:
50+
POSTGRES_DATABASE_URL=$(POSTGRES_DATABASE_URL) GOFLAGS=$(GOFLAGS) GOCACHE=$(GOCACHE) GOMODCACHE=$(GOMODCACHE) go run ./apps/migrator down
51+
52+
migrate-clickhouse:
53+
CLICKHOUSE_URL=$(CLICKHOUSE_URL) CLICKHOUSE_DATABASE=$(CLICKHOUSE_DATABASE) CLICKHOUSE_USER=$(CLICKHOUSE_USER) CLICKHOUSE_PASSWORD=$(CLICKHOUSE_PASSWORD) GOFLAGS=$(GOFLAGS) GOCACHE=$(GOCACHE) GOMODCACHE=$(GOMODCACHE) go run ./apps/clickhouse-migrator
54+
55+
dev-seed:
56+
POSTGRES_DATABASE_URL=$(POSTGRES_DATABASE_URL) CLICKHOUSE_URL=$(CLICKHOUSE_URL) CLICKHOUSE_DATABASE=$(CLICKHOUSE_DATABASE) CLICKHOUSE_USER=$(CLICKHOUSE_USER) CLICKHOUSE_PASSWORD=$(CLICKHOUSE_PASSWORD) GOFLAGS=$(GOFLAGS) GOCACHE=$(GOCACHE) GOMODCACHE=$(GOMODCACHE) go run ./apps/dev-seed
57+
58+
vapid-keys:
59+
scripts/generate-vapid-keys.sh
60+
61+
test:
62+
GOFLAGS=$(GOFLAGS) GOCACHE=$(GOCACHE) GOMODCACHE=$(GOMODCACHE) go test ./apps/admin-api ./apps/public-api ./apps/payload-api ./apps/sender ./apps/scheduler ./apps/migrator ./apps/clickhouse-migrator ./packages/go/...
63+
64+
build-admin-api:
65+
GOFLAGS=$(GOFLAGS) GOCACHE=$(GOCACHE) GOMODCACHE=$(GOMODCACHE) go build -o .bin/admin-api ./apps/admin-api
66+
67+
build-public-api:
68+
GOFLAGS=$(GOFLAGS) GOCACHE=$(GOCACHE) GOMODCACHE=$(GOMODCACHE) go build -o .bin/public-api ./apps/public-api
69+
70+
build-payload-api:
71+
GOFLAGS=$(GOFLAGS) GOCACHE=$(GOCACHE) GOMODCACHE=$(GOMODCACHE) go build -o .bin/payload-api ./apps/payload-api
72+
73+
build-sender:
74+
GOFLAGS=$(GOFLAGS) GOCACHE=$(GOCACHE) GOMODCACHE=$(GOMODCACHE) go build -o .bin/sender ./apps/sender
75+
76+
build-scheduler:
77+
GOFLAGS=$(GOFLAGS) GOCACHE=$(GOCACHE) GOMODCACHE=$(GOMODCACHE) go build -o .bin/scheduler ./apps/scheduler
78+
79+
build-migrator:
80+
GOFLAGS=$(GOFLAGS) GOCACHE=$(GOCACHE) GOMODCACHE=$(GOMODCACHE) go build -o .bin/migrator ./apps/migrator
81+
82+
build-clickhouse-migrator:
83+
GOFLAGS=$(GOFLAGS) GOCACHE=$(GOCACHE) GOMODCACHE=$(GOMODCACHE) go build -o .bin/clickhouse-migrator ./apps/clickhouse-migrator

0 commit comments

Comments
 (0)