Skip to content

Commit 797eea0

Browse files
committed
chore: initial commit
0 parents  commit 797eea0

Some content is hidden

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

49 files changed

+9711
-0
lines changed

.dev.vars.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AUTH_SECRET=foobarbaz

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
DB_URL=postgresql://postgres:postgres@db.ztest.local:5432/ztest_dev
2+
VITE_SYNC_URL=https://sync.ztest.local

.github/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# ztest
2+
3+
Install the following tools:
4+
5+
- [direnv](https://github.com/direnv/direnv) - loads environment variables
6+
- [OrbStack](https://orbstack.dev) - runs dev containers, local HTTPS/domains, etc.
7+
8+
Run the following commands:
9+
10+
```bash
11+
# Clone and copy empty variables
12+
gh repo clone tmm/ztest
13+
cp .env.example .env
14+
cp .dev.vars.example .dev.vars
15+
16+
pnpm install # Install local dependencies
17+
docker compose up -d # Start containers
18+
pnpm db:migrate latest # Setup database and run migrations
19+
pnpm db:codegen # Generate Kysely/Zero types from database
20+
pnpm gen:types # Generate Cloudflare types
21+
pnpm test # Test Zero queries/mutators
22+
```
23+
24+
## License
25+
26+
[MIT](/LICENSE)

.github/actions/pnpm/action.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: 'pnpm'
2+
3+
inputs:
4+
node-version:
5+
required: true
6+
working-directory:
7+
default: '.'
8+
required: false
9+
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Set up pnpm
14+
uses: pnpm/action-setup@v4
15+
with:
16+
package_json_file: ${{ inputs.working-directory }}/package.json
17+
18+
- name: Setup Node.js with pnpm cache
19+
uses: actions/setup-node@v4
20+
with:
21+
cache: pnpm
22+
cache-dependency-path: ${{ inputs.working-directory }}/pnpm-lock.yaml
23+
node-version: ${{ inputs.node-version }}
24+
25+
- name: Install dependencies
26+
working-directory: ${{ inputs.working-directory }}
27+
run: pnpm install
28+
shell: bash
29+

.github/workflows/check.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Check
2+
on:
3+
workflow_call:
4+
workflow_dispatch:
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
app:
10+
name: app
11+
env:
12+
DB_URL: postgres://postgres:postgres@localhost:5432/postgres
13+
outputs:
14+
artifact_id: ${{ steps.upload-artifact.outputs.artifact-id }}
15+
runs-on: ubuntu-latest
16+
services:
17+
db:
18+
image: postgres:16.2-alpine
19+
env:
20+
POSTGRES_DB: postgres
21+
POSTGRES_PASSWORD: postgres
22+
options: >-
23+
--health-cmd pg_isready
24+
--health-interval 10s
25+
--health-retries 5
26+
--health-timeout 5s
27+
ports: ['5432:5432']
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
32+
- name: Install dependencies
33+
uses: ./.github/actions/pnpm
34+
with:
35+
node-version: 24.10.0
36+
37+
- name: Check code
38+
run: pnpm check
39+
40+
- name: Test migrations
41+
run: pnpm db:migrate latest
42+
43+
- name: Generate code
44+
run: |
45+
pnpm db:codegen
46+
cp .dev.vars.example .dev.vars
47+
pnpm gen:types
48+
rm .dev.vars
49+
50+
- name: Build
51+
run: pnpm vite build
52+
53+
- name: Check types
54+
run: pnpm check:types
55+
56+
- name: Test
57+
run: pnpm test

.github/workflows/production.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Production
2+
on:
3+
push:
4+
branches: [main]
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
check:
11+
name: Check
12+
uses: ./.github/workflows/check.yml

.github/workflows/pull-request.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Pull Request
2+
on:
3+
pull_request:
4+
types: [opened, reopened, synchronize, ready_for_review]
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
check:
11+
name: Check
12+
uses: ./.github/workflows/check.yml

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
*.local
2+
*.log
3+
.DS_Store
4+
.dev.vars*
5+
.env
6+
.env.json
7+
.pnpm-store
8+
.sonda
9+
.vscode/*
10+
.wrangler
11+
dist
12+
generated
13+
logs
14+
node-compile-cache
15+
node_modules
16+
pnpm-debug.log*
17+
sonda-report.html

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
auto-install-peers=false
2+
enable-pre-post-scripts=true

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2025-present weth, LLC
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

0 commit comments

Comments
 (0)