Files
2026-08-14 08:51:55 +03:00

58 lines
2.8 KiB
Markdown

# Devodytyji — open-air cultural venue website
Website for an open-air cultural venue ("відкритий культурний майданчик") with events, venue reviews, event reviews, a venue map, and a contact inbox. Built with Astro 7 (SSR, Netlify adapter), React islands, Supabase, Leaflet, and a UA/EN i18n setup.
## Stack
- **Astro 7** — `output: 'server'`, `@astrojs/netlify` adapter, i18n `prefixDefaultLocale`
- **React islands** — auth form, contact form, review forms, map (`react-leaflet`), event filters/editor
- **Supabase** — Postgres, Auth, Storage (event covers), RLS, DB-triggered admin grant
- **npm** — Node 20+, sharp is pinned via `overrides` (`sharp: 0.35.3`) to fix a native-build issue on this machine
## Project structure
```text
src/
components/
islands/ # React + framework islands (AuthForm, MapView, EventEditor, ...)
ui/ # Stars, EventCard, ReviewCard
Header.astro, Footer.astro
layouts/ # BaseLayout (public, SEO/i18n), AdminLayout
lib/ # supabase clients, db helpers, i18n dictionaries, format, venue, request
middleware.ts # locale redirects, session refresh, admin guards
pages/
[lang]/ # public pages (ua/en)
admin/ # admin area (UA only, not locale-prefixed)
api/ # auth, reviews, contact, admin API routes
supabase/
migrations/0001_init.sql # schema, RLS, storage, helper functions
seed.sql # sample events + contact messages
```
## Local development
1. Install dependencies: `npm install`
2. Set up Supabase:
- Create a project and run `supabase/migrations/0001_init.sql` (and `supabase/seed.sql`) in the SQL editor.
- Grant yourself admin: `select promote_user_to_admin('you@example.com');`
- Enable Google/GitHub providers in **Auth → Providers**; add the OAuth callback URL `{PUBLIC_SITE_URL}/api/auth/callback`.
- Create an `event-covers` storage bucket (also created by the migration).
3. Configure env: `cp .env.example .env` and fill in `PUBLIC_SUPABASE_URL`, `PUBLIC_SUPABASE_ANON_KEY`, `PUBLIC_SITE_URL`.
4. Run `npm run dev` (or `npx astro dev --background` / `stop` / `status` / `logs`).
## Commands
| Command | Action |
| :--- | :--- |
| `npm run dev` | Start dev server at `localhost:4321` |
| `npm run build` | Build SSR output to `./dist/` |
| `npm run preview` | Preview the build locally |
| `npm run typecheck` | Type-check with `astro check` |
| `npx astro dev --background` | Background dev server (stop/status/logs) |
## Deploy to Netlify
- Connect the repo to Netlify; build command `npm run build`, publish directory `dist`.
- Set `PUBLIC_SUPABASE_URL`, `PUBLIC_SUPABASE_ANON_KEY`, `PUBLIC_SITE_URL` in Netlify env vars.
- `netlify.toml` adds security headers; the Netlify adapter emits the SSR function + redirects automatically.