diff --git a/README.md b/README.md index 6985ae0..4f1187d 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,34 @@ # ElysiaJS Boilerplate -Starter for the ElysiaJS coursework workspace: Bun + ElysiaJS + TypeScript, -with MySQL (Drizzle ORM) and Redis wired up to the shared course databases. +Szablon startowy do zajęć z ElysiaJS: Bun + ElysiaJS + TypeScript, z +podpiętym MySQL (Drizzle ORM) i Redisem do wspólnych baz danych z kursu. -## Development +## Uruchomienie ```bash bun install -bun run db:push # creates the `notes` table from src/db/schema.ts +bun run db:push # tworzy tabelę `notes` z src/db/schema.ts bun run dev ``` -Open http://localhost:3000/swagger for interactive API docs (auto-generated -from the routes in `src/index.ts`). +Wejdź na http://localhost:3000/swagger - tam znajdziesz dokumentację API +(generowaną automatycznie z endpointów w `src/index.ts`). -## What's here -- `src/index.ts` - the app: a couple of example routes showing MySQL reads/ - writes via `src/db` and Redis reads/writes via `src/redis.ts`. Delete the - examples once you understand the pattern and start building your own. -- `src/db/schema.ts` - your Drizzle table definitions. Add tables here, then - run `bun run db:push` to sync them to MySQL (no migration files needed for - coursework - `push` just diffs your schema against the live database). -- `src/db/index.ts` / `src/redis.ts` - pre-configured clients, reading - connection details from environment variables. In your Coder workspace - these are already set for you (`MYSQL_*`, `REDIS_*`) - you never need to - type a password into code. -- `.env.example` - only needed if you want to run this outside your Coder - workspace, against your own local MySQL/Redis. +## Co tu jest +- `src/index.ts` - główna aplikacja: przykładowe endpointy pokazujące odczyt + i zapis do MySQL (`src/db`) oraz do Redisa (`src/redis.ts`). Usuń te + przykłady, gdy zrozumiesz zasadę działania i zaczniesz pisać własny kod. +- `src/db/schema.ts` - definicje tabel w Drizzle. Dodawaj tu kolejne tabele, + a potem uruchom `bun run db:push`, żeby zsynchronizować je z bazą MySQL + (bez plików migracji - `push` po prostu porównuje schemat z bazą na żywo). +- `src/db/index.ts` / `src/redis.ts` - gotowe klienty, które czytają dane + połączenia ze zmiennych środowiskowych. W Twoim workspace w Coderze są one + już ustawione (`MYSQL_*`, `REDIS_*`) - nie musisz nigdzie wpisywać hasła. +- `.env.example` - potrzebne tylko, jeśli chcesz uruchomić projekt poza + workspace'em w Coderze, na własnym MySQL/Redis. -## Notes -- Your Redis user can only touch keys under `student::*` - (enforced by the server) - that's why `src/index.ts` prefixes cache keys - with `REDIS_USERNAME`. Keys outside that prefix will be rejected. -- Your MySQL user only has access to your own database - no need to specify - it beyond what's already in `MYSQL_DATABASE`. +## Uwagi +- Twój użytkownik Redis widzi tylko klucze pod `student::*` + (wymuszone po stronie serwera) - dlatego `src/index.ts` dodaje ten prefiks + do kluczy w cache. Klucze spoza tego prefiksu zostaną odrzucone. +- Twój użytkownik MySQL ma dostęp tylko do swojej własnej bazy - nie musisz + nic dodatkowo podawać poza tym, co jest już w `MYSQL_DATABASE`.