We built Sleepyhead to help improve your sleep quality.
Sleepyhead measures how your bedroom affects your sleep (via light, noise, air quality, and temperature) and gives suggestions on how you can change your environment to get better sleep
Our team of 4 created Sleepyhead in 12 hours for Jisc IoT Hackathon in Glasgow and won.
Here's some screenshots from the web app:
This project is split into two sections:
server
- a server which stores and serves data through a RESTful APIweb
- a web app which fetches sleep data from the API server then displays it in a beautiful interface with graphs and sleep suggestions
Here's how to get a copy of the project up and running on your local machine for development and testing purposes.
See deployment for notes on how to deploy the project on a live system.
What things you need to install the software and how to install them
-
Install Git
-
Install Node.js (Node 12 LTS is recommended)
-
Have a Postgres database running locally or in the cloud (you'll need the credentials for it)
-
Prerequisites for embedded devices... (TODO)
First off, download this repository to your machine by running this command in a Terminal window:
git clone https://github.com/DMeechan/Sleepyhead.git
Then enter the repository:
cd Sleepyhead
Open the server folder:
cd server
Create a .env file:
cp .env.example .env
Open up the .env
file and edit the database URL to point to your own Postgres database
Next, install depencencies:
npm install
Start a local development server:
npm run dev
Now visit http://localhost:3000
to check that your API server works!
In a new Terminal window (to keep your local backend running), open up the repository folder and then enter the web folder:
cd web
Install depencencies:
npm install
Start a local development server:
npm run start
TODO
We recommend deploying the backend to any cloud provider which supports Node.js applications and Postgres (like Render or Heroku).
And we recommend deploying the frontend to a cloud provider which supports static sites (like Render or Netlify).
Set up a Postgres database and then set up a Node.js application with the following settings:
Build command:
cd server && npm i
Start command:
cd server && npm start
Health check path (used by Render):
/health
Don't forget to set the
DATABASE_URL
environment variable to point to your database in the cloud.
You can deploy the React web app as a static site for free with providers like Netlify and Render. To do so, use these settings:
Build command:
cd web && npm i && npm run build
Start command:
./web/build
- Node.js - Used to run the backend API server
- TypeScript - Used to write the backend server
- React.js - Used to build the web app
- PostgreSQL - The database used by the backend server to store data
- Adriana Cucu - Frontend - AdrianaCucu
- Adam Binks - Frontend - adam-binks
- Daniel Meechan - Backend - DMeechan
- Ferdia McKeogh - Embedded - chocol4te