55 lines
2.3 KiB
Markdown
55 lines
2.3 KiB
Markdown
# lukenya-university-marathon
|
|
|
|
This is a [Next.js](https://nextjs.org) project bootstrapped with [v0](https://v0.app).
|
|
|
|
## Built with v0
|
|
|
|
This repository is linked to a [v0](https://v0.app) project. You can continue developing by visiting the link below -- start new chats to make changes, and v0 will push commits directly to this repo. Every merge to `main` will automatically deploy.
|
|
|
|
[Continue working on v0 →](https://v0.app/chat/projects/prj_4drPsrNVDgEwcruGKroiMoJrP8cl)
|
|
|
|
## Getting Started
|
|
|
|
First, run the development server:
|
|
|
|
```bash
|
|
npm run dev
|
|
# or
|
|
yarn dev
|
|
# or
|
|
pnpm dev
|
|
```
|
|
|
|
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
|
|
|
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
|
|
|
## Learn More
|
|
|
|
To learn more, take a look at the following resources:
|
|
|
|
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
|
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
- [v0 Documentation](https://v0.app/docs) - learn about v0 and how to use it.
|
|
|
|
<a href="https://v0.app/chat/api/kiro/clone/muendo/lukenya-university-marathon" alt="Open in Kiro"><img src="https://pdgvvgmkdvyeydso.public.blob.vercel-storage.com/open%20in%20kiro.svg?sanitize=true" /></a>
|
|
|
|
## Backend connection
|
|
|
|
Race, price, edition and prize data come from the Frappe backend (`lukenya_marathon` app).
|
|
Nothing about races is hard-coded in the pages any more.
|
|
|
|
- `lib/lukenya-api.ts`: server-only calls to Frappe. Pages refresh their data every 60 seconds,
|
|
or immediately when the backend calls `POST /api/revalidate`.
|
|
- `lib/event-types.ts`: the data shapes the backend returns. Treat these as the contract.
|
|
- The browser never calls Frappe directly. It posts to this site's routes, which forward to Frappe:
|
|
- `POST /api/register` → `api.create_registration`
|
|
- `POST /api/payment/start` → `payments.start_payment` (returns the Paystack checkout link)
|
|
- `GET /api/payment/status?reference=…` → `payments.check_payment_status`
|
|
- Paystack sends the runner back to `/payment/return`, which waits for the server to verify the payment.
|
|
|
|
If `api.get_public_event` isn't available yet, the site falls back to the older
|
|
`api.get_event_categories` endpoint. Set `FRAPPE_EDITION` so that fallback only shows one edition.
|
|
|
|
Environment variables are listed in `.env.example`.
|