chore: merge branch 'main' into zig-0.17

This commit is contained in:
Nurul Huda (Apon) 2026-06-21 23:22:11 +06:00
commit 6f78622f15
No known key found for this signature in database
GPG Key ID: 5D3F1DE2855A2F79
4 changed files with 135 additions and 2 deletions

12
templates/.gitignore vendored
View File

@ -60,6 +60,16 @@ node_modules/
!node/package.json
!node/README.md
# railway template
!railway/railway.json
!railway/README.md
!railway/Dockerfile
!railway/compose.yml
!railway/.dockerignore
# render template
!render/render.yaml
!render/README.md
!render/README.md
!render/Dockerfile
!render/compose.yml
!render/.dockerignore

View File

@ -0,0 +1,82 @@
# Ziex App on Railway
> A starter template for building web applications with [Ziex](https://ziex.dev) deployed on [Railway](https://railway.com/).
**[Documentation →](https://ziex.dev)**
[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/new/template?template=https://github.com/ziex-dev/template-railway)
## Getting Started
### Prerequisites
**1. Install ZX CLI**
```bash
# Linux/macOS
curl -fsSL https://ziex.dev/install | bash
# Windows
powershell -c "irm ziex.dev/install.ps1 | iex"
```
**2. Install Zig**
```bash
brew install zig # macOS
winget install -e --id zig.zig # Windows
```
[_Other platforms →_](https://ziglang.org/learn/getting-started/)
## Project Structure
```
├── app/
│ ├── assets/ # Static assets (CSS, images, etc)
│ ├── main.zig # Zig entrypoint
│ ├── pages/ # Pages (Zig/ZX)
│ │ ├── layout.zx # Root layout
│ │ ├── page.zx # Home page
│ │ ├── client.zx # Client-side component
│ │ └── ...
│ └── public/ # Public static files (favicon, etc)
├── build.zig # Zig build script
└── build.zig.zon # Zig package manager config
```
## Development
```bash
zig build dev
```
App will be available at [`http://localhost:3000`](http://localhost:3000) with hot reload enabled.
## Deploy to Railway
### Via Railway Dashboard
1. Push this repo to GitHub
2. Go to [Railway](https://railway.com/) and create a new project
3. Select **Deploy from GitHub repo**
4. In your service settings, configure:
- **Build Command**: `zig build -Doptimize=ReleaseSafe && zig build zx -- bundle`
- **Start Command**: `./bundle/ziex_app --rootdir ./bundle/static`
### Configuration
The app listens on port **3000** by default. In your Railway service settings, set the **Internal Port** to `3000`.
To use a custom port, add `-Dport=8080` to the build command and update the start command accordingly.
## Contributing
Contributions are welcome! For feature requests, bug reports, or questions, see the [Ziex Repo](https://github.com/ziex-dev/ziex).
## Links
- [Documentation](https://ziex.dev)
- [Discord](https://ziex.dev/r/discord)
- [Railway Docs](https://docs.railway.com/)
- [Zig Language](https://ziglang.org/)

View File

@ -0,0 +1,19 @@
{
"$schema": "https://railway.com/railway.schema.json",
"build": {
"builder": "DOCKERFILE",
"dockerfilePath": "Dockerfile"
},
"deploy": {
"healthcheckPath": "/",
"healthcheckTimeout": 100,
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
},
"variables": {
"PORT": {
"description": "Port the app listens on",
"defaultValue": "3000"
}
}
}

View File

@ -102,6 +102,19 @@ populate_template() {
cp "$base_file" "$target_file"
fi
done
# Copy _docker files (Dockerfile, compose.yml, .dockerignore)
if [ -d "templates/_docker" ]; then
find "templates/_docker" -type f | while read -r docker_file; do
rel_path="${docker_file#templates/_docker/}"
target_file="templates/$template/$rel_path"
if ! git check-ignore -q "$target_file"; then
mkdir -p "$(dirname "$target_file")"
sed -e 's/\$BIN_NAME/ziex_app/g' -e 's/\$PORT/3000/g' "$docker_file" > "$target_file"
fi
done
fi
}
clean_template() {
@ -120,9 +133,18 @@ clean_template() {
fi
cd "$ROOT_DIR"
# Use git to list ignored files and remove them
# Remove ignored files (populated from _base)
# Note: we use -X to remove only ignored files, -d to remove directories if empty
git clean -fdX "templates/$template/"
# Remove files that were copied from _base/_docker but are unignored
for populated_file in .gitignore .gitattributes Dockerfile compose.yml .dockerignore; do
local target_file="templates/$template/$populated_file"
# Only remove if the file is not tracked by git (i.e., not committed)
if [ -f "$target_file" ] && ! git ls-files --error-unmatch "$target_file" 2>/dev/null; then
rm -f "$target_file"
fi
done
}
diff_template() {