A modern web application that helps you discover cocktails and generate shopping lists for ingredients. Built with TypeScript, Haunted hooks, and lit-html for a fast and responsive user experience.
- ๐ Smart Search: Search for cocktails by name using TheCocktailDB API
- ๐ Shopping List: Automatically generate ingredient lists with smart deduplication
- ๐จ Modern UI: Clean, responsive design with smooth animations
- ๐ฑ Mobile Friendly: Fully responsive across all device sizes
- ๐จ๏ธ Print Support: Print-optimized shopping lists
- โฟ Accessible: Built with accessibility in mind
- ๐ฏ Real-time Feedback: Toast notifications for user actions
- Node.js (v14 or higher)
- npm or yarn
-
Clone the repository
git clone https://github.com/Linkek/Cocktail-Assistant.git cd Cocktail-Assistant
-
Install dependencies
npm install
-
Start the development server
npm start
-
Open your browser Navigate to
http://localhost:8000
cocktail-assistant/
โโโ src/
โ โโโ components/ # Reusable UI components
โ โ โโโ SearchInput/ # Search input with loading states
โ โ โโโ CocktailCard/ # Individual cocktail display
โ โ โโโ CocktailList/ # Search results container
โ โ โโโ ShoppingList/ # Ingredient list management
โ โ โโโ Toast/ # Notification system
โ โโโ services/ # API and business logic
โ โ โโโ CocktailService.ts
โ โโโ types/ # TypeScript type definitions
โ โ โโโ enums.ts
โ โโโ main.tsx # Application entry point
โ โโโ main.styles.ts # Component-scoped styles
โโโ index.html # Main HTML file with global styles
โโโ package.json
โโโ tsconfig.json
โโโ README.md
- Frontend Framework: Haunted v6.1.0 - React-like hooks for web components
- Templating: lit-html v3.3.1 - Fast HTML templating
- Language: TypeScript v5.9.2 - Type safety and better developer experience
- Build Tool: esbuild v0.25.9 - Fast bundling and development server
- API: TheCocktailDB - Free cocktail database
- Styling: CSS-in-JS with TypeScript template literals
Each component follows a consistent pattern:
ComponentName.tsx
- Component logic and templateComponentName.styles.ts
- Component-specific styles exported as template literals
npm start
- Start development server with hot reloadnpm run build
- Build for production (when implemented)
- TypeScript strict mode enabled
- Component-based architecture
- Functional programming with hooks
- CSS-in-JS for component encapsulation
The app integrates with TheCocktailDB API:
- Search Endpoint:
https://www.thecocktaildb.com/api/json/v1/1/search.php?s={query}
- Rate Limiting: Handles API rate limits gracefully
- Semantic HTML structure
- ARIA labels and roles
- Keyboard navigation support
- High contrast mode compatibility
- Screen reader friendly
- Focus management
- Desktop: Full grid layout with sidebar
- Tablet: Adjusted grid proportions
- Mobile: Stacked layout with shopping list on top
- Fast Bundling: esbuild for rapid development
- Efficient Updates: Haunted hooks minimize re-renders
- Optimized Images: Lazy loading and smooth transitions
- Small Bundle: Minimal dependencies for fast loading
The Cocktail Assistant includes a configuration system that allows you to customize the app's behavior. All configuration options are located in src/config.ts
.
export const config: AppConfig = {
// Toggle recipe instructions display in sidebar
showRecipeInstructions: true,
// Set preferred language for cocktail instructions
language: 'en',
};
- Property:
showRecipeInstructions
- Type:
boolean
- Default:
true
- Description: Controls whether cocktail recipe cards are shown in the sidebar. The shopping list is always visible.
Examples:
showRecipeInstructions: true, // Show recipe cards with ingredients and instructions
showRecipeInstructions: false, // Hide recipe cards, show only shopping list
- Property:
language
- Type:
string
- Default:
'en'
- Description: Sets the preferred language for cocktail instructions. Falls back to English if the selected language isn't available for a specific cocktail.
Supported Languages:
'en'
- English (Default)'es'
- Espaรฑol (Spanish)'de'
- Deutsch (German)'fr'
- Franรงais (French)'it'
- Italiano (Italian)'zh-hans'
- ไธญๆ (็ฎไฝ) (Chinese Simplified)'zh-hant'
- ไธญๆ (็น้ซ) (Chinese Traditional)
Examples:
language: 'es', // Spanish instructions
language: 'de', // German instructions
language: 'fr', // French instructions
- Open the config file: Navigate to
src/config.ts
- Edit the values: Change the properties to your preferred settings
- Save the file: The changes will take effect immediately in development mode
- Restart if needed: In some cases, you may need to restart the development server
export const config: AppConfig = {
showRecipeInstructions: false,
language: 'en',
};
export const config: AppConfig = {
showRecipeInstructions: true,
language: 'es',
};
export const config: AppConfig = {
showRecipeInstructions: false,
language: 'de',
};
- โ Enabled: Shows recipe cards in sidebar with ingredients and instructions
- โ Disabled: Hides recipe section, shows only shopping list
- ๐ฑ Always: Shopping list remains visible in both modes
- ๐ฏ Instructions: Cocktail mixing instructions display in selected language
- ๐ Shopping List: Always shows ingredient names in English (API limitation)
- ๐จ๏ธ Print Feature: Printed recipes use the configured language
- ๐ Fallback: Automatically uses English if selected language unavailable
Author: Linus Karlsson
Repository: Cocktail-Assistant