This project is a mental health application designed for astronauts. It provides features such as user authentication, a point system for completing tasks, and a map to track when the ISS flies over certain areas.
- User Authentication: Secure login and registration using JWT.
- Point System: Earn points by completing various tasks.
- ISS Tracker: View the current position of the ISS and see when it flies over specific locations.
- Backend: Flask, SQLAlchemy, PostgreSQL, Flask-JWT-Extended, Flask-CORS, Flasgger for API documentation.
- Frontend: React, Tailwind CSS, Leaflet for maps.
- Database: PostgreSQL
- Cloud Storage: AWS S3 for storing images.
- Infrastructure as Code: Terraform for managing cloud resources.
- Node.js and npm
- Python 3.x
- PostgreSQL
- AWS account for S3
- Terraform
Create a .env file in the backend directory with the following variables:
DB_USER=<your_db_user>
DB_PASSWORD=<your_db_password>
DB_HOST=<your_db_host>
DB_PORT=<your_db_port>
DB_NAME=<your_db_name>
AWS_REGION=<your_aws_region>
AWS_ACCESS_KEY_ID=<your_aws_access_key_id>
AWS_SECRET_ACCESS_KEY=<your_aws_secret_access_key>
S3_BUCKET_NAME=<your_s3_bucket_name>
JWT_SECRET_KEY=<your_jwt_secret_key>
You can look at the template in the .env.local file
-
Navigate to the
backenddirectory:cd backend -
Install the required Python packages:
pip install -r requirements.txt
-
Initialize the database:
python initdb.py
-
Run the Flask application:
flask run
-
Navigate to the
frontenddirectory:cd frontend -
Install the required npm packages:
npm install
-
Start the React application:
npm start
-
Navigate to the
infrastructuredirectory:cd infrastructure -
Initialize Terraform:
terraform init
-
Apply the Terraform configuration to set up the necessary cloud resources:
terraform apply
- Register:
POST /api/register - Login:
POST /api/login - Protected Route:
GET /api/protected
- Get All Tasks:
GET /api/tasks - Get Task by ID:
GET /api/tasks/<int:task_id> - Complete Task:
POST /api/tasks/<int:task_id>/complete - Get Recent User Tasks:
GET /api/user-tasks/recent/<int:n> - Get Tasks Not Completed by User:
GET /api/tasks/not-completed
- Generate Pre-signed URL:
POST /api/generate-presigned-url