|
| 1 | +# Ziex App with Postgres |
| 2 | + |
| 3 | +>This is a starter template for building web applications with [Ziex](https://ziex.dev), a full-stack web framework for Zig. |
| 4 | +
|
| 5 | +**[Documentation →](https://ziex.dev)** |
| 6 | + |
| 7 | +## Getting Started |
| 8 | + |
| 9 | +### 1. Install ZX CLI |
| 10 | + |
| 11 | +#### Linux/macOS |
| 12 | +```bash |
| 13 | +curl -fsSL https://ziex.dev/install | bash |
| 14 | +``` |
| 15 | + |
| 16 | +#### Windows |
| 17 | +```powershell |
| 18 | +powershell -c "irm ziex.dev/install.ps1 | iex" |
| 19 | +``` |
| 20 | + |
| 21 | +### 2. Install Zig |
| 22 | +```bash |
| 23 | +brew install zig # macOS |
| 24 | +winget install -e --id zig.zig # Windows |
| 25 | +``` |
| 26 | +[_Other platforms →_](https://ziglang.org/learn/getting-started/) |
| 27 | + |
| 28 | + |
| 29 | +## Project |
| 30 | + |
| 31 | +``` |
| 32 | +├── app/ |
| 33 | +│ ├── assets/ # Static assets (CSS, images, etc) |
| 34 | +│ ├── main.zig # Zig entrypoint |
| 35 | +│ ├── pages/ # Pages (Zig/ZX) |
| 36 | +│ │ ├── layout.zx # Root layout |
| 37 | +│ │ ├── page.zx # Home page |
| 38 | +│ │ ├── client.zx # Client side counter component |
| 39 | +│ │ └── ... |
| 40 | +│ └── public/ # Public static files (favicon, etc) |
| 41 | +├── build.zig # Zig build script |
| 42 | +├── build.zig.zon # Zig package manager config |
| 43 | +└── README.md # Project info |
| 44 | +``` |
| 45 | + |
| 46 | +## Usage |
| 47 | + |
| 48 | +### Development |
| 49 | +```bash |
| 50 | +zig build dev |
| 51 | +``` |
| 52 | +App will be available at [`http://localhost:3000`](http://localhost:3000). with hot reload enabled. |
| 53 | + |
| 54 | +### Serve Production Build |
| 55 | +```bash |
| 56 | +zig build serve --release=fast |
| 57 | +``` |
| 58 | + |
| 59 | +### Exporting as Static Site |
| 60 | +```bash |
| 61 | +zig build zx -- export |
| 62 | +``` |
| 63 | +This will create a `dist/` directory with the static export of your app. You can deploy the contents of `dist/` to any static hosting provider (Netlify, Vercel, GitHub Pages, etc) or serve it with any static file server. |
| 64 | + |
| 65 | +### Deployment |
| 66 | + |
| 67 | +```bash |
| 68 | +zig build zx -- bundle |
| 69 | +``` |
| 70 | + |
| 71 | +This will create a `bundle/` directory with the binary and static assets needed to run your app. You can deploy the contents of `bundle/` to any VPS. |
| 72 | + |
| 73 | + |
| 74 | +### [ZX CLI](https://ziex.dev/reference#cli) Commands |
| 75 | +```bash |
| 76 | +zig build zx -- [command] [options] |
| 77 | +``` |
| 78 | + |
| 79 | +All ZX CLI commands are available under `zig build zx -- [command]`. For example, to run auto formatter: |
| 80 | +```bash |
| 81 | +zig build zx -- fmt . |
| 82 | +``` |
| 83 | + |
| 84 | +## Contributing |
| 85 | + |
| 86 | +Contributions are welcome! Feel free to open issues or pull requests. For feature requests, bug reports, or questions, see the [Ziex Repo](https://github.com/ziex-dev/ziex). |
| 87 | + |
| 88 | +## Links |
| 89 | + |
| 90 | +- [Documentation](https://ziex.dev) |
| 91 | +- [Discord](https://ziex.dev/r/discord) |
| 92 | +- [Topic on Ziggit](https://ziex.dev/r/ziggit) |
| 93 | +- [Project on Zig Discord Community](https://ziex.dev/r/zig-discord) (Join Zig Discord first: https://discord.gg/zig) |
| 94 | +- [GitHub](https://github.com/nurulhudaapon/ziex) |
| 95 | +- [Zig Language](https://ziglang.org/) |
0 commit comments