A modern recipe management API built with Elysia framework and Bun runtime, featuring SQLite database and comprehensive cuisine support.
- Modern Stack: Built with Elysia, Bun, TypeScript, and SQLite
- Comprehensive Recipe Management: CRUD operations with dynamic steps and ingredients
- Cuisine Organization: Support for multiple cuisines per recipe with grouping capabilities
- File Upload: Hero photos and step-by-step photos for recipes
- Advanced Filtering: Sort and filter recipes by cuisine, author, ingredients, and more
- API Documentation: Auto-generated Swagger/OpenAPI documentation
- Type Safety: Full TypeScript support with strict type checking
- Performance: Optimized database queries with proper indexing
GET /api/v1/recipes- List recipes with filtering and sortingGET /api/v1/recipes/:id- Get single recipe with full detailsPOST /api/v1/recipes- Create new recipePUT /api/v1/recipes/:id- Update existing recipeDELETE /api/v1/recipes/:id- Archive recipeGET /api/v1/recipes/by-cuisine/:cuisineId- Get recipes by specific cuisineGET /api/v1/recipes/grouped-by-cuisine- Get recipes grouped by cuisine
GET /api/v1/cuisines- List all available cuisinesGET /api/v1/cuisines/:id- Get single cuisine with detailsPOST /api/v1/cuisines- Create new cuisinePUT /api/v1/cuisines/:id- Update existing cuisineDELETE /api/v1/cuisines/:id- Delete cuisine
POST /api/v1/recipes/:id/photos/hero- Upload hero photoPOST /api/v1/recipes/:id/photos/steps/:stepNumber- Upload step photoGET /api/v1/files/:recipeId/:filename- Serve uploaded photos
- Bun v1.0.0 or higher
-
Clone the repository
git clone <repository-url> cd recipes-elysia
-
Install dependencies
bun install
-
Environment Configuration
cp .env.example .env # Edit .env file with your configuration -
Initialize database and seed data
bun run seed
-
Start development server
bun run dev
The API will be available at http://localhost:3000
API Documentation: http://localhost:3000/docs
The application uses SQLite with the following tables:
- users - User management
- cuisines - Cuisine categories
- recipes - Recipe information
- recipe_cuisines - Many-to-many relationship between recipes and cuisines
- recipe_steps - Step-by-step instructions
- ingredients - Ingredient catalog
- recipe_ingredients - Recipe ingredients with quantities
src/
├── controllers/ # Route handlers and business logic
├── models/ # Database models and schemas
├── middleware/ # Custom middleware functions
├── routes/ # Route definitions
├── types/ # TypeScript type definitions
├── utils/ # Utility functions
├── validators/ # Input validation schemas
└── db/ # Database connection and migrations
files/ # Uploaded files storage
├── {recipe-id}/ # Photos organized by recipe ID
│ ├── hero.jpg # Hero photo
│ └── step-{n}.jpg # Step photos
docs/ # Documentation
├── INSTRUCTIONS.md # Project requirements
└── CODE_STANDARDS.md # Coding standards
bun run dev- Start development server with auto-reloadbun run start- Start production serverbun run seed- Seed database with sample databun run test- Run testsbun run lint- Run ESLintbun run format- Format code with Prettierbun run build- Build for productionbun run typecheck- Run TypeScript type checking
| Variable | Description | Default |
|---|---|---|
PORT |
Server port | 3000 |
NODE_ENV |
Environment | development |
DATABASE_URL |
SQLite database path | ./recipes.db |
JWT_SECRET |
JWT signing secret | Required in production |
UPLOAD_DIR |
File upload directory | ./files |
MAX_FILE_SIZE |
Maximum file size in bytes | 5242880 (5MB) |
FRONTEND_URL |
Frontend URL for CORS | http://localhost:3000 |
- Multi-cuisine Support: Each recipe can belong to multiple cuisines
- Dynamic Steps: Variable number of instruction steps with ordering
- Ingredient Management: Automatic ingredient catalog with quantities and units
- Photo Support: Hero photos and step-specific photos
- Sort by: name, created_at, updated_at, author, cuisine
- Filter by: author_id, ingredients, cuisines, created date range
- Search: recipe name, description, ingredients, cuisine name
- Pagination: Efficient handling of large datasets
- Database Optimization: Proper indexing and query optimization
- File Management: Organized file structure with efficient serving
- Caching: HTTP caching headers for static files
- Type Safety: Full TypeScript coverage
Interactive API documentation is automatically generated and available at /docs when the server is running.
- Input validation and sanitization
- File upload security (type and size validation)
- CORS configuration
- SQL injection prevention with prepared statements
- Rate limiting support
Run tests with:
bun run testMIT License - see LICENSE file for details
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Run linting and tests
- Submit a pull request
For questions or issues, please open an issue on the repository.