Add Drizzle ORM configuration and database schema for movie management app

This commit is contained in:
Norbert Maciaszek 2025-08-05 16:27:33 +02:00
parent d9eba29193
commit 2c329e9ff3
9 changed files with 2067 additions and 135 deletions

View File

@ -1,36 +1,22 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). # MovieBox 🎬
## Getting Started Osobista aplikacja do zarządzania filmami oglądanymi, planowanymi i nadchodzącymi premierami.
First, run the development server: ## 🧠 Główne funkcje (MVP)
```bash - Wyszukiwanie filmów przez TMDB API
npm run dev - Dodawanie do własnej bazy:
# or - Chcę obejrzeć
yarn dev - Obejrzałem(-am)
# or - Własne notatki/tagi
pnpm dev - Podgląd daty premiery, plakatu, opisu
# or - Lista nadchodzących premier
bun dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. ## 📦 Stack technologiczny
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. - **Next.js (App Router)**
- **TailwindCSS + ShadCN**
- **Drizzle ORM** (z SQLite → PostgreSQL w przyszłości)
- **TMDB API** do pobierania danych o filmach
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. ## 📁 Struktura projektu
## Learn More
To learn more about Next.js, 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.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.

BIN
config/db.sql Normal file

Binary file not shown.

10
drizzle.config.ts Normal file
View File

@ -0,0 +1,10 @@
import { defineConfig } from "drizzle-kit";
export default defineConfig({
out: "./drizzle",
schema: "./src/lib/db/schema.ts",
dialect: "sqlite",
dbCredentials: {
url: process.env.DB_FILE_NAME!,
},
});

View File

@ -9,16 +9,21 @@
"lint": "next lint" "lint": "next lint"
}, },
"dependencies": { "dependencies": {
"@libsql/client": "^0.15.10",
"dotenv": "^17.2.1",
"drizzle-orm": "^0.44.4",
"next": "15.4.5",
"react": "19.1.0", "react": "19.1.0",
"react-dom": "19.1.0", "react-dom": "19.1.0"
"next": "15.4.5"
}, },
"devDependencies": { "devDependencies": {
"typescript": "^5", "@tailwindcss/postcss": "^4",
"@types/node": "^20", "@types/node": "^20",
"@types/react": "^19", "@types/react": "^19",
"@types/react-dom": "^19", "@types/react-dom": "^19",
"@tailwindcss/postcss": "^4", "drizzle-kit": "^0.31.4",
"tailwindcss": "^4" "tailwindcss": "^4",
"tsx": "^4.20.3",
"typescript": "^5"
} }
} }

1978
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,103 +1,7 @@
import Image from "next/image"; export default async function Home() {
export default function Home() {
return ( return (
<div className="font-sans grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20"> <main>
<main className="flex flex-col gap-[32px] row-start-2 items-center sm:items-start"> <h1>Hello World</h1>
<Image </main>
className="dark:invert"
src="/next.svg"
alt="Next.js logo"
width={180}
height={38}
priority
/>
<ol className="font-mono list-inside list-decimal text-sm/6 text-center sm:text-left">
<li className="mb-2 tracking-[-.01em]">
Get started by editing{" "}
<code className="bg-black/[.05] dark:bg-white/[.06] font-mono font-semibold px-1 py-0.5 rounded">
src/app/page.tsx
</code>
.
</li>
<li className="tracking-[-.01em]">
Save and see your changes instantly.
</li>
</ol>
<div className="flex gap-4 items-center flex-col sm:flex-row">
<a
className="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground text-background gap-2 hover:bg-[#383838] dark:hover:bg-[#ccc] font-medium text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:w-auto"
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
className="dark:invert"
src="/vercel.svg"
alt="Vercel logomark"
width={20}
height={20}
/>
Deploy now
</a>
<a
className="rounded-full border border-solid border-black/[.08] dark:border-white/[.145] transition-colors flex items-center justify-center hover:bg-[#f2f2f2] dark:hover:bg-[#1a1a1a] hover:border-transparent font-medium text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 w-full sm:w-auto md:w-[158px]"
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Read our docs
</a>
</div>
</main>
<footer className="row-start-3 flex gap-[24px] flex-wrap items-center justify-center">
<a
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="/file.svg"
alt="File icon"
width={16}
height={16}
/>
Learn
</a>
<a
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="/window.svg"
alt="Window icon"
width={16}
height={16}
/>
Examples
</a>
<a
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
href="https://nextjs.org?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="/globe.svg"
alt="Globe icon"
width={16}
height={16}
/>
Go to nextjs.org
</a>
</footer>
</div>
); );
} }

3
src/lib/db/index.ts Normal file
View File

@ -0,0 +1,3 @@
import { drizzle } from "drizzle-orm/libsql";
export const db = drizzle(process.env.DB_FILE_NAME!);

10
src/lib/db/schema.ts Normal file
View File

@ -0,0 +1,10 @@
import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
export const movies = sqliteTable("movies", {
id: integer("id").primaryKey(),
title: text("title").notNull(),
releaseDate: text("release_date"),
posterPath: text("poster_path"),
status: text("status"), // to-watch, seen
notes: text("notes"),
});

36
todo.md Normal file
View File

@ -0,0 +1,36 @@
#
## ✅ `TODO.md` Etapy rozwoju aplikacji
```md
# TODO MovieBox
## 🔧 Faza 1 MVP (funkcjonalna wersja lokalna)
- [ ] Integracja z TMDB API (wyszukiwanie filmów)
- [ ] Utworzenie bazy danych (SQLite + Drizzle)
- [ ] Modele: Movie, WatchlistEntry
- [ ] Dodanie filmu do watchlisty (z podglądem szczegółów)
- [ ] Lista “Do obejrzenia” i “Obejrzane”
- [ ] Możliwość dodania tagu lub notatki do filmu
- [ ] UI (Tailwind + ShadCN) responsywna siatka filmów
## 🌐 Faza 2 Rozszerzenie
- [ ] Podgląd dat premier z TMDB
- [ ] Filtrowanie według daty premiery
- [ ] Sortowanie / filtrowanie po tagach/statusie
## 🔐 Faza 3 Rozszerzenia prywatne
- [ ] Dodanie Auth.js (logowanie)
- [ ] Migracja bazy do PostgreSQL
- [ ] Eksport listy filmów (np. JSON)
- [ ] Backup na GitHub (np. GitHub Actions)
## 💡 Pomysły na później
- [ ] System rekomendacji (podobne filmy)
- [ ] Powiadomienia o premierach
- [ ] Integracja z Letterboxd
```