Ingredient and recipe management with role-based API endpoints
Ingredient and recipe management with role-based API endpoints.
SmartChef is a cooking and food-planning platform with a Java/Spring Boot API, a React interface and PostgreSQL storage. The repository documents pantry management, recipes, meal plans, shopping lists, dietary preferences, AI recipe suggestions, optional fridge-image analysis, and a retrieval-augmented culinary knowledge service.
*Verified tracked source and project files (build directories excluded)
Capabilities documented in the repository; the supporting sources and project configuration determine how they run.
Ingredient and recipe management with role-based API endpoints.
User pantry, shopping lists, meal plans and dietary restrictions.
JWT authentication and BCrypt password hashing.
AI recipe suggestions with configurable usage limits and manual confirmation of vision results.
Optional culinary RAG using ChromaDB and a separate Spring microservice.
Docker Compose for database, backend and web client; Mockito-based service tests.
Spring Boot REST controllers delegate to services and JPA repositories.
Hibernate validates a PostgreSQL model; Flyway can bootstrap fresh schemas in a Docker development setup.
React/Vite consumes the API; a separate RAG service enriches AI context with culinary documents.
Selected fragments from project source files with an explanation of the responsibility they implement.
Requests are throttled in a rolling one-hour window per user; cost limits are in the application service layer.
public void check(String userKey) {
if (requestsPerHour <= 0) return;
Deque<Instant> timestamps = requests.computeIfAbsent(userKey, ignored -> new ArrayDeque<>());
synchronized (timestamps) {
Instant cutoff = Instant.now().minus(Duration.ofHours(1));
while (!timestamps.isEmpty() && timestamps.peekFirst().isBefore(cutoff)) timestamps.removeFirst();
if (timestamps.size() >= requestsPerHour) throw new AiRateLimitExceededException();
timestamps.addLast(Instant.now());
}
}
The refrigerator-image workflow validates uploads before calling an AI model and returns uncertain ingredient matches for manual confirmation.
private void validate(MultipartFile photo) {
if (photo == null || photo.isEmpty())
throw new InvalidImageException("Please upload a refrigerator photo.");
if (!ALLOWED_IMAGE_TYPES.contains(photo.getContentType()))
throw new InvalidImageException("Use a JPEG, PNG, or WebP image.");
}
Place approved visuals in
assets/img/projects/project-tpd/screenshot-01.webp.
Current README and source files were checked; runtime operation was not independently tested.
Descriptions and examples are based on the repository documentation and selected source files. Build settings, external services, assets and project-specific configuration may be required to run the application.