Library management tool
/
├── frontend/ # Next.js frontend application
└── backend/ # Flask backend application
- Navigate to backend directory:
cd backend- Install backend dependencies:
pip install -r requirements.txt- Configure environment variables:
Create a
.envfile in the backend directory with the following structure:
MYSQL_USER=your_username
MYSQL_PASSWORD=your_password
MYSQL_HOST=localhost
MYSQL_DATABASE=library_db
MYSQL_PORT=3306
FLASK_DEBUG=1
FLASK_PORT=5000For example:
MYSQL_USER=root
MYSQL_PASSWORD=password123
MYSQL_HOST=localhost
MYSQL_DATABASE=library_db
MYSQL_PORT=3306
FLASK_DEBUG=1
FLASK_PORT=5000- Initialize the database (optional - if you want to create fresh tables):
flask init-db- Run the backend application:
python run.pyThe backend API will be available at http://localhost:5000
To check database status:
flask db-status- Navigate to frontend directory:
cd frontend- Install frontend dependencies:
npm install- Run the development server:
npm run devThe frontend application will be available at http://localhost:3000
To work on the full application, you'll need to run both the frontend and backend servers:
- Terminal 1 - Backend:
cd backend
python run.py- Terminal 2 - Frontend:
cd frontend
npm run dev- Python 3.8+
- MySQL installed and running
- Required Python packages listed in
backend/requirements.txt
- Node.js 18+
- npm or yarn
- Required npm packages listed in
frontend/package.json
MYSQL_USER: MySQL usernameMYSQL_PASSWORD: MySQL passwordMYSQL_HOST: MySQL host addressMYSQL_PORT: MySQL port (default: 3306)MYSQL_DATABASE: Database nameFLASK_DEBUG: Debug mode (1 for development, 0 for production)FLASK_PORT: Port for Flask application (default: 5000)
Make sure you have MySQL installed and running on your machine before starting the backend application.