|
1 | | -# Welcome to Reflex! |
| 1 | +# CareAgain WebApp |
2 | 2 |
|
3 | | -This is the base Reflex template - installed when you run `reflex init`. |
| 3 | +**CareAgain WebApp** is a web application built using the [Reflex](https://reflex.dev/) framework. |
| 4 | +It serves as the frontend for CareAgain's platform, connecting institutions and organizations involved in medical devices—such as R&D, manufacturing, logistics, and hospitals—into a unified network to foster collaboration and innovation. |
4 | 5 |
|
5 | | -If you want to use a different template, pass the `--template` flag to `reflex init`. |
6 | | -For example, if you want a more basic starting point, you can run: |
| 6 | +## Table of Contents |
7 | 7 |
|
8 | | -```bash |
9 | | -reflex init --template blank |
10 | | -``` |
| 8 | +- [Features](#features) |
| 9 | +- [Project Structure](#project-structure) |
| 10 | +- [Getting Started](#getting-started) |
| 11 | +- [Development](#development) |
| 12 | +- [Testing](#testing) |
| 13 | +- [Deployment](#deployment) |
| 14 | +- [Contributing](#contributing) |
| 15 | +- [License](#license) |
11 | 16 |
|
12 | | -## About this Template |
| 17 | +## Features |
13 | 18 |
|
14 | | -This template has the following directory structure: |
| 19 | +- Modular and extensible architecture using Reflex. |
| 20 | +- Predefined components and templates for rapid development. |
| 21 | +- Dockerized setup for consistent development and deployment environments. |
| 22 | +- Integration-ready with backend services and databases. |
| 23 | +- Focused on fostering collaboration in the medical device ecosystem. |
15 | 24 |
|
16 | | -```bash |
| 25 | +## Project Structure |
| 26 | + |
| 27 | +The project follows the standard Reflex template structure: |
| 28 | + |
| 29 | +``` |
17 | 30 | ├── README.md |
18 | | -├── assets |
| 31 | +├── assets/ |
19 | 32 | ├── rxconfig.py |
20 | | -└── {your_app} |
21 | | - ├── __init__.py |
22 | | - ├── components |
23 | | - │ ├── __init__.py |
24 | | - │ └── sidebar.py |
25 | | - ├── pages |
26 | | - │ ├── __init__.py |
27 | | - │ ├── dashboard.py |
28 | | - │ ├── index.py |
29 | | - │ └── settings.py |
30 | | - ├── styles.py |
31 | | - ├── templates |
32 | | - │ ├── __init__.py |
33 | | - │ └── template.py |
34 | | - └── {your_app}.py |
| 33 | +├── webapp/ |
| 34 | +│ ├── __init__.py |
| 35 | +│ ├── components/ |
| 36 | +│ │ ├── __init__.py |
| 37 | +│ │ └── sidebar.py |
| 38 | +│ ├── pages/ |
| 39 | +│ │ ├── __init__.py |
| 40 | +│ │ ├── dashboard.py |
| 41 | +│ │ ├── index.py |
| 42 | +│ │ └── settings.py |
| 43 | +│ ├── styles.py |
| 44 | +│ ├── templates/ |
| 45 | +│ │ ├── __init__.py |
| 46 | +│ │ └── template.py |
| 47 | +│ └── webapp.py |
| 48 | +├── tests/ |
| 49 | +│ ├── __init__.py |
| 50 | +│ └── test_pages.py |
| 51 | +├── Dockerfile |
| 52 | +├── docker-compose.yaml |
| 53 | +├── requirements.txt |
| 54 | +├── requirements_manual.txt |
| 55 | +├── pyproject.toml |
| 56 | +├── alembic/ |
| 57 | +├── alembic.ini |
| 58 | +├── devops/ |
| 59 | +└── .github/workflows/ |
| 60 | +``` |
| 61 | + |
| 62 | +## Getting Started |
| 63 | + |
| 64 | +### Prerequisites |
| 65 | + |
| 66 | +- Python 3.8 or higher |
| 67 | +- Docker and Docker Compose (optional, for containerized setup) |
| 68 | + |
| 69 | +### Installation |
| 70 | + |
| 71 | +1. Clone the repository: |
| 72 | + |
| 73 | + ```bash |
| 74 | + git clone https://github.com/careagain-org/careagain-webapp.git |
| 75 | + cd careagain-webapp |
| 76 | + ``` |
| 77 | + |
| 78 | +2. Install dependencies: |
| 79 | + |
| 80 | + ```bash |
| 81 | + pip install -r requirements.txt |
| 82 | + ``` |
| 83 | + |
| 84 | +3. Run the application: |
| 85 | + |
| 86 | + ```bash |
| 87 | + reflex run |
| 88 | + ``` |
| 89 | + |
| 90 | + The application will be accessible at `http://localhost:3000`. |
| 91 | + |
| 92 | +## Development |
| 93 | + |
| 94 | +- To add new pages, create a Python file in `webapp/pages/` and define a function with the `@template` decorator. |
| 95 | +- For reusable components, add them to `webapp/components/`. |
| 96 | +- Use `webapp/styles.py` for styling and theming. |
| 97 | +- Add tests in the `tests/` directory to ensure code quality. |
| 98 | + |
| 99 | +## Testing |
| 100 | + |
| 101 | +Run tests using `pytest`: |
| 102 | + |
| 103 | +```bash |
| 104 | +pytest tests/ |
35 | 105 | ``` |
36 | 106 |
|
37 | | -See the [Project Structure docs](https://reflex.dev/docs/getting-started/project-structure/) for more information on general Reflex project structure. |
| 107 | +Ensure all tests pass before submitting changes. |
| 108 | + |
| 109 | +## Deployment |
| 110 | + |
| 111 | +### Using Docker |
| 112 | + |
| 113 | +1. Build the Docker image: |
| 114 | + |
| 115 | + ```bash |
| 116 | + docker build -t careagain-webapp . |
| 117 | + ``` |
| 118 | + |
| 119 | +2. Run the Docker container: |
| 120 | + |
| 121 | + ```bash |
| 122 | + docker run -p 3000:3000 careagain-webapp |
| 123 | + ``` |
| 124 | + |
| 125 | + The application will be accessible at `http://localhost:3000`. |
| 126 | + |
| 127 | +## Contributing |
38 | 128 |
|
39 | | -### Adding Pages |
| 129 | +We welcome contributions from the community. To contribute: |
40 | 130 |
|
41 | | -In this template, the pages in your app are defined in `{your_app}/pages/`. |
42 | | -Each page is a function that returns a Reflex component. |
43 | | -For example, to edit this page you can modify `{your_app}/pages/index.py`. |
44 | | -See the [pages docs](https://reflex.dev/docs/pages/routes/) for more information on pages. |
| 131 | +1. Fork the repository. |
| 132 | +2. Create a new branch: |
45 | 133 |
|
46 | | -In this template, instead of using `rx.add_page` or the `@rx.page` decorator, |
47 | | -we use the `@template` decorator from `{your_app}/templates/template.py`. |
| 134 | + ```bash |
| 135 | + git checkout -b feature/your-feature-name |
| 136 | + ``` |
48 | 137 |
|
49 | | -To add a new page: |
| 138 | +3. Make your changes and commit them: |
50 | 139 |
|
51 | | -1. Add a new file in `{your_app}/pages/`. We recommend using one file per page, but you can also group pages in a single file. |
52 | | -2. Add a new function with the `@template` decorator, which takes the same arguments as `@rx.page`. |
53 | | -3. Import the page in your `{your_app}/pages/__init__.py` file and it will automatically be added to the app. |
| 140 | + ```bash |
| 141 | + git commit -m "Add your message here" |
| 142 | + ``` |
54 | 143 |
|
| 144 | +4. Push to your forked repository: |
55 | 145 |
|
56 | | -### Adding Components |
| 146 | + ```bash |
| 147 | + git push origin feature/your-feature-name |
| 148 | + ``` |
57 | 149 |
|
58 | | -In order to keep your code organized, we recommend putting components that are |
59 | | -used across multiple pages in the `{your_app}/components/` directory. |
| 150 | +5. Open a pull request detailing your changes. |
60 | 151 |
|
61 | | -In this template, we have a sidebar component in `{your_app}/components/sidebar.py`. |
| 152 | +## License |
62 | 153 |
|
63 | | -### Adding State |
| 154 | +This project is licensed under the [APACHE 2.0](LICENSE). |
64 | 155 |
|
65 | | -As your app grows, we recommend using [substates](https://reflex.dev/docs/substates/overview/) |
66 | | -to organize your state. |
| 156 | +--- |
67 | 157 |
|
68 | | -You can either define substates in their own files, or if the state is |
69 | | -specific to a page, you can define it in the page file itself. |
| 158 | +For more information on the Reflex framework, visit the [official documentation](https://reflex.dev/docs). |
0 commit comments