You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<palign="center">Fully-featured, Django v5 + React v18 boilerplate with great DX.</p>
6
+
<palign="center">Fully-featured, Django 5 + React 18 boilerplate with great DX.</p>
7
7
</p>
8
8
9
9
---
10
10
11
-
This is a fully-featured Django + React boilerplate built for great development experience and easy deployment guidelines.
11
+
This is an opinionated fully-featured Django + React boilerplate built for great development experience and easy deployment guidelines.
12
+
13
+
It is ideal if you want to bootstrap a blog or a portfolio website quickly, or even a more complex application that requires a backend and a frontend, while leveraging the best from React and Django.
-[Exclusively used in production](#exclusively-used-in-production)
29
+
-[Frontend](#frontend-1)
30
+
-[Exclusively used in production](#exclusively-used-in-production-1)
12
31
13
32
## Getting started
14
33
@@ -30,6 +49,10 @@ For convenience, if you want to use Docker + Docker Compose to spin up a Postgre
30
49
pnpm run dev:db:up
31
50
```
32
51
52
+
### Setting up a CDN
53
+
54
+
This project uses Cloudinary as a CDN, so you will need to have an account on Cloudinary and set up the `.env` file with the correct credentials. Use the [`.env.example`](./.env.example) file as a reference.
55
+
33
56
### Running the project
34
57
35
58
Once you've set up the database, you can start the project by running one of:
@@ -41,7 +64,7 @@ pnpm dev:full # Starts the project while assuming you've setup a database using
41
64
42
65
By default, the frontend app will run on `localhost:4000` and the backend app will run on `localhost:8000`. If you're running the containerized Postgres, it will run on `localhost:5432` and pgAdmin will run on `localhost:5050`.
43
66
44
-
## Application architecture
67
+
## Application architecture & features
45
68
46
69
This application's architect is quite simple and leverages the best of both Django and React. On a nutshell, React and Django integrate through Django's Views and Django Rest Framework's API endpoints.
47
70
@@ -60,67 +83,42 @@ flowchart TD
60
83
n0 -- Consumes API Key\nto authenticate\nwith backend --> ng
61
84
```
62
85
63
-
### Global
64
-
65
-
- Commit lint rules
86
+
Below you will find the stack used for each part of the application and the features that are already implemented.
| CI/CD to any V.M. (AWS EC2s, GCloud apps, Digital Ocean droplets, Hostgator VPSs, etc) accessible via SSH (the `hml` and `prd` branches will trigger the [deploy workflow](#Virtualized-Deploy-Workflow)) | ✔️ |
106
-
| CI/CD to deploy straight on host (without virtualization; not recommended) (the branch `prd-host` will trigger this. See more on the [host deploy workflow](#Host-Deploy-Workflow) method) | ✔️ |
111
+
Although this project provides some guidelines on how to deploy the app, it is not mandatory to follow them. You can deploy the app on any platform you want, as long as it supports Docker and Docker Compose, or even deploy the app on a bare-metal machine.
107
112
108
-
### Integrations
113
+
This codebase has two deploy methods available via GitHub actions:
The `virtualized-deploy-qa` and `virtualized-deploy-prod` branches will trigger this wokflow. You can use it to deploy the app to any Virtual Machine accessible via SSH (AWS EC2s, GCloud apps, Digital Ocean droplets, Hostgator VPSs, etc), and you would likely want to change the name of these branches to something more meaningful to your project.
114
118
115
-
##Development directions
119
+
### Bare-metal Deploy Workflow
116
120
117
-
1. Clone this repo: `git clone https://github.com/marcelovicentegc/django-react-typescript.git`
118
-
2. Create a virtual environment: `python -m venv venv`
119
-
3. Activate it ☝️: `source venv/bin/activate` or `venv\Scripts\activate` if you're on a Windows
120
-
4. Install dependencies: `npm i && pip install -r requirements.txt && cd frontend && npm i`
121
-
5. Setup the project `.env` file by taking as example the `.env.example` on the root folder (refer to [configuration](#Configuration) for more details)
122
-
6. Setup the frontend app's `frontend/.env` file by taking as example the `frontend/.env.example` file (refer to [configuration](#Configuration) for more details)
123
-
7. Start the application: `npm start` (make sure Postgres is up and running)
121
+
The `bare-metail-deploy-qa` and `bare-metal-deploy-prod` branches will trigger this workflow. You can use it to deploy the app straight on the host machine, without any virtualization. This is not recommended, but ou never know when you will need to deploy an app on a bare-metal machine 🤷♀️
124
122
125
123
## Configuration
126
124
@@ -142,9 +140,6 @@ You should configure these variables on a `.env` file on the root folder for the
142
140
| SMTP_HOST_USER || Your SMTP email (should be a GMail one) |
143
141
| SMTP_HOST_PASSWORD | - | Your SMTP email password |
144
142
| TEST | 0 | Used to test the app on the pipeline |
| NODE_ENV |`development`| Let's Webpack know when to build files to correct public path, optimize code and when to prepend localhost for API endpoints or not. Values must be either `development` or `production`. This is hardcoded on the [Dockerfile](./Dockerfile)|
169
164
| AUTH_TOKEN | - | An auth key generated on Django's admin that must be associated to a user with specific permissions (i.g.: read specific infos from Django's ORM) |
170
-
|GTAG_ID | - | Google Analytics ID |
165
+
||
171
166
172
167
#### Exclusively used in production
173
168
@@ -176,18 +171,3 @@ You should configure these variables on a `.env` file on the root folder for the
176
171
| HML_AUTH_KEY | Same as AUTH_KEY but for a HML environment |
177
172
| HML_GTAG_ID | Same as GTAG_ID but for a HML environment |
178
173
179
-
## Deployment worfklows
180
-
181
-
### Virtualized Deploy Workflow
182
-
183
-
Branches `hml` and `prd` will trigger this workflow.
184
-
185
-

186
-
187
-
### Host Deploy Workflow
188
-
189
-
For this kind of deploy to work, you will need a running Postgres database, Nginx, and Supervisor processes.
0 commit comments