Daily Flow is a habit-tracking application built with Node.js, Express, MySQL, and Pug. This README will guide you through the steps to install and set up the project on your local machine.
Ensure you have the following installed on your system:
- Node.js: Download here (version 14+ recommended)
- MySQL: Download here
- Git: Download here
- A code editor (e.g., VS Code)
- Clone the repository by running the following command in your terminal:
git clone https://github.com/danilo-quattrini/daily-flow.git
cd daily-flow
- Install the project dependencies by running the following command:
npm install
- Create a MySQL database:
Open your MySQL client (e.g., MySQL Workbench, phpMyAdmin, or terminal) and import the daily_flow_db.sql file to set up the database structure. Using MySQL CLI:
mysql -u your_user -p your_password < models/daily_flow_db.sql
Replace your_user
and your_password
with your MySQL credentials.
Using MySQL Workbench:
- Open Workbench and connect to your MySQL server.
- Go to the File > Run SQL Script option.
- Select the daily_flow_db.sql file and execute.
- Confirm the Database:
Ensure the database is created and includes tables such as app_users, habits, etc.
- Rename .env.example to .env.:
mv .env.example .env
- Edit the .env file: Open the .env file in a code editor and update the following environment variables:
DB_HOST=localhost
DB_USER=your_mysql_user
DB_PASS=add_your_password_here
DB_NAME=daily_flow_db
PORT=3000
SESSION_SECRET=z+Ilx8n2RKwXMGHchWpKqCzJ2BscF2VNgN8Z30PZ4e1hMETGGyUHnForzKOnA6vO
Replace:
- your_mysql_user with your MySQL username.
- add_your_password_here with your MySQL password.
- (optional) Change the PORT value if you want to use a different port.
- (optional) Change the SESSION_SECRET value to a random string.
- Start the server:
Run the following command to start the server:
npm start
- Access the application:
Open your browser and go to http://localhost:3000 to access the application.
- The application is set to run on port 3000 by default. You can change this in the .env file.
- The database credentials should match your MySQL credentials.
- Ensure your MySQL server is running before starting the application.
- To reset the database, you can re-import the daily_flow_db.sql file.
This project is licensed under the MIT License - see the LICENSE file for details.