This project was developed as part of the QueenB x AppsFlyer BeSafe Hackathon 2025, focusing on sleep tracking and inspiration boards. The application helps users monitor their sleep patterns and maintain a board of inspirational content.
The application is a full-stack app with a Node.js server, Express API, and a React client. Users can track their sleep time, wake-up time, and date, get personalized sleep tips using the Gemini API, as well as add and view inspiring content and get inspiration quotes using an API.
-
Record sleep time, wake-up time, and date with auto-filled today's date.
-
Uses 24-hour clock format for inputs.
-
Get personalized sleep tips by AI.
- Add, view, and manage inspirational influencers.
- Mobile-friendly layout with intuitive UI.
- Node.js
- Version 20.x or higher required (latest LTS recommended)
npm(will be typically installed automatically when you install Node.js above)- Version 10.x or higher required (get the latest by running
npm install -g npm@latest --no-optional)
- Version 10.x or higher required (get the latest by running
To get started with this project, you need to clone the repository to your local machine. Follow these steps:
- Create a project from this repository by clicking on
Use this template->Create a new repository(more info here) - Clone the new Repository: https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository
- Navigate to the server directory:
cd server - Install server dependencies:
npm install
- Navigate to the client directory:
cd ../client - Install client dependencies:
npm install
Environment variables are used to configure your application without hardcoding sensitive information into your code. For this project, you need to set up the following environment variables in .env files located both in the server directory and client directory.
Make a copy of the .env.example file under the server folder and name it .env. This file contains the following environment variables (you don't need to touch them at this point):
CLIENT_URL- this should match the URL of the client, which is what you'll see at the address bar of your browser after running your client (vianpm start).PORT- This variable defines the port on which your Express server will run. By default, this is set to5000, but you can change it to any available port number.
Make a copy of the .env.example file under the server folder and name it .env.
This file contains the following environment variable (you don't need to touch them at this point):
VITE_SERVER_API_URL: This variable contains the URL of your backend API. It tells your client where to send requests to interact with the server. By default, this should be set to http://localhost:5000/, but you should change it to match your server's actual URL if different (where 5000 is thePORTyou defined in the server.envfile above).
This section explains how to use the application once it’s set up and configured. Follow these steps to interact with both the client and server components of the application.
- Open a terminal in the root folder of the cloned repository, and navigate to the
serverdirectory:cd server - Start the Express server in development mode:
npm run dev- By default, the server will run on
http://localhost:5000(see configuration section above)
- By default, the server will run on
-
Open a new terminal in the root folder of the cloned repository, and navigate to the
clientdirectory:cd client -
Run the Frontend Client:
npm run dev- A new browser window with the client application should open (if you close the tab, you can return to it by navigating to http://localhost:3000/ by default)
- Click the
Show Random Duckbutton to retrieve a random duck from the database and display its details on the screen. - This feature helps verify that your frontend can communicate with the backend. If you see the random duck's details displayed on the page, your setup is working properly.
- You may also use an API client (like Postman) to directly test your API endpoints.
Please report any issues or provide feedback for further improvements!
- Stop the Express Server: In the terminal where the server is running, press
Ctrl + Cto stop the server. - Stop the React Client: In the terminal where the client is running, press
Ctrl + Cto stop the client.
Ensure backend and frontend configurations (.env files) are correct.
-
Server Issues:
- Ensure that the React development server is running and that you have no conflicting applications using port 3000.
- Check the terminal for error messages
-
Client Issues:
- Check the browser dev tools console for errors if the client is not displaying correctly (recommended: https://reactjs.org/link/react-devtools).
- Check the browser dev tools network logs for failed requests
Contains the React (Vite) frontend application.
package.json: Lists the client-side dependencies and scripts for managing the React application..env: Stores environment variables like the API endpoint URL.index.html: Main HTML page hosting all the React components of the application (frontend entry point)public/: static assets that do not need to be processed by Vite's build pipeline. These files are copied as-is to the build output directory. In our case, the HTML's favicon.src/: Contains the source code for the React application.assets/: assets that are part of the source code and need to be processed by Vite's build pipeline. This includes images, fonts, and other files that might be imported into your JS or CSS files. In our case, the QueenB summer camp logo.components/: Reusable UI components such as buttons, forms, and other elements.context/: Contains the React context for the ducks, responsible for pulling the current duck from the APIpages/: Page components that represent different routes in the application.services/: Services for making API calls and handling business logic.styles/: CSS and styling files for the application.App.jsx: The main React component that sets up routing and renders the application.index.jsx: The entry point for the React application, responsible for rendering the App component into the DOM.
Contains the Node.js / Express backend application.
package.json: Lists the server-side dependencies and scripts for managing the Node.js application..env: Stores environment variables like database connection strings and server port.server.js: The main server file that sets up Express, connects to the database, and starts the server (backend entry point).controllers/: Contains the logic for handling API requests and responses.data/: Contains the initial duck data (readonly database)images/: Contains the duck images referenced by the duck data aboveroutes/: Defines the API endpoints and maps them to controller functions.
For any issues please contact us via mail or open an issue.
Happy Coding! :)