A SvelteKit application for tracking movies, sharing your/friends fovourite films ,and rating films.
This application allows users to:
movie-tracker/
├── src/
│ ├── lib/
│ │ ├── components/ # Svelte components
│ │ │ ├── MovieCard.svelte
│ │ │ ├── MovieList.svelte
│ │ │ ├── SearchBar.svelte
│ │ │ ├── Navigation.svelte
│ │ │ ├── MovieDetails.svelte
│ │ │ ├── WatchlistItem.svelte
│ │ │ ├── FilterComponent.svelte
│ │ │ └── RatingComponent.svelte
│ │ ├── services/ # API and storage services
│ │ │ ├── tmdb.ts # TMDB API integration
│ │ │ └── storage.ts # Local storage functionality
│ │ └── stores.ts # Svelte stores for state management
│ ├── routes/ # SvelteKit routes
│ │ ├── +layout.svelte # Main layout with navigation
│ │ ├── +page.svelte # Home page
│ │ ├── search/ # Search functionality
│ │ ├── movie/[id]/ # Movie details page
│ │ ├── watchlist/ # User's watchlist
│ │ └── favorites/ # User's favorites
│ ├── app.html # HTML template
│ └── app.d.ts # TypeScript declarations
└── static/
└── global.css # Global styles
The application uses The Movie Database (TMDB) API for fetching movie data. The following API endpoints are used:
Popular Movies: Fetches a list of currently popular movies
GET /movie/popular
Movie Search: Searches for movies by title
GET /search/movie
Movie Details: Gets detailed information about a specific movie
GET /movie/{movie_id}
Movie Recommendations: Gets movie recommendations based on a movie
GET /movie/{movie_id}/recommendations
The application uses an SQLite database via Prisma ORM to persist user data between sessions. The following data is stored:
dateAdded.dateAdded.dateAdded (acting as last viewed date).The data is managed through Prisma Client, ensuring type safety and efficient database interactions. The src/lib/services/storage.ts module now handles all database operations.
Components in the application communicate through several methods:
Clone the repository
git clone <repository-url>
cd movie-tracker
Install dependencies
npm install
Create a .env file in the root of the movie-tracker directory with your TMDB API key and the database URL (it should already be configured for SQLite):
TMDB_API_KEY=your_api_key_here
DATABASE_URL="file:./dev.db"
Apply Prisma migrations to set up the database schema:
npx prisma migrate dev --name init
(If you are setting this up for the first time and the migration already exists from the project files, this command will apply it. If you make schema changes later, you'll use npx prisma migrate dev --name your_migration_name.)
Start the development server
npm run dev
Open your browser and navigate to http://localhost:5173 (or the port indicated if 5173 is busy).