This project is a restaurant management web application that allows users to browse dishes, place orders, and manage them. It consists of a frontend built with Astro, Svelte, and Tailwind CSS, and a backend built with FastAPI and SQLAlchemy.
- Dynamic Dish Display: Fetch and display dishes based on categories.
- Cart Management: Add, update, and remove items from the cart.
- Order Placement: Send orders to the backend.
- Order History: Track previously ordered items.
- Responsive Design: Optimized for various screen sizes.
- Dish Management: CRUD operations for dishes.
- Order Management: Create, retrieve, and delete orders.
- Database Integration: Uses MySQL with SQLAlchemy ORM.
- API Endpoints: RESTful APIs for frontend communication.
- Astro: Static site generator.
- Svelte: Component-based framework.
- Tailwind CSS: Utility-first CSS framework.
- FastAPI: Python web framework.
- SQLAlchemy: ORM for database operations.
- MySQL: Relational database.
- Node.js (v16+)
- Python (v3.10+)
- MySQL Database
- Navigate to the backend directory:
cd backend - Create a virtual environment:
python -m venv venv
- Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
- Install dependencies:
pip install -r requirements.txt
- Set up the database:
- Update the
DATABASE_URLin.envwith your MySQL credentials. - Run the database migrations:
alembic upgrade head
- Update the
- Populate the database with sample data:
python app/populate_db.py
- Navigate to the frontend directory:
cd frontend - Install dependencies:
npm install
- Start the development server:
npm run dev
To start both the backend and frontend simultaneously:
- Run the provided batch script:
./runBEandFE.bat
- Access the application:
- Frontend: http://localhost:4321
- Backend API: http://127.0.0.1:8000/docs
app/: Contains the main application logic.routers/: API route definitions.models.py: Database models.schemas.py: Pydantic schemas for data validation.crud.py: Database operations.
alembic/: Database migration scripts..env: Environment variables.
src/: Source code.components/: Svelte components.utils/: Utility functions and stores.pages/: Astro pages.styles/: Global CSS styles.
astro.config.mjs: Astro configuration.tailwind.config.js: Tailwind CSS configuration.
- GET
/api/dishes: Fetch dishes with optional filters. - POST
/api/orders: Create a new order.
- GET
/api/orders: Retrieve all orders. - DELETE
/api/orders/{order_id}: Delete an order by ID.
| Command | Action |
|---|---|
python app/main.py |
Start the backend server. |
alembic upgrade head |
Apply database migrations. |
python app/reset_db.py |
Reset the database. |
| Command | Action |
|---|---|
npm run dev |
Start the frontend server. |
npm run build |
Build the frontend for production. |
npm run preview |
Preview the production build. |
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature-name
- Commit your changes:
git commit -m "Add your message" - Push to the branch:
git push origin feature/your-feature-name
- Open a pull request.
This project is licensed under the MIT License.