Rewire is a mobile application designed to assist individuals in overcoming addictions through a structured, step-by-step approach without the use of medication. The app leverages an AI-driven chatbot and questionnaires to assess addiction levels and categorize addictions into substance-based or behavioral types.
- Addiction recovery task recommender
- Integrated AI ChatBot
- Community platform
- Emergency support system
- First, make sure you are not in another Git repository. Run the following command to check:
Expected output:
git status
fatal: not a git repository (or any of the parent directories): .git
- To clone this repository to your computer, run one of the following commands:
- HTTPS:
git clone https://github.com/Project-Rewire/App.git
- SSH (Recommended for a persistent and secure connection)
git clone git@github.com:Project-Rewire/App.git
- HTTPS:
- View available branches:
git branch -a
- Switch to a branch:
(If
git switch branch_name
git switchis not available, usegit checkout branch_nameinstead.) - Create a new local branch:
git branch new_branch_name
- Push the newly created branch to the remote repository:
git push -u origin new_branch_name
-
Stage changes:
- Stage specific files:
git add file_name1 file_name2 file_name3
- Stage all changes:
git add .
- Stage specific files:
-
Commit the changes:
git commit -m "type(scope): A Meaningful Commit Message"Commit Message Format (Conventional Commits):
type(scope): A Meaningful Commit Message- type:
feat(new feature),fix(bug fix),chore(maintenance),docs(documentation update), etc. - scope: Module or feature affected (e.g.,
auth,dashboard) - message: A brief, meaningful description of the changes
Example:
git commit -m "feat(auth): Add user login functionality"Refer to Conventional Commits for more details.
- type:
- Merging branches into
mainshould only be done on GitHub. - To merge, create a "Pull Request" (PR) with a brief description of the changes.
- Always specify a reviewer for the PR.
- Once the PR is approved, merge it yourself.
- Make sure the latest version of
nodeis installed:You should see an output similar to the following:node -v
v22.13.1 - Open IDE at the
App/frontenddirectory.
- Install the required
node_modulesnpm install
- Run the following to start the frontend in the development mode:
npm start
- Enter
wfor web view or enterhttp://localhost:8081in the browser.
- Ensure Docker is installed and up to date:
Expected output (version may vary):
docker --version
Docker version 27.5.1, build 9f9e405 - Ensure Docker is running in the background.
- Open your IDE at the
App/backend/rewiredirectory.
-
Build and start the containers:
docker-compose up --build
The first run may require downloading dependencies, so it could take additional time.
-
Once started, the server should be available on port
8000. Expected output:✔ rewire Built ✔ Network rewire_default Created ✔ Container rewire-db-1 Created ✔ Container rewire-rewire-1 Created Attaching to db-1, rewire-1 db-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization db-1 | LOG: database system is ready to accept connections rewire-1 | Django version 5.1.6, using settings 'admin.settings' rewire-1 | Starting development server at http://0.0.0.0:8000/
If you encounter an error like:
django.db.utils.OperationalError: connection failed: connection to server at "172.18.0.2", port 5432 failed: Connection refused
-
Stop the container by pressing
ctrl+c. -
Restart it:
docker-compose up
-
Verify the server is running by opening
http://localhost:8000. You should see a Django 404 page.
- Ensure Python 3.9 or above is installed:
You should get something like this:
python --version
Python 3.13.0 - Open your IDE at the
App/backend/rewiredirectory.
- Install virtualenv (if not installed):
pip install virtualenv
- Create a virtual environment:
python -m venv .venv
- Confirm
.venvfolder exists. - Activate the virtual environment:
- Mac/Linux:
source .venv/bin/activate - Windows (PowerShell):
.venv/Scripts/Activate.ps1
- Windows (CMD):
C:/Users/<USER>/<PATH>/App/backend/rewire/.venv/Scripts/activate.bat
(.venv)at the beginning of your terminal prompt. - Mac/Linux:
- Install required packages from
requirements.txt:pip install -r requirements.txt
- Ensure a PostgreSQL database is running.
- Use the provided
.envfile (not included in the repository for security reasons) to configure credentials. - Database setup is beyond the scope of this guide; refer to the appropriate documentation.
- Start the backend:
Expected output:
python manage.py runserver 8000
Watching for file changes with StatReloader Performing system checks... System check identified no issues. Django version 5.1.6, using settings 'admin.settings' Starting development server at http://0.0.0.0:8000/ - Stop the server using
Ctrl+C.
When starting the server for the first time, you may see:
You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations.
Run 'python manage.py migrate' to apply them.
- Open a new terminal in the same directory and enter the Docker shell:
docker-compose exec rewire sh - Apply migrations:
python manage.py makemigrations core recommendations questionnaire aiprofile
python manage.py migrate
- Restart the server, and the warning should be gone.
- Apply migrations directly:
python manage.py makemigrations core
python manage.py migrate
- Restart the server and verify that the warning disappears.