Skip to content

Commit c8aa271

Browse files
[docs] Update v1 docs for Vite port requirements (#132)
* [docs] Update v1 docs for Vite port requirements * Copilot feedback
1 parent 146a144 commit c8aa271

File tree

3 files changed

+66
-3
lines changed

3 files changed

+66
-3
lines changed

cookiecutter/v1/{{ cookiecutter.package_name }}/README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,25 @@ from {{ cookiecutter.import_name }} import {{ cookiecutter.import_name }}
1818
value = {{ cookiecutter.import_name }}()
1919

2020
st.write(value)
21-
```
21+
```
22+
23+
## Local development
24+
25+
1. Start Streamlit from the project root:
26+
27+
```sh
28+
streamlit run {{ cookiecutter.import_name }}/example.py
29+
```
30+
31+
2. In another terminal, run the Vite dev server from `{{ cookiecutter.import_name }}/frontend`:
32+
33+
```sh
34+
npm install
35+
npm run start
36+
```
37+
38+
### Important dev server notes
39+
40+
- The browser connects to the Vite dev server directly. Streamlit does **not** proxy this port, so the Vite port must be reachable from the client just like the Streamlit port.
41+
- Vite listens on the value of `VITE_PORT` (default `3001`). This variable lives in `{{ cookiecutter.import_name }}/frontend/.env`. Update that file whenever you need to change the port, and remember that Windows/WSL/Hyper-V or dev containers may silently remap addresses like `3001`.
42+
- If a port is unavailable or blocked by a firewall/mobile connection, set `VITE_PORT=5173` (Vite's default) or any other open port inside the `.env` file before running `npm run start`, and ensure that port is reachable from your browser.

templates/v1/template-reactless/README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,25 @@ from my_component import my_component
1818
value = my_component()
1919

2020
st.write(value)
21-
```
21+
```
22+
23+
## Local development
24+
25+
1. Start Streamlit from the project root:
26+
27+
```sh
28+
streamlit run my_component/example.py
29+
```
30+
31+
2. In another terminal, run the Vite dev server from `my_component/frontend`:
32+
33+
```sh
34+
npm install
35+
npm run start
36+
```
37+
38+
### Important dev server notes
39+
40+
- The browser connects to the Vite dev server directly. Streamlit does **not** proxy this port, so the Vite port must be reachable from the client just like the Streamlit port.
41+
- Vite listens on the value of `VITE_PORT` (default `3001`). This variable lives in `my_component/frontend/.env`. Update that file whenever you need to change the port, and remember that Windows/WSL/Hyper-V or dev containers may silently remap addresses like `3001`.
42+
- If a port is unavailable or blocked by a firewall/mobile connection, set `VITE_PORT=5173` (Vite's default) or any other open port inside the `.env` file before running `npm run start`, and ensure that port is reachable from your browser.

templates/v1/template/README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,25 @@ from my_component import my_component
1818
value = my_component()
1919

2020
st.write(value)
21-
```
21+
```
22+
23+
## Local development
24+
25+
1. Start Streamlit from the project root:
26+
27+
```sh
28+
streamlit run my_component/example.py
29+
```
30+
31+
2. In another terminal, run the Vite dev server from `my_component/frontend`:
32+
33+
```sh
34+
npm install
35+
npm run start
36+
```
37+
38+
### Important dev server notes
39+
40+
- The browser connects to the Vite dev server directly. Streamlit does **not** proxy this port, so the Vite port must be reachable from the client just like the Streamlit port.
41+
- Vite listens on the value of `VITE_PORT` (default `3001`). This variable lives in `my_component/frontend/.env`. Update that file whenever you need to change the port, and remember that Windows/WSL/Hyper-V or dev containers may silently remap addresses like `3001`.
42+
- If a port is unavailable or blocked by a firewall/mobile connection, set `VITE_PORT=5173` (Vite's default) or any other open port inside the `.env` file before running `npm run start`, and ensure that port is reachable from your browser.

0 commit comments

Comments
 (0)