A full-stack recipe sharing application with React frontend and Node.js backend.
Your task is to containerize this application using Docker and Docker Compose. You'll need to create:
frontend/Dockerfile- To containerize the React appbackend/Dockerfile- To containerize the Node.js APIdocker-compose.yml- To orchestrate both services
Once completed, users should be able to run the entire application with a single command: docker-compose up.
Good luck! 🚀
- Node.js 16 or higher
- npm
- Start the Backend:
cd backend
npm install
npm startBackend will run on http://localhost:8080. You can preview all recipes at http://localhost:8080/api/recipes.
- Start the Frontend (in a new terminal):
cd frontend
npm install
npm run devFrontend will run on http://localhost:3000 (or the next available port).
- Test the Application:
- Visit the URL shown in your terminal (Usually
http://localhost:3000) - You should see sample recipes loaded
- Try adding a new recipe using the form
- Refresh the page to verify data persistence
- You can also see that it has been added in the backed by visiting or refreshing
http://localhost:8080/api/recipes
- Visit the URL shown in your terminal (Usually
GET /api/recipes- Get all recipesGET /api/recipes/:id- Get single recipePOST /api/recipes- Create new recipeDELETE /api/recipes/:id- Delete recipeGET /api/health- Health check
recipe-app/
├── frontend/ # React application (Vite)
├── backend/ # Node.js/Express API
└── README.md # This file