Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ Here are some useful links for getting started with Wix Headless and the availab
<td></td>
<td>Wix Rentals</td>
</tr>
<tr>
<td><a href="https://github.com/wix/headless-templates/tree/main/astro/before-ai-v2">Code Before AI (Wix Events)</a></td>
<td>A Windows XP desktop as an events site — lists Wix Events and takes RSVPs through an elevated backend endpoint.</td>
<td><a href="https://before-ai-v-2-tuvitk-0d06.wix-site-host.com">Live demo</a></td>
<td>Wix Events</td>
</tr>
<tr>
<td colspan="4" align="center"><strong>Next.js</strong></td>
</tr>
Expand Down
28 changes: 28 additions & 0 deletions astro/before-ai-v2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# wix integration
.wix/

# build output
dist/

# generated types
.astro/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# environment variables
.env
.env.production
.env.local

# macOS-specific files
.DS_Store

# jetbrains setting folder
.idea/
50 changes: 50 additions & 0 deletions astro/before-ai-v2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Code Before AI — Wix Events template

A Windows XP desktop that happens to be an events site: old programmers tell
stories about writing code before AI, and you RSVP through an XP-style wizard.

**[Live demo](https://before-ai-v-2-tuvitk-0d06.wix-site-host.com)**

It demonstrates:

- A full desktop metaphor — draggable-feeling windows, a Start menu, a taskbar
and balloon tips — as **one** React island (`client:load`), server-rendered
and then hydrated, so the event listing is in the HTML for crawlers
- Listing upcoming events as a plain **visitor-scoped** read
(`wixEventsV2.queryEvents`) — no client, no API key: the `@wix/astro`
integration authenticates module-level SDK imports for you
- Two Astro endpoints, `GET /api/events` and `POST /api/rsvp`, whose handler
bodies are portable Web `Request`/`Response` code
- A **privileged write** behind an endpoint: `auth.elevate(rsvpV2.createRsvp)`,
which only ever runs server-side

The Wix integration lives entirely in `src/lib/wix-events.ts`; the UI is
`src/components/XpDesktop.tsx`.

## Wix apps required

| App | Used for |
|---|---|
| Wix Events | the RSVP events and the RSVPs themselves |

## Notes

- **Events must be `RSVP`, not `TICKETING`.** `registration.initialType` is
immutable after create, and this template's write path is `createRsvp`.
- **Event dates must be in the future** or the listing filters them out
(`status` is queried as `UPCOMING`/`STARTED`).
- A site with no upcoming events renders an empty state. The template never
substitutes sample events — what you see is what Wix returns.
- Each card's icon comes from a fixed decorative emoji list; Wix Events has no
per-event icon, and an event's `mainImage` is not rendered by this design.

## Getting started

Use this template with the [Wix CLI for Headless quick start](https://dev.wix.com/docs/go-headless/get-started/quick-starts/wix-managed-headless/quick-start-with-the-wix-cli), then:

```bash
npm install
npm run dev
```

`npm run build` produces the Wix-hosted server bundle.
23 changes: 23 additions & 0 deletions astro/before-ai-v2/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// @ts-check
import { defineConfig } from "astro/config";
import wix from "@wix/astro";
import wixPages from "@wix/astro-pages";
import wixHostingAdapter from "@wix/astro-wix-hosting-adapter";
import react from "@astrojs/react";
import tailwindcss from "@tailwindcss/vite";

// https://astro.build/config
export default defineConfig({
// Every route renders per request: the event listing is a live read, so
// there is nothing to prerender.
output: "server",
adapter: wixHostingAdapter(),
integrations: [wix(), wixPages(), react()],
security: { checkOrigin: false },

vite: { plugins: [tailwindcss()] },

image: {
domains: ["static.wixstatic.com"],
},
});
29 changes: 29 additions & 0 deletions astro/before-ai-v2/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "wix-astro-before-ai-v2",
"type": "module",
"version": "0.0.1",
"scripts": {
"astro": "astro",
"dev": "astro dev",
"build": "astro build"
},
"dependencies": {
"@astrojs/react": "^4.3.0",
"@tailwindcss/vite": "^4.2.1",
"@wix/astro": "^2.39.0",
"@wix/astro-pages": "^2.0.4",
"@wix/astro-wix-hosting-adapter": "^2.0.0",
"@wix/essentials": "^1.0.6",
"@wix/events": "^1.0.803",
"@wix/sdk": "^1.21.13",
"astro": "^5.8.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"tailwindcss": "^4.2.1",
"typescript": "^5.9.3"
},
"devDependencies": {
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.1"
}
}
6 changes: 6 additions & 0 deletions astro/before-ai-v2/public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading