Skip to content

Commit 5251043

Browse files
authored
Update README.md
1 parent 3612f74 commit 5251043

File tree

1 file changed

+67
-101
lines changed

1 file changed

+67
-101
lines changed

README.md

+67-101
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# TODO App developed with Flask and ReactJS
1+
# TODO App built with Flask and ReactJS
22

3-
This is a basic application with the objective of being able to save your notes and have them stored in a database. The user is able to perform basic actions such as create, read, update and delete this data, a basic CRUD.
3+
This is an web app with the objective of being able to save your notes and have them stored in a database. The user is able to perform basic actions such as create, read, update and delete this data, a basic CRUD.
44

55
## Table of contents
66

@@ -10,28 +10,38 @@ This is a basic application with the objective of being able to save your notes
1010
- [Backend](#backend)
1111
- [REST API](#rest-api)
1212
- [Image gallery](#image-gallery)
13-
- [Desktop](#desktop)
14-
- [Mobile](#mobile)
13+
- [REST API](#rest-api-preview)
14+
- [Frontend](#frontend-preview)
1515

1616
## Built with
1717

1818
The project was developed from scratch with Frontend and Backend technologies, for the communication between the client and the server I implemented a REST API, which is responsible for returning the necessary data in JSON format to the client:
1919

2020
- Frontend:
2121
- ReactJS
22-
- SCSS
23-
- Styled Components
22+
- TypeScript
23+
- TailwindCSS
24+
- Axios
25+
- ShadcnUI
26+
- React Router Dom
27+
- React Hook Form
28+
- Zustand
29+
- React Query
2430

2531
- Backend:
2632
- Python (Flask)
2733
- SQLite (As database manager)
2834
- Flask Migrate (To perform migrations)
2935
- SQLAlchemy and Flask SQLAlchemy (Python SQL toolkit and ORM that gives application developers the full power and flexibility of SQL)
3036
- REST API (For communication between client and server)
37+
- SwaggerUI
38+
- Flask Smorest (Used for rest api creation and schema creation)
39+
- Flask JWT Extended (For the creation of JWT)
40+
- MVC (Software Design Pattern)
3141

3242
## Project requirements and how to use it
3343

34-
For the project you must run both development environments at the same time, both the Frontend and the Backend. In the Frontend you will find JavaScript technologies (ReactJS) and in the Backend you will find Python technologies and tools (Flask), so you must have NodeJS and Python installed on your computer (As a reference this project was developed with version 3.9.6 of Python and 18.12.1 of NodeJS).
44+
For the project you must run both development environments at the same time, both the Frontend and the Backend. In the Frontend you will find JavaScript technologies (ReactJS) and in the Backend you will find Python technologies and tools (Flask), so you must have NodeJS and Python installed on your computer (As a reference this project was developed with version 3.13.0 of Python and 22.11.0 of NodeJS).
3545

3646
I leave you links to NodeJS and Python for installation:
3747
- [NodeJS website](https://nodejs.org/en/)
@@ -45,7 +55,7 @@ $ git clone https://github.com/Remy349/todo-app-flask-reactjs.git
4555
$ cd todo-app-flask-reactjs
4656
```
4757

48-
If you did it correctly and there were no problems, you should see these folders in your terminal:
58+
If you did it correctly and there were no problems, you should see these folders:
4959

5060
```shell
5161
/backend
@@ -71,13 +81,11 @@ $ npm install
7181
$ npm run dev
7282

7383
# You will see something like this:
74-
75-
> vite
76-
77-
VITE v3.2.4 ready in 2079 ms
84+
VITE v5.4.11 ready in 349 ms
7885

7986
➜ Local: http://localhost:5173/
8087
➜ Network: use --host to expose
88+
➜ press h + enter to show help
8189
```
8290

8391
3. That's all for the Frontend, if you haven't run the Backend yet, continue with the next section (Backend)
@@ -103,123 +111,81 @@ $ . venv/bin/activate
103111
(venv) $ pip install -r requirements.txt
104112
```
105113

106-
3. Now you can start running the server:
114+
3. Create an .env file and add an environment variable for JWT creation:
115+
116+
```shell
117+
# This is an example
118+
JWT_SECRET_KEY="c7d57142e46f169ce9dbeb8d96603e46"
119+
```
120+
121+
4. Now you can start running the server:
107122

108123
```shell
109124
(venv) $ flask run
110125

111126
# You will see something like this:
112-
DATABASE_URI is OK!!!
113-
* Serving Flask app 'application.py'
127+
* Serving Flask app 'application.py'
114128
* Debug mode: on
115129
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
116130
* Running on http://127.0.0.1:5000
117131
Press CTRL+C to quit
132+
* Restarting with stat
133+
* Debugger is active!
134+
* Debugger PIN: 140-954-082
118135
```
119136

137+
5. Visit the path where the Swagger interface is located to see all the api endpoints:
138+
139+
`http://localhost:5000/docs`
140+
120141
With this you will have your Python environment ready to work, it also has a database so you don't have to worry about that and it already has some data already entered so you can interact with the REST API.
121142

122143
But if you want to start blank with no previously stored data delete the database and run the following command to create a new database (This step is optional):
123144

124145
```shell
125146
# This will create a new database with the necessary tables to store the data
126-
# if you want to know the table structure have a look at the "/flaskr/models.py" file.
147+
# if you want to know the table structure have a look at the "/flaskr/models" folder.
127148
(venv) $ flask db upgrade
128149
```
129150

130-
### REST API
131-
132-
Everything related to the API is inside `flaskr/api/tasks.py`. The following table summarizes the routes that were implemented:
133-
134-
| HTTP Method | Resource URL | Notes |
135-
| ----------- | ------------------- | --------------------------------------- |
136-
| `GET` | */api/tasks* | Return the collection of all tasks. |
137-
| `GET` | */api/tasks/id* | Return a single task. |
138-
| `POST` | */api/tasks* | Register a new task. |
139-
| `PUT` | */api/tasks/id* | Modify the values of a task. |
140-
| `DELETE` | */api/tasks/id* | Delete a task from the collection. |
141-
142-
The API provides the responses in JSON format that the Frontend needs, plus a pagination method was implemented to not send multiple data and thus not overload the client interface.
143-
144-
If you make a `GET` request for all tasks you will see something like this:
145-
146-
- `http://localhost:5000/api/tasks`
151+
After you have done the previous step add some default data for the task labels. Do this by running the following command in the terminal:
147152

148153
```shell
149-
{
150-
"items": [
151-
{
152-
"description": "Just doing some test to finally complete this project! :)",
153-
"id_task": 1,
154-
"timestamp": "Tue, 20 Dec 2022 02:25:49 GMT",
155-
"title": "Test1"
156-
},
157-
{
158-
"description": "Just doing some test to finally complete this project! :)",
159-
"id_task": 2,
160-
"timestamp": "Tue, 20 Dec 2022 02:26:02 GMT",
161-
"title": "Test2"
162-
},
163-
{
164-
"description": "Just doing some test to finally complete this project! :)",
165-
"id_task": 3,
166-
"timestamp": "Tue, 20 Dec 2022 02:26:09 GMT",
167-
"title": "Test3"
168-
},
169-
{
170-
"description": "Just doing some test to finally complete this project! :)",
171-
"id_task": 4,
172-
"timestamp": "Tue, 20 Dec 2022 02:26:22 GMT",
173-
"title": "Test4"
174-
},
175-
{
176-
"description": "Just doing some test to finally complete this project! :)",
177-
"id_task": 6,
178-
"timestamp": "Tue, 20 Dec 2022 02:27:23 GMT",
179-
"title": "Test5"
180-
},
181-
{
182-
"description": "Just doing some test to finally complete this project! :)",
183-
"id_task": 7,
184-
"timestamp": "Tue, 20 Dec 2022 04:37:03 GMT",
185-
"title": "Test6"
186-
}
187-
],
188-
"links": {
189-
"next": "/api/tasks?page=2&per_page=6",
190-
"prev": null,
191-
"self": "/api/tasks?page=1&per_page=6"
192-
},
193-
"meta": {
194-
"page": 1,
195-
"per_page": 6,
196-
"total_items": 7,
197-
"total_pages": 2
198-
}
199-
}
154+
python seed.py
200155
```
201156

157+
### REST API
158+
159+
Everything related to the API is inside `flaskr/routes`. The following table summarizes the routes that were implemented:
160+
161+
| HTTP Method | Resource URL | Notes |
162+
| ----------- | ----------------------- | --------------------------------------- |
163+
| `POST` | */api/v1/auth/sign-in* | Auth user and create JWT |
164+
| `GET` | */api/v1/users* | Get a list of all users |
165+
| `POST` | */api/v1/users* | Create a new user |
166+
| `GET` | */api/v1/users/id* | Get a single user by id |
167+
| `DELETE` | */api/v1/users/account* | Delete a user account |
168+
| `GET` | */api/v1/tags* | Get a list of tags |
169+
| `POST` | */api/v1/tags* | Create a new tag |
170+
| `POST` | */api/v1/tasks* | Create a new task |
171+
| `GET` | */api/v1/tasks/user* | Get a list of all tasks on user |
172+
| `PUT` | */api/v1/tasks/id* | Update a task |
173+
| `DELETE` | */api/v1/tasks/id* | Delete a task |
174+
202175
## Image gallery
203176

204-
### Desktop:
177+
### REST API Preview:
205178

206-
![PREVIEW](./preview/preview.png)
207179
![PREVIEW](./preview/preview1.png)
180+
![PREVIEW](./preview/preview2.png)
181+
182+
### Frontend Preview
208183

209-
### Mobile
210-
211-
<table>
212-
<tr>
213-
<td>
214-
<img src="./preview/preview-m.png" alt="Mobile" title="Mobile version" width="100%" />
215-
</td>
216-
<td>
217-
<img src="./preview/preview-m1.png" alt="Mobile" title="Mobile version" width="100%" />
218-
</td>
219-
<td>
220-
<img src="./preview/preview-m2.png" alt="Mobile" title="Mobile version" width="100%" />
221-
</td>
222-
</tr>
223-
</table>
184+
![PREVIEW](./preview/preview3.png)
185+
![PREVIEW](./preview/preview4.png)
186+
![PREVIEW](./preview/preview5.png)
187+
![PREVIEW](./preview/preview6.png)
188+
![PREVIEW](./preview/preview7.png)
189+
![PREVIEW](./preview/preview8.png)
224190

225191
### Developed by Santiago de Jesús Moraga Caldera - Remy349(GitHub)

0 commit comments

Comments
 (0)