A comprehensive RESTful API for sharing, discovering, and interacting with recipes. Built with Node.js, TypeScript, and Express.js following enterprise-grade architectural patterns.
- User Management: Registration, authentication, profile management
- Recipe Sharing: Create, update, delete, and discover recipes
- Advanced Search: Filter by ingredients, cuisine, dietary restrictions, and more
- Social Features: Like, comment, rate, and share recipes
- Community Interaction: Follow users, save favorites, get notifications
- Content Management: Image upload, categorization, and tagging
- Node.js (v16 or higher)
- MongoDB
- npm or yarn
- Clone the repository:
git clone <repository-url>
cd recipe-sharing-api- Install dependencies:
npm install- Create environment variables:
cp .env.example .env
# Edit .env with your database and other configuration- Start the application:
# Development
npm run dev
# Production
npm run build
npm startThe API will be available at http://localhost:3000
Interactive API documentation is available at:
- Swagger UI:
http://localhost:3000/api-docs - Health Check:
http://localhost:3000/health
This API follows a Modular Layered Architecture with enterprise-grade design patterns:
- Modular Controllers: Domain-specific controllers with clear separation of concerns
- Middleware Pipeline: Authentication, validation, error handling, and logging
- Type Safety: Full TypeScript implementation with strict typing
- Security: JWT authentication, input validation, and sanitization
- Documentation: Comprehensive Swagger/OpenAPI 3.0 documentation
For detailed architectural information, see Architecture Documentation.
For comprehensive API documentation, see API Reference.
POST /api/auth/signup- Register new userPOST /api/auth/login- User loginPOST /api/auth/logout- User logout
GET /api/recipes- Get all recipes (with pagination)GET /api/recipes/search- Advanced recipe searchPOST /api/recipes- Create new recipe (auth required)GET /api/recipes/:id- Get recipe by IDPUT /api/recipes/:id- Update recipe (auth required)DELETE /api/recipes/:id- Delete recipe (auth required)
POST /api/recipes/:id/like- Like/unlike recipePOST /api/recipes/:id/rate- Rate recipePOST /api/recipes/:id/share- Share recipePOST /api/users/follow/:userId- Follow/unfollow user
GET /api/recipes/categories- Get all categories and tagsGET /api/recipes/featured- Get featured recipesGET /api/recipes/popular- Get popular recipesGET /api/recipes/cuisine/:type- Get recipes by cuisine
For the complete API reference with request/response examples, see API Documentation.
- Runtime: Node.js with TypeScript
- Framework: Express.js
- Database: MongoDB with Mongoose ODM
- Authentication: JWT with refresh token support
- Validation: Joi schema validation
- Documentation: Swagger/OpenAPI 3.0
- File Upload: Multer
- Email: Nodemailer
- Security: bcrypt, CORS, helmet
src/
├── controllers/ # Business logic (domain-specific)
├── models/ # Data models and schemas
├── routes/ # API endpoint definitions
├── middleware/ # Cross-cutting concerns
├── validation/ # Input validation schemas
├── config/ # Application configuration
├── utils/ # Shared utilities
├── docs/ # Documentation
└── types/ # TypeScript type definitions
npm run dev # Start development server with hot reload
npm run build # Build TypeScript to JavaScript
npm start # Start production server
npm test # Run test suite
npm run lint # Run ESLint
npm run lint:fix # Fix ESLint issues automaticallyCreate a .env file with the following variables:
NODE_ENV=development
PORT=3000
MONGODB_URI=mongodb://localhost:27017/recipe-sharing
JWT_SECRET=your-jwt-secret
JWT_EXPIRES_IN=1d
JWT_REFRESH_SECRET=your-refresh-secret
JWT_REFRESH_EXPIRES_IN=7d
SMTP_HOST=your-smtp-host
SMTP_PORT=587
SMTP_USER=your-email
SMTP_PASS=your-password
FRONTEND_URL=http://localhost:3000
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: Architecture | API Reference
- Issues: GitHub Issues
- Email: support@recipeapi.com
Built for the culinary community